7a50673e3497b0063eae11e4250e1e2bcfdd6230
[ldk-java] / src / main / jni / bindings.c
1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include <jni.h>
4 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
5 #define int64_t jlong
6 #include "org_ldk_impl_bindings.h"
7 #include <lightning.h>
8 #include <string.h>
9 #include <stdatomic.h>
10 #include <stdlib.h>
11
12 #define LIKELY(v) __builtin_expect(!!(v), 1)
13 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
14
15 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
16 #define MALLOC(a, _) malloc(a)
17 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
18 #define CHECK_ACCESS(p)
19 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
20 #define DO_ASSERT(a) (void)(a)
21 #define CHECK(a)
22
23 static jmethodID ordinal_meth = NULL;
24 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) {
25         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
26         CHECK(ordinal_meth != NULL);
27 }
28
29 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
30 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
31 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
32 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
33
34 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
35 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
36 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
37
38 typedef jlongArray int64_tArray;
39 typedef jbyteArray int8_tArray;
40 typedef jshortArray int16_tArray;
41
42 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
43         // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
44         char* conv_buf = MALLOC(len + 1, "str conv buf");
45         memcpy(conv_buf, chars, len);
46         conv_buf[len] = 0;
47         jstring ret = (*env)->NewStringUTF(env, conv_buf);
48         FREE(conv_buf);
49         return ret;
50 }
51 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
52         uint64_t str_len = (*env)->GetStringUTFLength(env, str);
53         char* newchars = MALLOC(str_len + 1, "String chars");
54         const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
55         memcpy(newchars, jchars, str_len);
56         newchars[str_len] = 0;
57         (*env)->ReleaseStringUTFChars(env, str, jchars);
58         LDKStr res = {
59                 .chars = newchars,
60                 .len = str_len,
61                 .chars_is_owned = true
62         };
63         return res;
64 }
65
66 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
67         return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
68 }
69 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
70         return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
71 }
72 #include "version.c"
73 static jclass arr_of_B_clz = NULL;
74 static jclass String_clz = NULL;
75 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
76         arr_of_B_clz = (*env)->FindClass(env, "[B");
77         CHECK(arr_of_B_clz != NULL);
78         arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
79         String_clz = (*env)->FindClass(env, "java/lang/String");
80         CHECK(String_clz != NULL);
81         String_clz = (*env)->NewGlobalRef(env, String_clz);
82 }
83 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
84
85 static inline void* untag_ptr(uint64_t ptr) {
86         if (ptr < 4096) return (void*)ptr;
87         if (sizeof(void*) == 4) {
88                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
89                 return (void*)(uintptr_t)ptr;
90         } else {
91                 // For 64-bit systems, assume the top byte is used for tagging, then
92                 // use bit 9 ^ bit 10.
93                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
94                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
95 #ifdef LDK_DEBUG_BUILD
96                 // On debug builds we also use the 11th bit as a debug flag
97                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
98                 CHECK(tenth_bit != eleventh_bit);
99                 p ^= 1ULL << 53;
100 #endif
101                 return (void*)p;
102         }
103 }
104 static inline bool ptr_is_owned(uint64_t ptr) {
105         if(ptr < 4096) return true;
106         if (sizeof(void*) == 4) {
107                 return ptr & (1ULL << 32);
108         } else {
109                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
110                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
111 #ifdef LDK_DEBUG_BUILD
112                 // On debug builds we also use the 11th bit as a debug flag
113                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
114                 CHECK(tenth_bit != eleventh_bit);
115 #endif
116                 return (ninth_bit ^ tenth_bit) ? true : false;
117         }
118 }
119 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
120         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
121         if (sizeof(void*) == 4) {
122                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
123         } else {
124                 CHECK(sizeof(uintptr_t) == 8);
125                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
126                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
127 #ifdef LDK_DEBUG_BUILD
128                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
129                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
130                 CHECK(ninth_bit == tenth_bit);
131                 CHECK(ninth_bit == eleventh_bit);
132                 t ^= 1ULL << 53;
133 #endif
134                 CHECK(ptr_is_owned(t) == is_owned);
135                 CHECK(untag_ptr(t) == ptr);
136                 return t;
137         }
138 }
139
140 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_java(JNIEnv *env, jclass clz) {
141         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
142         if (UNLIKELY((*env)->ExceptionCheck(env))) {
143                 (*env)->ExceptionDescribe(env);
144                 (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust threw an exception.");
145         }
146         switch (ord) {
147                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
148                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
149                 case 2: return LDKBolt11SemanticError_NoDescription;
150                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
151                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
152                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
153                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
154                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
155                 case 8: return LDKBolt11SemanticError_InvalidSignature;
156                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
157         }
158         (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust returned an invalid value.");
159         abort(); // Unreachable, but will let the compiler know we don't return here
160 }
161 static jclass Bolt11SemanticError_class = NULL;
162 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = NULL;
163 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = NULL;
164 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = NULL;
165 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = NULL;
166 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = NULL;
167 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = NULL;
168 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = NULL;
169 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = NULL;
170 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = NULL;
171 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = NULL;
172 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt11SemanticError_init (JNIEnv *env, jclass clz) {
173         Bolt11SemanticError_class = (*env)->NewGlobalRef(env, clz);
174         CHECK(Bolt11SemanticError_class != NULL);
175         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentHash", "Lorg/ldk/enums/Bolt11SemanticError;");
176         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash != NULL);
177         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/Bolt11SemanticError;");
178         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes != NULL);
179         Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoDescription", "Lorg/ldk/enums/Bolt11SemanticError;");
180         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoDescription != NULL);
181         Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultipleDescriptions", "Lorg/ldk/enums/Bolt11SemanticError;");
182         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions != NULL);
183         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentSecret", "Lorg/ldk/enums/Bolt11SemanticError;");
184         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret != NULL);
185         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/Bolt11SemanticError;");
186         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets != NULL);
187         Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidFeatures", "Lorg/ldk/enums/Bolt11SemanticError;");
188         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures != NULL);
189         Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidRecoveryId", "Lorg/ldk/enums/Bolt11SemanticError;");
190         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId != NULL);
191         Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidSignature", "Lorg/ldk/enums/Bolt11SemanticError;");
192         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature != NULL);
193         Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_ImpreciseAmount", "Lorg/ldk/enums/Bolt11SemanticError;");
194         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount != NULL);
195 }
196 static inline jclass LDKBolt11SemanticError_to_java(JNIEnv *env, LDKBolt11SemanticError val) {
197         switch (val) {
198                 case LDKBolt11SemanticError_NoPaymentHash:
199                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash);
200                 case LDKBolt11SemanticError_MultiplePaymentHashes:
201                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes);
202                 case LDKBolt11SemanticError_NoDescription:
203                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoDescription);
204                 case LDKBolt11SemanticError_MultipleDescriptions:
205                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions);
206                 case LDKBolt11SemanticError_NoPaymentSecret:
207                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret);
208                 case LDKBolt11SemanticError_MultiplePaymentSecrets:
209                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets);
210                 case LDKBolt11SemanticError_InvalidFeatures:
211                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures);
212                 case LDKBolt11SemanticError_InvalidRecoveryId:
213                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId);
214                 case LDKBolt11SemanticError_InvalidSignature:
215                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature);
216                 case LDKBolt11SemanticError_ImpreciseAmount:
217                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount);
218                 default: abort();
219         }
220 }
221
222 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *env, jclass clz) {
223         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
224         if (UNLIKELY((*env)->ExceptionCheck(env))) {
225                 (*env)->ExceptionDescribe(env);
226                 (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust threw an exception.");
227         }
228         switch (ord) {
229                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
230                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
231                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
232                 case 3: return LDKBolt12SemanticError_MissingAmount;
233                 case 4: return LDKBolt12SemanticError_InvalidAmount;
234                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
235                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
236                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
237                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
238                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
239                 case 10: return LDKBolt12SemanticError_MissingDescription;
240                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
241                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
242                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
243                 case 14: return LDKBolt12SemanticError_MissingQuantity;
244                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
245                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
246                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
247                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
248                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
249                 case 20: return LDKBolt12SemanticError_MissingPayerId;
250                 case 21: return LDKBolt12SemanticError_MissingPaths;
251                 case 22: return LDKBolt12SemanticError_InvalidPayInfo;
252                 case 23: return LDKBolt12SemanticError_MissingCreationTime;
253                 case 24: return LDKBolt12SemanticError_MissingPaymentHash;
254                 case 25: return LDKBolt12SemanticError_MissingSignature;
255         }
256         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
257         abort(); // Unreachable, but will let the compiler know we don't return here
258 }
259 static jclass Bolt12SemanticError_class = NULL;
260 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
261 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
262 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
263 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
264 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
265 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
266 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
267 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
268 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
269 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
270 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
271 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
272 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
273 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
274 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
275 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
276 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
277 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
278 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
279 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
280 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
281 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
282 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
283 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
284 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
285 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
286 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
287         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
288         CHECK(Bolt12SemanticError_class != NULL);
289         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
290         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
291         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
292         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
293         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
294         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
295         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
296         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
297         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
298         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
299         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
300         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
301         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
302         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
303         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
304         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
305         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
306         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
307         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
308         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
309         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
310         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
311         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
312         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
313         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
314         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
315         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
316         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
317         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
318         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
319         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
320         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
321         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
322         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
323         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
324         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
325         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
326         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
327         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
328         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
329         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
330         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
331         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
332         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
333         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
334         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
335         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
336         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
337         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
338         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
339         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
340         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
341 }
342 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
343         switch (val) {
344                 case LDKBolt12SemanticError_AlreadyExpired:
345                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
346                 case LDKBolt12SemanticError_UnsupportedChain:
347                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
348                 case LDKBolt12SemanticError_UnexpectedChain:
349                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
350                 case LDKBolt12SemanticError_MissingAmount:
351                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
352                 case LDKBolt12SemanticError_InvalidAmount:
353                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
354                 case LDKBolt12SemanticError_InsufficientAmount:
355                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
356                 case LDKBolt12SemanticError_UnexpectedAmount:
357                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
358                 case LDKBolt12SemanticError_UnsupportedCurrency:
359                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
360                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
361                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
362                 case LDKBolt12SemanticError_UnexpectedFeatures:
363                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
364                 case LDKBolt12SemanticError_MissingDescription:
365                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
366                 case LDKBolt12SemanticError_MissingSigningPubkey:
367                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
368                 case LDKBolt12SemanticError_InvalidSigningPubkey:
369                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
370                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
371                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
372                 case LDKBolt12SemanticError_MissingQuantity:
373                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
374                 case LDKBolt12SemanticError_InvalidQuantity:
375                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
376                 case LDKBolt12SemanticError_UnexpectedQuantity:
377                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
378                 case LDKBolt12SemanticError_InvalidMetadata:
379                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
380                 case LDKBolt12SemanticError_UnexpectedMetadata:
381                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
382                 case LDKBolt12SemanticError_MissingPayerMetadata:
383                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
384                 case LDKBolt12SemanticError_MissingPayerId:
385                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
386                 case LDKBolt12SemanticError_MissingPaths:
387                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
388                 case LDKBolt12SemanticError_InvalidPayInfo:
389                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
390                 case LDKBolt12SemanticError_MissingCreationTime:
391                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
392                 case LDKBolt12SemanticError_MissingPaymentHash:
393                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
394                 case LDKBolt12SemanticError_MissingSignature:
395                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
396                 default: abort();
397         }
398 }
399
400 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
401         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
402         if (UNLIKELY((*env)->ExceptionCheck(env))) {
403                 (*env)->ExceptionDescribe(env);
404                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
405         }
406         switch (ord) {
407                 case 0: return LDKCOption_NoneZ_Some;
408                 case 1: return LDKCOption_NoneZ_None;
409         }
410         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
411         abort(); // Unreachable, but will let the compiler know we don't return here
412 }
413 static jclass COption_NoneZ_class = NULL;
414 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
415 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
416 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
417         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
418         CHECK(COption_NoneZ_class != NULL);
419         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
420         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
421         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
422         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
423 }
424 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
425         switch (val) {
426                 case LDKCOption_NoneZ_Some:
427                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
428                 case LDKCOption_NoneZ_None:
429                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
430                 default: abort();
431         }
432 }
433
434 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
435         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
436         if (UNLIKELY((*env)->ExceptionCheck(env))) {
437                 (*env)->ExceptionDescribe(env);
438                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
439         }
440         switch (ord) {
441                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
442                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
443                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
444         }
445         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
446         abort(); // Unreachable, but will let the compiler know we don't return here
447 }
448 static jclass ChannelMonitorUpdateStatus_class = NULL;
449 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
450 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
451 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure = NULL;
452 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
453         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
454         CHECK(ChannelMonitorUpdateStatus_class != NULL);
455         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
456         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
457         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
458         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
459         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
460         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure != NULL);
461 }
462 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
463         switch (val) {
464                 case LDKChannelMonitorUpdateStatus_Completed:
465                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
466                 case LDKChannelMonitorUpdateStatus_InProgress:
467                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
468                 case LDKChannelMonitorUpdateStatus_PermanentFailure:
469                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure);
470                 default: abort();
471         }
472 }
473
474 static inline LDKChannelShutdownState LDKChannelShutdownState_from_java(JNIEnv *env, jclass clz) {
475         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
476         if (UNLIKELY((*env)->ExceptionCheck(env))) {
477                 (*env)->ExceptionDescribe(env);
478                 (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust threw an exception.");
479         }
480         switch (ord) {
481                 case 0: return LDKChannelShutdownState_NotShuttingDown;
482                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
483                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
484                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
485                 case 4: return LDKChannelShutdownState_ShutdownComplete;
486         }
487         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
488         abort(); // Unreachable, but will let the compiler know we don't return here
489 }
490 static jclass ChannelShutdownState_class = NULL;
491 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
492 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
493 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
494 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
495 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
496 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
497         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
498         CHECK(ChannelShutdownState_class != NULL);
499         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
500         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
501         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
502         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
503         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
504         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
505         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
506         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
507         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
508         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
509 }
510 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
511         switch (val) {
512                 case LDKChannelShutdownState_NotShuttingDown:
513                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
514                 case LDKChannelShutdownState_ShutdownInitiated:
515                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
516                 case LDKChannelShutdownState_ResolvingHTLCs:
517                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
518                 case LDKChannelShutdownState_NegotiatingClosingFee:
519                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
520                 case LDKChannelShutdownState_ShutdownComplete:
521                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
522                 default: abort();
523         }
524 }
525
526 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
527         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
528         if (UNLIKELY((*env)->ExceptionCheck(env))) {
529                 (*env)->ExceptionDescribe(env);
530                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
531         }
532         switch (ord) {
533                 case 0: return LDKConfirmationTarget_MempoolMinimum;
534                 case 1: return LDKConfirmationTarget_Background;
535                 case 2: return LDKConfirmationTarget_Normal;
536                 case 3: return LDKConfirmationTarget_HighPriority;
537         }
538         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
539         abort(); // Unreachable, but will let the compiler know we don't return here
540 }
541 static jclass ConfirmationTarget_class = NULL;
542 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = NULL;
543 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
544 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
545 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
546 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
547         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
548         CHECK(ConfirmationTarget_class != NULL);
549         ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MempoolMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
550         CHECK(ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum != NULL);
551         ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
552         CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
553         ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
554         CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
555         ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
556         CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
557 }
558 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
559         switch (val) {
560                 case LDKConfirmationTarget_MempoolMinimum:
561                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum);
562                 case LDKConfirmationTarget_Background:
563                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
564                 case LDKConfirmationTarget_Normal:
565                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
566                 case LDKConfirmationTarget_HighPriority:
567                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
568                 default: abort();
569         }
570 }
571
572 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
573         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
574         if (UNLIKELY((*env)->ExceptionCheck(env))) {
575                 (*env)->ExceptionDescribe(env);
576                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
577         }
578         switch (ord) {
579                 case 0: return LDKCreationError_DescriptionTooLong;
580                 case 1: return LDKCreationError_RouteTooLong;
581                 case 2: return LDKCreationError_TimestampOutOfBounds;
582                 case 3: return LDKCreationError_InvalidAmount;
583                 case 4: return LDKCreationError_MissingRouteHints;
584                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
585         }
586         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
587         abort(); // Unreachable, but will let the compiler know we don't return here
588 }
589 static jclass CreationError_class = NULL;
590 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
591 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
592 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
593 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
594 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
595 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
596 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
597         CreationError_class = (*env)->NewGlobalRef(env, clz);
598         CHECK(CreationError_class != NULL);
599         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
600         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
601         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
602         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
603         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
604         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
605         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
606         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
607         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
608         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
609         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
610         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
611 }
612 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
613         switch (val) {
614                 case LDKCreationError_DescriptionTooLong:
615                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
616                 case LDKCreationError_RouteTooLong:
617                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
618                 case LDKCreationError_TimestampOutOfBounds:
619                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
620                 case LDKCreationError_InvalidAmount:
621                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
622                 case LDKCreationError_MissingRouteHints:
623                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
624                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
625                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
626                 default: abort();
627         }
628 }
629
630 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
631         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
632         if (UNLIKELY((*env)->ExceptionCheck(env))) {
633                 (*env)->ExceptionDescribe(env);
634                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
635         }
636         switch (ord) {
637                 case 0: return LDKCurrency_Bitcoin;
638                 case 1: return LDKCurrency_BitcoinTestnet;
639                 case 2: return LDKCurrency_Regtest;
640                 case 3: return LDKCurrency_Simnet;
641                 case 4: return LDKCurrency_Signet;
642         }
643         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
644         abort(); // Unreachable, but will let the compiler know we don't return here
645 }
646 static jclass Currency_class = NULL;
647 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
648 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
649 static jfieldID Currency_LDKCurrency_Regtest = NULL;
650 static jfieldID Currency_LDKCurrency_Simnet = NULL;
651 static jfieldID Currency_LDKCurrency_Signet = NULL;
652 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
653         Currency_class = (*env)->NewGlobalRef(env, clz);
654         CHECK(Currency_class != NULL);
655         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
656         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
657         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
658         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
659         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
660         CHECK(Currency_LDKCurrency_Regtest != NULL);
661         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
662         CHECK(Currency_LDKCurrency_Simnet != NULL);
663         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
664         CHECK(Currency_LDKCurrency_Signet != NULL);
665 }
666 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
667         switch (val) {
668                 case LDKCurrency_Bitcoin:
669                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
670                 case LDKCurrency_BitcoinTestnet:
671                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
672                 case LDKCurrency_Regtest:
673                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
674                 case LDKCurrency_Simnet:
675                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
676                 case LDKCurrency_Signet:
677                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
678                 default: abort();
679         }
680 }
681
682 static inline LDKFailureCode LDKFailureCode_from_java(JNIEnv *env, jclass clz) {
683         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
684         if (UNLIKELY((*env)->ExceptionCheck(env))) {
685                 (*env)->ExceptionDescribe(env);
686                 (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust threw an exception.");
687         }
688         switch (ord) {
689                 case 0: return LDKFailureCode_TemporaryNodeFailure;
690                 case 1: return LDKFailureCode_RequiredNodeFeatureMissing;
691                 case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails;
692         }
693         (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust returned an invalid value.");
694         abort(); // Unreachable, but will let the compiler know we don't return here
695 }
696 static jclass FailureCode_class = NULL;
697 static jfieldID FailureCode_LDKFailureCode_TemporaryNodeFailure = NULL;
698 static jfieldID FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = NULL;
699 static jfieldID FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = NULL;
700 JNIEXPORT void JNICALL Java_org_ldk_enums_FailureCode_init (JNIEnv *env, jclass clz) {
701         FailureCode_class = (*env)->NewGlobalRef(env, clz);
702         CHECK(FailureCode_class != NULL);
703         FailureCode_LDKFailureCode_TemporaryNodeFailure = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_TemporaryNodeFailure", "Lorg/ldk/enums/FailureCode;");
704         CHECK(FailureCode_LDKFailureCode_TemporaryNodeFailure != NULL);
705         FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_RequiredNodeFeatureMissing", "Lorg/ldk/enums/FailureCode;");
706         CHECK(FailureCode_LDKFailureCode_RequiredNodeFeatureMissing != NULL);
707         FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_IncorrectOrUnknownPaymentDetails", "Lorg/ldk/enums/FailureCode;");
708         CHECK(FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails != NULL);
709 }
710 static inline jclass LDKFailureCode_to_java(JNIEnv *env, LDKFailureCode val) {
711         switch (val) {
712                 case LDKFailureCode_TemporaryNodeFailure:
713                         return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_TemporaryNodeFailure);
714                 case LDKFailureCode_RequiredNodeFeatureMissing:
715                         return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_RequiredNodeFeatureMissing);
716                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails:
717                         return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails);
718                 default: abort();
719         }
720 }
721
722 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
723         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
724         if (UNLIKELY((*env)->ExceptionCheck(env))) {
725                 (*env)->ExceptionDescribe(env);
726                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
727         }
728         switch (ord) {
729                 case 0: return LDKHTLCClaim_OfferedTimeout;
730                 case 1: return LDKHTLCClaim_OfferedPreimage;
731                 case 2: return LDKHTLCClaim_AcceptedTimeout;
732                 case 3: return LDKHTLCClaim_AcceptedPreimage;
733                 case 4: return LDKHTLCClaim_Revocation;
734         }
735         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
736         abort(); // Unreachable, but will let the compiler know we don't return here
737 }
738 static jclass HTLCClaim_class = NULL;
739 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
740 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
741 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
742 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
743 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
744 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
745         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
746         CHECK(HTLCClaim_class != NULL);
747         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
748         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
749         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
750         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
751         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
752         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
753         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
754         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
755         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
756         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
757 }
758 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
759         switch (val) {
760                 case LDKHTLCClaim_OfferedTimeout:
761                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
762                 case LDKHTLCClaim_OfferedPreimage:
763                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
764                 case LDKHTLCClaim_AcceptedTimeout:
765                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
766                 case LDKHTLCClaim_AcceptedPreimage:
767                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
768                 case LDKHTLCClaim_Revocation:
769                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
770                 default: abort();
771         }
772 }
773
774 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
775         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
776         if (UNLIKELY((*env)->ExceptionCheck(env))) {
777                 (*env)->ExceptionDescribe(env);
778                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
779         }
780         switch (ord) {
781                 case 0: return LDKIOError_NotFound;
782                 case 1: return LDKIOError_PermissionDenied;
783                 case 2: return LDKIOError_ConnectionRefused;
784                 case 3: return LDKIOError_ConnectionReset;
785                 case 4: return LDKIOError_ConnectionAborted;
786                 case 5: return LDKIOError_NotConnected;
787                 case 6: return LDKIOError_AddrInUse;
788                 case 7: return LDKIOError_AddrNotAvailable;
789                 case 8: return LDKIOError_BrokenPipe;
790                 case 9: return LDKIOError_AlreadyExists;
791                 case 10: return LDKIOError_WouldBlock;
792                 case 11: return LDKIOError_InvalidInput;
793                 case 12: return LDKIOError_InvalidData;
794                 case 13: return LDKIOError_TimedOut;
795                 case 14: return LDKIOError_WriteZero;
796                 case 15: return LDKIOError_Interrupted;
797                 case 16: return LDKIOError_Other;
798                 case 17: return LDKIOError_UnexpectedEof;
799         }
800         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
801         abort(); // Unreachable, but will let the compiler know we don't return here
802 }
803 static jclass IOError_class = NULL;
804 static jfieldID IOError_LDKIOError_NotFound = NULL;
805 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
806 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
807 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
808 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
809 static jfieldID IOError_LDKIOError_NotConnected = NULL;
810 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
811 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
812 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
813 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
814 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
815 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
816 static jfieldID IOError_LDKIOError_InvalidData = NULL;
817 static jfieldID IOError_LDKIOError_TimedOut = NULL;
818 static jfieldID IOError_LDKIOError_WriteZero = NULL;
819 static jfieldID IOError_LDKIOError_Interrupted = NULL;
820 static jfieldID IOError_LDKIOError_Other = NULL;
821 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
822 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
823         IOError_class = (*env)->NewGlobalRef(env, clz);
824         CHECK(IOError_class != NULL);
825         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
826         CHECK(IOError_LDKIOError_NotFound != NULL);
827         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
828         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
829         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
830         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
831         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
832         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
833         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
834         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
835         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
836         CHECK(IOError_LDKIOError_NotConnected != NULL);
837         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
838         CHECK(IOError_LDKIOError_AddrInUse != NULL);
839         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
840         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
841         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
842         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
843         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
844         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
845         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
846         CHECK(IOError_LDKIOError_WouldBlock != NULL);
847         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
848         CHECK(IOError_LDKIOError_InvalidInput != NULL);
849         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
850         CHECK(IOError_LDKIOError_InvalidData != NULL);
851         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
852         CHECK(IOError_LDKIOError_TimedOut != NULL);
853         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
854         CHECK(IOError_LDKIOError_WriteZero != NULL);
855         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
856         CHECK(IOError_LDKIOError_Interrupted != NULL);
857         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
858         CHECK(IOError_LDKIOError_Other != NULL);
859         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
860         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
861 }
862 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
863         switch (val) {
864                 case LDKIOError_NotFound:
865                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
866                 case LDKIOError_PermissionDenied:
867                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
868                 case LDKIOError_ConnectionRefused:
869                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
870                 case LDKIOError_ConnectionReset:
871                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
872                 case LDKIOError_ConnectionAborted:
873                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
874                 case LDKIOError_NotConnected:
875                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
876                 case LDKIOError_AddrInUse:
877                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
878                 case LDKIOError_AddrNotAvailable:
879                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
880                 case LDKIOError_BrokenPipe:
881                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
882                 case LDKIOError_AlreadyExists:
883                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
884                 case LDKIOError_WouldBlock:
885                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
886                 case LDKIOError_InvalidInput:
887                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
888                 case LDKIOError_InvalidData:
889                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
890                 case LDKIOError_TimedOut:
891                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
892                 case LDKIOError_WriteZero:
893                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
894                 case LDKIOError_Interrupted:
895                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
896                 case LDKIOError_Other:
897                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
898                 case LDKIOError_UnexpectedEof:
899                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
900                 default: abort();
901         }
902 }
903
904 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
905         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
906         if (UNLIKELY((*env)->ExceptionCheck(env))) {
907                 (*env)->ExceptionDescribe(env);
908                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
909         }
910         switch (ord) {
911                 case 0: return LDKLevel_Gossip;
912                 case 1: return LDKLevel_Trace;
913                 case 2: return LDKLevel_Debug;
914                 case 3: return LDKLevel_Info;
915                 case 4: return LDKLevel_Warn;
916                 case 5: return LDKLevel_Error;
917         }
918         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
919         abort(); // Unreachable, but will let the compiler know we don't return here
920 }
921 static jclass Level_class = NULL;
922 static jfieldID Level_LDKLevel_Gossip = NULL;
923 static jfieldID Level_LDKLevel_Trace = NULL;
924 static jfieldID Level_LDKLevel_Debug = NULL;
925 static jfieldID Level_LDKLevel_Info = NULL;
926 static jfieldID Level_LDKLevel_Warn = NULL;
927 static jfieldID Level_LDKLevel_Error = NULL;
928 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
929         Level_class = (*env)->NewGlobalRef(env, clz);
930         CHECK(Level_class != NULL);
931         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
932         CHECK(Level_LDKLevel_Gossip != NULL);
933         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
934         CHECK(Level_LDKLevel_Trace != NULL);
935         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
936         CHECK(Level_LDKLevel_Debug != NULL);
937         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
938         CHECK(Level_LDKLevel_Info != NULL);
939         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
940         CHECK(Level_LDKLevel_Warn != NULL);
941         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
942         CHECK(Level_LDKLevel_Error != NULL);
943 }
944 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
945         switch (val) {
946                 case LDKLevel_Gossip:
947                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
948                 case LDKLevel_Trace:
949                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
950                 case LDKLevel_Debug:
951                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
952                 case LDKLevel_Info:
953                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
954                 case LDKLevel_Warn:
955                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
956                 case LDKLevel_Error:
957                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
958                 default: abort();
959         }
960 }
961
962 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
963         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
964         if (UNLIKELY((*env)->ExceptionCheck(env))) {
965                 (*env)->ExceptionDescribe(env);
966                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
967         }
968         switch (ord) {
969                 case 0: return LDKNetwork_Bitcoin;
970                 case 1: return LDKNetwork_Testnet;
971                 case 2: return LDKNetwork_Regtest;
972                 case 3: return LDKNetwork_Signet;
973         }
974         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
975         abort(); // Unreachable, but will let the compiler know we don't return here
976 }
977 static jclass Network_class = NULL;
978 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
979 static jfieldID Network_LDKNetwork_Testnet = NULL;
980 static jfieldID Network_LDKNetwork_Regtest = NULL;
981 static jfieldID Network_LDKNetwork_Signet = NULL;
982 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
983         Network_class = (*env)->NewGlobalRef(env, clz);
984         CHECK(Network_class != NULL);
985         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
986         CHECK(Network_LDKNetwork_Bitcoin != NULL);
987         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
988         CHECK(Network_LDKNetwork_Testnet != NULL);
989         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
990         CHECK(Network_LDKNetwork_Regtest != NULL);
991         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
992         CHECK(Network_LDKNetwork_Signet != NULL);
993 }
994 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
995         switch (val) {
996                 case LDKNetwork_Bitcoin:
997                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
998                 case LDKNetwork_Testnet:
999                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1000                 case LDKNetwork_Regtest:
1001                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1002                 case LDKNetwork_Signet:
1003                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1004                 default: abort();
1005         }
1006 }
1007
1008 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1009         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1010         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1011                 (*env)->ExceptionDescribe(env);
1012                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1013         }
1014         switch (ord) {
1015                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1016                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1017                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1018                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1019                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1020                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1021         }
1022         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1023         abort(); // Unreachable, but will let the compiler know we don't return here
1024 }
1025 static jclass PaymentFailureReason_class = NULL;
1026 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1027 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1028 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1029 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1030 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1031 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1032 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1033         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1034         CHECK(PaymentFailureReason_class != NULL);
1035         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1036         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1037         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1038         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1039         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1040         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1041         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1042         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1043         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1044         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1045         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1046         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1047 }
1048 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1049         switch (val) {
1050                 case LDKPaymentFailureReason_RecipientRejected:
1051                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1052                 case LDKPaymentFailureReason_UserAbandoned:
1053                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1054                 case LDKPaymentFailureReason_RetriesExhausted:
1055                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1056                 case LDKPaymentFailureReason_PaymentExpired:
1057                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1058                 case LDKPaymentFailureReason_RouteNotFound:
1059                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1060                 case LDKPaymentFailureReason_UnexpectedError:
1061                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1062                 default: abort();
1063         }
1064 }
1065
1066 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1067         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1068         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1069                 (*env)->ExceptionDescribe(env);
1070                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1071         }
1072         switch (ord) {
1073                 case 0: return LDKRecipient_Node;
1074                 case 1: return LDKRecipient_PhantomNode;
1075         }
1076         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1077         abort(); // Unreachable, but will let the compiler know we don't return here
1078 }
1079 static jclass Recipient_class = NULL;
1080 static jfieldID Recipient_LDKRecipient_Node = NULL;
1081 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1082 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1083         Recipient_class = (*env)->NewGlobalRef(env, clz);
1084         CHECK(Recipient_class != NULL);
1085         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1086         CHECK(Recipient_LDKRecipient_Node != NULL);
1087         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1088         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1089 }
1090 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1091         switch (val) {
1092                 case LDKRecipient_Node:
1093                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1094                 case LDKRecipient_PhantomNode:
1095                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1096                 default: abort();
1097         }
1098 }
1099
1100 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1101         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1102         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1103                 (*env)->ExceptionDescribe(env);
1104                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1105         }
1106         switch (ord) {
1107                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1108                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1109                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1110         }
1111         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1112         abort(); // Unreachable, but will let the compiler know we don't return here
1113 }
1114 static jclass RetryableSendFailure_class = NULL;
1115 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1116 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1117 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1118 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1119         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1120         CHECK(RetryableSendFailure_class != NULL);
1121         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1122         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1123         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1124         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1125         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1126         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1127 }
1128 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1129         switch (val) {
1130                 case LDKRetryableSendFailure_PaymentExpired:
1131                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1132                 case LDKRetryableSendFailure_RouteNotFound:
1133                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1134                 case LDKRetryableSendFailure_DuplicatePayment:
1135                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1136                 default: abort();
1137         }
1138 }
1139
1140 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1141         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1142         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1143                 (*env)->ExceptionDescribe(env);
1144                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1145         }
1146         switch (ord) {
1147                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1148                 case 1: return LDKSecp256k1Error_InvalidMessage;
1149                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1150                 case 3: return LDKSecp256k1Error_InvalidSignature;
1151                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1152                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1153                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1154                 case 7: return LDKSecp256k1Error_InvalidTweak;
1155                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1156                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1157                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1158         }
1159         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1160         abort(); // Unreachable, but will let the compiler know we don't return here
1161 }
1162 static jclass Secp256k1Error_class = NULL;
1163 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1164 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1165 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1166 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1167 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1168 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1169 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1170 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1171 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1172 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1173 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1174 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1175         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1176         CHECK(Secp256k1Error_class != NULL);
1177         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1178         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1179         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1180         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1181         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1182         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1183         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1184         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1185         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1186         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1187         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1188         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1189         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1190         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1191         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1192         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1193         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1194         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1195         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1196         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1197         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1198         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1199 }
1200 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1201         switch (val) {
1202                 case LDKSecp256k1Error_IncorrectSignature:
1203                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1204                 case LDKSecp256k1Error_InvalidMessage:
1205                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1206                 case LDKSecp256k1Error_InvalidPublicKey:
1207                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1208                 case LDKSecp256k1Error_InvalidSignature:
1209                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1210                 case LDKSecp256k1Error_InvalidSecretKey:
1211                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1212                 case LDKSecp256k1Error_InvalidSharedSecret:
1213                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1214                 case LDKSecp256k1Error_InvalidRecoveryId:
1215                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1216                 case LDKSecp256k1Error_InvalidTweak:
1217                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1218                 case LDKSecp256k1Error_NotEnoughMemory:
1219                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1220                 case LDKSecp256k1Error_InvalidPublicKeySum:
1221                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1222                 case LDKSecp256k1Error_InvalidParityValue:
1223                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1224                 default: abort();
1225         }
1226 }
1227
1228 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1229         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1230         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1231                 (*env)->ExceptionDescribe(env);
1232                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1233         }
1234         switch (ord) {
1235                 case 0: return LDKSiPrefix_Milli;
1236                 case 1: return LDKSiPrefix_Micro;
1237                 case 2: return LDKSiPrefix_Nano;
1238                 case 3: return LDKSiPrefix_Pico;
1239         }
1240         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1241         abort(); // Unreachable, but will let the compiler know we don't return here
1242 }
1243 static jclass SiPrefix_class = NULL;
1244 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1245 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1246 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1247 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1248 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1249         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1250         CHECK(SiPrefix_class != NULL);
1251         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1252         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1253         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1254         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1255         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1256         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1257         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1258         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1259 }
1260 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1261         switch (val) {
1262                 case LDKSiPrefix_Milli:
1263                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1264                 case LDKSiPrefix_Micro:
1265                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1266                 case LDKSiPrefix_Nano:
1267                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1268                 case LDKSiPrefix_Pico:
1269                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1270                 default: abort();
1271         }
1272 }
1273
1274 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1275         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1276         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1277                 (*env)->ExceptionDescribe(env);
1278                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1279         }
1280         switch (ord) {
1281                 case 0: return LDKUtxoLookupError_UnknownChain;
1282                 case 1: return LDKUtxoLookupError_UnknownTx;
1283         }
1284         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1285         abort(); // Unreachable, but will let the compiler know we don't return here
1286 }
1287 static jclass UtxoLookupError_class = NULL;
1288 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1289 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1290 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1291         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1292         CHECK(UtxoLookupError_class != NULL);
1293         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1294         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1295         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1296         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1297 }
1298 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1299         switch (val) {
1300                 case LDKUtxoLookupError_UnknownChain:
1301                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1302                 case LDKUtxoLookupError_UnknownTx:
1303                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1304                 default: abort();
1305         }
1306 }
1307
1308 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1309         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1310         return ret;
1311 }
1312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1313         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1314         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1315         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1316         return ret_arr;
1317 }
1318
1319 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1321         if (!ptr_is_owned(thing)) return;
1322         void* thing_ptr = untag_ptr(thing);
1323         CHECK_ACCESS(thing_ptr);
1324         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1325         FREE(untag_ptr(thing));
1326         BigEndianScalar_free(thing_conv);
1327 }
1328
1329 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1330 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1331 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1332 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1333 static jclass LDKBech32Error_InvalidLength_class = NULL;
1334 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1335 static jclass LDKBech32Error_InvalidChar_class = NULL;
1336 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1337 static jclass LDKBech32Error_InvalidData_class = NULL;
1338 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1339 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1340 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1341 static jclass LDKBech32Error_MixedCase_class = NULL;
1342 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1344         LDKBech32Error_MissingSeparator_class =
1345                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1346         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1347         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1348         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1349         LDKBech32Error_InvalidChecksum_class =
1350                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1351         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1352         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1353         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1354         LDKBech32Error_InvalidLength_class =
1355                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1356         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1357         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1358         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1359         LDKBech32Error_InvalidChar_class =
1360                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1361         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1362         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1363         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1364         LDKBech32Error_InvalidData_class =
1365                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1366         CHECK(LDKBech32Error_InvalidData_class != NULL);
1367         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1368         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1369         LDKBech32Error_InvalidPadding_class =
1370                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1371         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1372         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1373         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1374         LDKBech32Error_MixedCase_class =
1375                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1376         CHECK(LDKBech32Error_MixedCase_class != NULL);
1377         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1378         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1379 }
1380 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1381         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1382         switch(obj->tag) {
1383                 case LDKBech32Error_MissingSeparator: {
1384                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1385                 }
1386                 case LDKBech32Error_InvalidChecksum: {
1387                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1388                 }
1389                 case LDKBech32Error_InvalidLength: {
1390                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1391                 }
1392                 case LDKBech32Error_InvalidChar: {
1393                         int32_t invalid_char_conv = obj->invalid_char;
1394                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1395                 }
1396                 case LDKBech32Error_InvalidData: {
1397                         int8_t invalid_data_conv = obj->invalid_data;
1398                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1399                 }
1400                 case LDKBech32Error_InvalidPadding: {
1401                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1402                 }
1403                 case LDKBech32Error_MixedCase: {
1404                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1405                 }
1406                 default: abort();
1407         }
1408 }
1409 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1410         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1411         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1412         return ret;
1413 }
1414 struct LDKWitness TxIn_get_witness (struct LDKTxIn* thing) {    return Witness_clone(&thing->witness);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1witness(JNIEnv *env, jclass clz, int64_t thing) {
1415         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1416         LDKWitness ret_var = TxIn_get_witness(thing_conv);
1417         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1418         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1419         Witness_free(ret_var);
1420         return ret_arr;
1421 }
1422
1423 struct LDKCVec_u8Z TxIn_get_script_sig (struct LDKTxIn* thing) {        return CVec_u8Z_clone(&thing->script_sig);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1script_1sig(JNIEnv *env, jclass clz, int64_t thing) {
1424         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1425         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
1426         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1427         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1428         CVec_u8Z_free(ret_var);
1429         return ret_arr;
1430 }
1431
1432 LDKThirtyTwoBytes TxIn_get_previous_txid (struct LDKTxIn* thing) {      return thing->previous_txid;}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1txid(JNIEnv *env, jclass clz, int64_t thing) {
1433         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1434         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1435         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(thing_conv).data);
1436         return ret_arr;
1437 }
1438
1439 uint32_t TxIn_get_previous_vout (struct LDKTxIn* thing) {       return thing->previous_vout;}JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1vout(JNIEnv *env, jclass clz, int64_t thing) {
1440         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1441         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
1442         return ret_conv;
1443 }
1444
1445 uint32_t TxIn_get_sequence (struct LDKTxIn* thing) {    return thing->sequence;}JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1sequence(JNIEnv *env, jclass clz, int64_t thing) {
1446         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1447         int32_t ret_conv = TxIn_get_sequence(thing_conv);
1448         return ret_conv;
1449 }
1450
1451 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) {   return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
1452         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1453         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1454         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1455         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1456         CVec_u8Z_free(ret_var);
1457         return ret_arr;
1458 }
1459
1460 uint64_t TxOut_get_value (struct LDKTxOut* thing) {     return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
1461         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1462         int64_t ret_conv = TxOut_get_value(thing_conv);
1463         return ret_conv;
1464 }
1465
1466 static jclass LDKCOption_DurationZ_Some_class = NULL;
1467 static jmethodID LDKCOption_DurationZ_Some_meth = NULL;
1468 static jclass LDKCOption_DurationZ_None_class = NULL;
1469 static jmethodID LDKCOption_DurationZ_None_meth = NULL;
1470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1DurationZ_init (JNIEnv *env, jclass clz) {
1471         LDKCOption_DurationZ_Some_class =
1472                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_DurationZ$Some"));
1473         CHECK(LDKCOption_DurationZ_Some_class != NULL);
1474         LDKCOption_DurationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_DurationZ_Some_class, "<init>", "(J)V");
1475         CHECK(LDKCOption_DurationZ_Some_meth != NULL);
1476         LDKCOption_DurationZ_None_class =
1477                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_DurationZ$None"));
1478         CHECK(LDKCOption_DurationZ_None_class != NULL);
1479         LDKCOption_DurationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_DurationZ_None_class, "<init>", "()V");
1480         CHECK(LDKCOption_DurationZ_None_meth != NULL);
1481 }
1482 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1DurationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1483         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
1484         switch(obj->tag) {
1485                 case LDKCOption_DurationZ_Some: {
1486                         int64_t some_conv = obj->some;
1487                         return (*env)->NewObject(env, LDKCOption_DurationZ_Some_class, LDKCOption_DurationZ_Some_meth, some_conv);
1488                 }
1489                 case LDKCOption_DurationZ_None: {
1490                         return (*env)->NewObject(env, LDKCOption_DurationZ_None_class, LDKCOption_DurationZ_None_meth);
1491                 }
1492                 default: abort();
1493         }
1494 }
1495 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1496         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1497         for (size_t i = 0; i < ret.datalen; i++) {
1498                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1499         }
1500         return ret;
1501 }
1502 static jclass LDKCOption_u64Z_Some_class = NULL;
1503 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1504 static jclass LDKCOption_u64Z_None_class = NULL;
1505 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1507         LDKCOption_u64Z_Some_class =
1508                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1509         CHECK(LDKCOption_u64Z_Some_class != NULL);
1510         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1511         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1512         LDKCOption_u64Z_None_class =
1513                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1514         CHECK(LDKCOption_u64Z_None_class != NULL);
1515         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1516         CHECK(LDKCOption_u64Z_None_meth != NULL);
1517 }
1518 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1519         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1520         switch(obj->tag) {
1521                 case LDKCOption_u64Z_Some: {
1522                         int64_t some_conv = obj->some;
1523                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1524                 }
1525                 case LDKCOption_u64Z_None: {
1526                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1527                 }
1528                 default: abort();
1529         }
1530 }
1531 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1532         LDKRefund ret = *owner->contents.result;
1533         ret.is_owned = false;
1534         return ret;
1535 }
1536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1537         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1538         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1539         int64_t ret_ref = 0;
1540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1542         return ret_ref;
1543 }
1544
1545 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1546         LDKBolt12ParseError ret = *owner->contents.err;
1547         ret.is_owned = false;
1548         return ret;
1549 }
1550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1551         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1552         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1553         int64_t ret_ref = 0;
1554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1556         return ret_ref;
1557 }
1558
1559 static jclass LDKAPIError_APIMisuseError_class = NULL;
1560 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1561 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1562 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1563 static jclass LDKAPIError_InvalidRoute_class = NULL;
1564 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1565 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1566 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1567 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1568 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1569 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1570 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1572         LDKAPIError_APIMisuseError_class =
1573                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1574         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1575         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1576         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1577         LDKAPIError_FeeRateTooHigh_class =
1578                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1579         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1580         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1581         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1582         LDKAPIError_InvalidRoute_class =
1583                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1584         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1585         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1586         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1587         LDKAPIError_ChannelUnavailable_class =
1588                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1589         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1590         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1591         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1592         LDKAPIError_MonitorUpdateInProgress_class =
1593                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1594         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1595         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1596         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1597         LDKAPIError_IncompatibleShutdownScript_class =
1598                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1599         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1600         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1601         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1602 }
1603 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1604         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1605         switch(obj->tag) {
1606                 case LDKAPIError_APIMisuseError: {
1607                         LDKStr err_str = obj->api_misuse_error.err;
1608                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1609                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1610                 }
1611                 case LDKAPIError_FeeRateTooHigh: {
1612                         LDKStr err_str = obj->fee_rate_too_high.err;
1613                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1614                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1615                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1616                 }
1617                 case LDKAPIError_InvalidRoute: {
1618                         LDKStr err_str = obj->invalid_route.err;
1619                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1620                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1621                 }
1622                 case LDKAPIError_ChannelUnavailable: {
1623                         LDKStr err_str = obj->channel_unavailable.err;
1624                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1625                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1626                 }
1627                 case LDKAPIError_MonitorUpdateInProgress: {
1628                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1629                 }
1630                 case LDKAPIError_IncompatibleShutdownScript: {
1631                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1632                         int64_t script_ref = 0;
1633                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1634                         script_ref = tag_ptr(script_var.inner, false);
1635                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
1636                 }
1637                 default: abort();
1638         }
1639 }
1640 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1641 CHECK(owner->result_ok);
1642         return *owner->contents.result;
1643 }
1644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1645         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1646         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1647 }
1648
1649 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1650 CHECK(!owner->result_ok);
1651         return APIError_clone(&*owner->contents.err);
1652 }
1653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1654         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1655         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1656         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1657         int64_t ret_ref = tag_ptr(ret_copy, true);
1658         return ret_ref;
1659 }
1660
1661 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1662         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1663         for (size_t i = 0; i < ret.datalen; i++) {
1664                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1665         }
1666         return ret;
1667 }
1668 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1669         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1670         for (size_t i = 0; i < ret.datalen; i++) {
1671                 ret.data[i] = APIError_clone(&orig->data[i]);
1672         }
1673         return ret;
1674 }
1675 static jclass LDKCOption_PaymentSecretZ_Some_class = NULL;
1676 static jmethodID LDKCOption_PaymentSecretZ_Some_meth = NULL;
1677 static jclass LDKCOption_PaymentSecretZ_None_class = NULL;
1678 static jmethodID LDKCOption_PaymentSecretZ_None_meth = NULL;
1679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentSecretZ_init (JNIEnv *env, jclass clz) {
1680         LDKCOption_PaymentSecretZ_Some_class =
1681                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentSecretZ$Some"));
1682         CHECK(LDKCOption_PaymentSecretZ_Some_class != NULL);
1683         LDKCOption_PaymentSecretZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentSecretZ_Some_class, "<init>", "([B)V");
1684         CHECK(LDKCOption_PaymentSecretZ_Some_meth != NULL);
1685         LDKCOption_PaymentSecretZ_None_class =
1686                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentSecretZ$None"));
1687         CHECK(LDKCOption_PaymentSecretZ_None_class != NULL);
1688         LDKCOption_PaymentSecretZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentSecretZ_None_class, "<init>", "()V");
1689         CHECK(LDKCOption_PaymentSecretZ_None_meth != NULL);
1690 }
1691 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentSecretZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1692         LDKCOption_PaymentSecretZ *obj = (LDKCOption_PaymentSecretZ*)untag_ptr(ptr);
1693         switch(obj->tag) {
1694                 case LDKCOption_PaymentSecretZ_Some: {
1695                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
1696                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
1697                         return (*env)->NewObject(env, LDKCOption_PaymentSecretZ_Some_class, LDKCOption_PaymentSecretZ_Some_meth, some_arr);
1698                 }
1699                 case LDKCOption_PaymentSecretZ_None: {
1700                         return (*env)->NewObject(env, LDKCOption_PaymentSecretZ_None_class, LDKCOption_PaymentSecretZ_None_meth);
1701                 }
1702                 default: abort();
1703         }
1704 }
1705 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
1706 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
1707 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
1708 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
1709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
1710         LDKCOption_CVec_u8ZZ_Some_class =
1711                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
1712         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
1713         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
1714         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
1715         LDKCOption_CVec_u8ZZ_None_class =
1716                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
1717         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
1718         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
1719         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
1720 }
1721 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1722         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1723         switch(obj->tag) {
1724                 case LDKCOption_CVec_u8ZZ_Some: {
1725                         LDKCVec_u8Z some_var = obj->some;
1726                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
1727                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
1728                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
1729                 }
1730                 case LDKCOption_CVec_u8ZZ_None: {
1731                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
1732                 }
1733                 default: abort();
1734         }
1735 }
1736 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1737 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1738 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1739 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1740 static jclass LDKDecodeError_InvalidValue_class = NULL;
1741 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1742 static jclass LDKDecodeError_ShortRead_class = NULL;
1743 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1744 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1745 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1746 static jclass LDKDecodeError_Io_class = NULL;
1747 static jmethodID LDKDecodeError_Io_meth = NULL;
1748 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1749 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1751         LDKDecodeError_UnknownVersion_class =
1752                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1753         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1754         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1755         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1756         LDKDecodeError_UnknownRequiredFeature_class =
1757                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1758         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1759         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1760         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1761         LDKDecodeError_InvalidValue_class =
1762                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1763         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1764         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1765         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1766         LDKDecodeError_ShortRead_class =
1767                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1768         CHECK(LDKDecodeError_ShortRead_class != NULL);
1769         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1770         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1771         LDKDecodeError_BadLengthDescriptor_class =
1772                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1773         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1774         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1775         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1776         LDKDecodeError_Io_class =
1777                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1778         CHECK(LDKDecodeError_Io_class != NULL);
1779         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1780         CHECK(LDKDecodeError_Io_meth != NULL);
1781         LDKDecodeError_UnsupportedCompression_class =
1782                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1783         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1784         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1785         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1786 }
1787 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1788         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1789         switch(obj->tag) {
1790                 case LDKDecodeError_UnknownVersion: {
1791                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1792                 }
1793                 case LDKDecodeError_UnknownRequiredFeature: {
1794                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1795                 }
1796                 case LDKDecodeError_InvalidValue: {
1797                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1798                 }
1799                 case LDKDecodeError_ShortRead: {
1800                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1801                 }
1802                 case LDKDecodeError_BadLengthDescriptor: {
1803                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1804                 }
1805                 case LDKDecodeError_Io: {
1806                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1807                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1808                 }
1809                 case LDKDecodeError_UnsupportedCompression: {
1810                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1811                 }
1812                 default: abort();
1813         }
1814 }
1815 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1816         LDKRecipientOnionFields ret = *owner->contents.result;
1817         ret.is_owned = false;
1818         return ret;
1819 }
1820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1821         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1822         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1823         int64_t ret_ref = 0;
1824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1826         return ret_ref;
1827 }
1828
1829 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1830 CHECK(!owner->result_ok);
1831         return DecodeError_clone(&*owner->contents.err);
1832 }
1833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1834         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1835         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1836         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1837         int64_t ret_ref = tag_ptr(ret_copy, true);
1838         return ret_ref;
1839 }
1840
1841 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1842         LDKBlindedPayInfo ret = *owner->contents.result;
1843         ret.is_owned = false;
1844         return ret;
1845 }
1846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1847         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1848         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1849         int64_t ret_ref = 0;
1850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1852         return ret_ref;
1853 }
1854
1855 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1856 CHECK(!owner->result_ok);
1857         return DecodeError_clone(&*owner->contents.err);
1858 }
1859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1860         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1861         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1862         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1863         int64_t ret_ref = tag_ptr(ret_copy, true);
1864         return ret_ref;
1865 }
1866
1867 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1868         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1869         ret.is_owned = false;
1870         return ret;
1871 }
1872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1873         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1874         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1875         int64_t ret_ref = 0;
1876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1878         return ret_ref;
1879 }
1880
1881 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1882 CHECK(!owner->result_ok);
1883         return DecodeError_clone(&*owner->contents.err);
1884 }
1885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1886         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1887         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1888         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1889         int64_t ret_ref = tag_ptr(ret_copy, true);
1890         return ret_ref;
1891 }
1892
1893 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1894         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1895         ret.is_owned = false;
1896         return ret;
1897 }
1898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1899         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1900         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1901         int64_t ret_ref = 0;
1902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1904         return ret_ref;
1905 }
1906
1907 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1908 CHECK(!owner->result_ok);
1909         return DecodeError_clone(&*owner->contents.err);
1910 }
1911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1912         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1913         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1914         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1915         int64_t ret_ref = tag_ptr(ret_copy, true);
1916         return ret_ref;
1917 }
1918
1919 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1920 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1921 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1922 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1923 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1924 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1926         LDKSpendableOutputDescriptor_StaticOutput_class =
1927                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
1928         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1929         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1930         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1931         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1932                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
1933         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1934         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1935         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1936         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1937                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
1938         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1939         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1940         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1941 }
1942 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1943         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1944         switch(obj->tag) {
1945                 case LDKSpendableOutputDescriptor_StaticOutput: {
1946                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1947                         int64_t outpoint_ref = 0;
1948                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1949                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1950                         LDKTxOut* output_ref = &obj->static_output.output;
1951                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
1952                 }
1953                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1954                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1955                         int64_t delayed_payment_output_ref = 0;
1956                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1957                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1958                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1959                 }
1960                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1961                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1962                         int64_t static_payment_output_ref = 0;
1963                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1964                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1965                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1966                 }
1967                 default: abort();
1968         }
1969 }
1970 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1971 CHECK(owner->result_ok);
1972         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1973 }
1974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1975         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1976         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1977         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1978         int64_t ret_ref = tag_ptr(ret_copy, true);
1979         return ret_ref;
1980 }
1981
1982 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1983 CHECK(!owner->result_ok);
1984         return DecodeError_clone(&*owner->contents.err);
1985 }
1986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1987         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1988         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1989         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1990         int64_t ret_ref = tag_ptr(ret_copy, true);
1991         return ret_ref;
1992 }
1993
1994 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1995         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1996         for (size_t i = 0; i < ret.datalen; i++) {
1997                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1998         }
1999         return ret;
2000 }
2001 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2002         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2003         for (size_t i = 0; i < ret.datalen; i++) {
2004                 ret.data[i] = TxOut_clone(&orig->data[i]);
2005         }
2006         return ret;
2007 }
2008 static jclass LDKCOption_PackedLockTimeZ_Some_class = NULL;
2009 static jmethodID LDKCOption_PackedLockTimeZ_Some_meth = NULL;
2010 static jclass LDKCOption_PackedLockTimeZ_None_class = NULL;
2011 static jmethodID LDKCOption_PackedLockTimeZ_None_meth = NULL;
2012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PackedLockTimeZ_init (JNIEnv *env, jclass clz) {
2013         LDKCOption_PackedLockTimeZ_Some_class =
2014                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PackedLockTimeZ$Some"));
2015         CHECK(LDKCOption_PackedLockTimeZ_Some_class != NULL);
2016         LDKCOption_PackedLockTimeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PackedLockTimeZ_Some_class, "<init>", "(I)V");
2017         CHECK(LDKCOption_PackedLockTimeZ_Some_meth != NULL);
2018         LDKCOption_PackedLockTimeZ_None_class =
2019                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PackedLockTimeZ$None"));
2020         CHECK(LDKCOption_PackedLockTimeZ_None_class != NULL);
2021         LDKCOption_PackedLockTimeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PackedLockTimeZ_None_class, "<init>", "()V");
2022         CHECK(LDKCOption_PackedLockTimeZ_None_meth != NULL);
2023 }
2024 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PackedLockTimeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2025         LDKCOption_PackedLockTimeZ *obj = (LDKCOption_PackedLockTimeZ*)untag_ptr(ptr);
2026         switch(obj->tag) {
2027                 case LDKCOption_PackedLockTimeZ_Some: {
2028                         int32_t some_conv = obj->some;
2029                         return (*env)->NewObject(env, LDKCOption_PackedLockTimeZ_Some_class, LDKCOption_PackedLockTimeZ_Some_meth, some_conv);
2030                 }
2031                 case LDKCOption_PackedLockTimeZ_None: {
2032                         return (*env)->NewObject(env, LDKCOption_PackedLockTimeZ_None_class, LDKCOption_PackedLockTimeZ_None_meth);
2033                 }
2034                 default: abort();
2035         }
2036 }
2037 static inline struct LDKCVec_u8Z C2Tuple_PartiallySignedTransactionusizeZ_get_a(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR owner){
2038         return CVec_u8Z_clone(&owner->a);
2039 }
2040 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2041         LDKC2Tuple_PartiallySignedTransactionusizeZ* owner_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(owner);
2042         LDKCVec_u8Z ret_var = C2Tuple_PartiallySignedTransactionusizeZ_get_a(owner_conv);
2043         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2044         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2045         CVec_u8Z_free(ret_var);
2046         return ret_arr;
2047 }
2048
2049 static inline uintptr_t C2Tuple_PartiallySignedTransactionusizeZ_get_b(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR owner){
2050         return owner->b;
2051 }
2052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2053         LDKC2Tuple_PartiallySignedTransactionusizeZ* owner_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(owner);
2054         int64_t ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_get_b(owner_conv);
2055         return ret_conv;
2056 }
2057
2058 static inline struct LDKC2Tuple_PartiallySignedTransactionusizeZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR owner){
2059 CHECK(owner->result_ok);
2060         return C2Tuple_PartiallySignedTransactionusizeZ_clone(&*owner->contents.result);
2061 }
2062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2063         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(owner);
2064         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
2065         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(owner_conv);
2066         return tag_ptr(ret_conv, true);
2067 }
2068
2069 static inline void CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR owner){
2070 CHECK(!owner->result_ok);
2071         return *owner->contents.err;
2072 }
2073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2074         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(owner);
2075         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(owner_conv);
2076 }
2077
2078 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
2079         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
2080         for (size_t i = 0; i < ret.datalen; i++) {
2081                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2082         }
2083         return ret;
2084 }
2085 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2086 CHECK(owner->result_ok);
2087         return *owner->contents.result;
2088 }
2089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2090         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2091         CResult_NoneNoneZ_get_ok(owner_conv);
2092 }
2093
2094 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2095 CHECK(!owner->result_ok);
2096         return *owner->contents.err;
2097 }
2098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2099         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2100         CResult_NoneNoneZ_get_err(owner_conv);
2101 }
2102
2103 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
2104         return owner->a;
2105 }
2106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2107         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
2108         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2109         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
2110         return ret_arr;
2111 }
2112
2113 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
2114         return owner->b;
2115 }
2116 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2117         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
2118         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
2119         jobjectArray ret_arr = NULL;
2120         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2121         ;
2122         for (size_t i = 0; i < ret_var.datalen; i++) {
2123                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2124                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2125                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2126         }
2127         
2128         return ret_arr;
2129 }
2130
2131 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
2132 CHECK(owner->result_ok);
2133         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
2134 }
2135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2136         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
2137         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2138         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
2139         return tag_ptr(ret_conv, true);
2140 }
2141
2142 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
2143 CHECK(!owner->result_ok);
2144         return *owner->contents.err;
2145 }
2146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2147         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
2148         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
2149 }
2150
2151 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
2152 CHECK(owner->result_ok);
2153         return *owner->contents.result;
2154 }
2155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2156         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
2157         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2158         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
2159         return ret_arr;
2160 }
2161
2162 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
2163 CHECK(!owner->result_ok);
2164         return *owner->contents.err;
2165 }
2166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2167         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
2168         CResult_SignatureNoneZ_get_err(owner_conv);
2169 }
2170
2171 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2172 CHECK(owner->result_ok);
2173         return *owner->contents.result;
2174 }
2175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2176         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2177         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2178         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2179         return ret_arr;
2180 }
2181
2182 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2183 CHECK(!owner->result_ok);
2184         return *owner->contents.err;
2185 }
2186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2187         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2188         CResult_PublicKeyNoneZ_get_err(owner_conv);
2189 }
2190
2191 static jclass LDKCOption_ScalarZ_Some_class = NULL;
2192 static jmethodID LDKCOption_ScalarZ_Some_meth = NULL;
2193 static jclass LDKCOption_ScalarZ_None_class = NULL;
2194 static jmethodID LDKCOption_ScalarZ_None_meth = NULL;
2195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ScalarZ_init (JNIEnv *env, jclass clz) {
2196         LDKCOption_ScalarZ_Some_class =
2197                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScalarZ$Some"));
2198         CHECK(LDKCOption_ScalarZ_Some_class != NULL);
2199         LDKCOption_ScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ScalarZ_Some_class, "<init>", "(J)V");
2200         CHECK(LDKCOption_ScalarZ_Some_meth != NULL);
2201         LDKCOption_ScalarZ_None_class =
2202                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScalarZ$None"));
2203         CHECK(LDKCOption_ScalarZ_None_class != NULL);
2204         LDKCOption_ScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ScalarZ_None_class, "<init>", "()V");
2205         CHECK(LDKCOption_ScalarZ_None_meth != NULL);
2206 }
2207 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2208         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
2209         switch(obj->tag) {
2210                 case LDKCOption_ScalarZ_Some: {
2211                         LDKBigEndianScalar* some_ref = &obj->some;
2212                         return (*env)->NewObject(env, LDKCOption_ScalarZ_Some_class, LDKCOption_ScalarZ_Some_meth, tag_ptr(some_ref, false));
2213                 }
2214                 case LDKCOption_ScalarZ_None: {
2215                         return (*env)->NewObject(env, LDKCOption_ScalarZ_None_class, LDKCOption_ScalarZ_None_meth);
2216                 }
2217                 default: abort();
2218         }
2219 }
2220 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
2221 CHECK(owner->result_ok);
2222         return ThirtyTwoBytes_clone(&*owner->contents.result);
2223 }
2224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2225         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
2226         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2227         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SharedSecretNoneZ_get_ok(owner_conv).data);
2228         return ret_arr;
2229 }
2230
2231 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
2232 CHECK(!owner->result_ok);
2233         return *owner->contents.err;
2234 }
2235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2236         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
2237         CResult_SharedSecretNoneZ_get_err(owner_conv);
2238 }
2239
2240 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2241 CHECK(owner->result_ok);
2242         return *owner->contents.result;
2243 }
2244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2245         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2246         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2247         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2248         return ret_arr;
2249 }
2250
2251 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2252 CHECK(!owner->result_ok);
2253         return *owner->contents.err;
2254 }
2255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2256         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2257         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2258 }
2259
2260 typedef struct LDKChannelSigner_JCalls {
2261         atomic_size_t refcnt;
2262         JavaVM *vm;
2263         jweak o;
2264         jmethodID get_per_commitment_point_meth;
2265         jmethodID release_commitment_secret_meth;
2266         jmethodID validate_holder_commitment_meth;
2267         jmethodID channel_keys_id_meth;
2268         jmethodID provide_channel_parameters_meth;
2269 } LDKChannelSigner_JCalls;
2270 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2271         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2272         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2273                 JNIEnv *env;
2274                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2275                 if (get_jenv_res == JNI_EDETACHED) {
2276                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2277                 } else {
2278                         DO_ASSERT(get_jenv_res == JNI_OK);
2279                 }
2280                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2281                 if (get_jenv_res == JNI_EDETACHED) {
2282                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2283                 }
2284                 FREE(j_calls);
2285         }
2286 }
2287 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2288         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2289         JNIEnv *env;
2290         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2291         if (get_jenv_res == JNI_EDETACHED) {
2292                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2293         } else {
2294                 DO_ASSERT(get_jenv_res == JNI_OK);
2295         }
2296         int64_t idx_conv = idx;
2297         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2298         CHECK(obj != NULL);
2299         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2300         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2301                 (*env)->ExceptionDescribe(env);
2302                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2303         }
2304         LDKPublicKey ret_ref;
2305         CHECK((*env)->GetArrayLength(env, ret) == 33);
2306         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2307         if (get_jenv_res == JNI_EDETACHED) {
2308                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2309         }
2310         return ret_ref;
2311 }
2312 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2313         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2314         JNIEnv *env;
2315         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2316         if (get_jenv_res == JNI_EDETACHED) {
2317                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2318         } else {
2319                 DO_ASSERT(get_jenv_res == JNI_OK);
2320         }
2321         int64_t idx_conv = idx;
2322         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2323         CHECK(obj != NULL);
2324         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2325         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2326                 (*env)->ExceptionDescribe(env);
2327                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2328         }
2329         LDKThirtyTwoBytes ret_ref;
2330         CHECK((*env)->GetArrayLength(env, ret) == 32);
2331         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2332         if (get_jenv_res == JNI_EDETACHED) {
2333                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2334         }
2335         return ret_ref;
2336 }
2337 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
2338         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2339         JNIEnv *env;
2340         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2341         if (get_jenv_res == JNI_EDETACHED) {
2342                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2343         } else {
2344                 DO_ASSERT(get_jenv_res == JNI_OK);
2345         }
2346         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2347         int64_t holder_tx_ref = 0;
2348         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2349         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2350         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2351         LDKCVec_PaymentPreimageZ preimages_var = preimages;
2352         jobjectArray preimages_arr = NULL;
2353         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2354         ;
2355         for (size_t i = 0; i < preimages_var.datalen; i++) {
2356                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2357                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2358                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2359         }
2360         
2361         FREE(preimages_var.data);
2362         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2363         CHECK(obj != NULL);
2364         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
2365         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2366                 (*env)->ExceptionDescribe(env);
2367                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
2368         }
2369         void* ret_ptr = untag_ptr(ret);
2370         CHECK_ACCESS(ret_ptr);
2371         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2372         FREE(untag_ptr(ret));
2373         if (get_jenv_res == JNI_EDETACHED) {
2374                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2375         }
2376         return ret_conv;
2377 }
2378 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
2379         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2380         JNIEnv *env;
2381         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2382         if (get_jenv_res == JNI_EDETACHED) {
2383                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2384         } else {
2385                 DO_ASSERT(get_jenv_res == JNI_OK);
2386         }
2387         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2388         CHECK(obj != NULL);
2389         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2390         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2391                 (*env)->ExceptionDescribe(env);
2392                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
2393         }
2394         LDKThirtyTwoBytes ret_ref;
2395         CHECK((*env)->GetArrayLength(env, ret) == 32);
2396         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2397         if (get_jenv_res == JNI_EDETACHED) {
2398                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2399         }
2400         return ret_ref;
2401 }
2402 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2403         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2404         JNIEnv *env;
2405         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2406         if (get_jenv_res == JNI_EDETACHED) {
2407                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2408         } else {
2409                 DO_ASSERT(get_jenv_res == JNI_OK);
2410         }
2411         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2412         int64_t channel_parameters_ref = 0;
2413         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
2414         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2415         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
2416         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2417         CHECK(obj != NULL);
2418         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
2419         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2420                 (*env)->ExceptionDescribe(env);
2421                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
2422         }
2423         if (get_jenv_res == JNI_EDETACHED) {
2424                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2425         }
2426 }
2427 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2428         jclass c = (*env)->GetObjectClass(env, o);
2429         CHECK(c != NULL);
2430         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
2431         atomic_init(&calls->refcnt, 1);
2432         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2433         calls->o = (*env)->NewWeakGlobalRef(env, o);
2434         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2435         CHECK(calls->get_per_commitment_point_meth != NULL);
2436         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2437         CHECK(calls->release_commitment_secret_meth != NULL);
2438         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
2439         CHECK(calls->validate_holder_commitment_meth != NULL);
2440         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2441         CHECK(calls->channel_keys_id_meth != NULL);
2442         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
2443         CHECK(calls->provide_channel_parameters_meth != NULL);
2444
2445         LDKChannelPublicKeys pubkeys_conv;
2446         pubkeys_conv.inner = untag_ptr(pubkeys);
2447         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2448         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2449
2450         LDKChannelSigner ret = {
2451                 .this_arg = (void*) calls,
2452                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
2453                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
2454                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
2455                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
2456                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
2457                 .free = LDKChannelSigner_JCalls_free,
2458                 .pubkeys = pubkeys_conv,
2459                 .set_pubkeys = NULL,
2460         };
2461         return ret;
2462 }
2463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2464         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2465         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
2466         return tag_ptr(res_ptr, true);
2467 }
2468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2469         void* this_arg_ptr = untag_ptr(this_arg);
2470         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2471         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2472         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2473         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2474         return ret_arr;
2475 }
2476
2477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2478         void* this_arg_ptr = untag_ptr(this_arg);
2479         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2480         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2481         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2482         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2483         return ret_arr;
2484 }
2485
2486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx, jobjectArray preimages) {
2487         void* this_arg_ptr = untag_ptr(this_arg);
2488         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2489         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2490         LDKHolderCommitmentTransaction holder_tx_conv;
2491         holder_tx_conv.inner = untag_ptr(holder_tx);
2492         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2493         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2494         holder_tx_conv.is_owned = false;
2495         LDKCVec_PaymentPreimageZ preimages_constr;
2496         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
2497         if (preimages_constr.datalen > 0)
2498                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
2499         else
2500                 preimages_constr.data = NULL;
2501         for (size_t i = 0; i < preimages_constr.datalen; i++) {
2502                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
2503                 LDKThirtyTwoBytes preimages_conv_8_ref;
2504                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
2505                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
2506                 preimages_constr.data[i] = preimages_conv_8_ref;
2507         }
2508         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2509         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
2510         return tag_ptr(ret_conv, true);
2511 }
2512
2513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2514         void* this_arg_ptr = untag_ptr(this_arg);
2515         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2516         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2517         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2518         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2519         return ret_arr;
2520 }
2521
2522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2523         void* this_arg_ptr = untag_ptr(this_arg);
2524         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2525         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2526         LDKChannelTransactionParameters channel_parameters_conv;
2527         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2528         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2529         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2530         channel_parameters_conv.is_owned = false;
2531         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2532 }
2533
2534 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2535         if (this_arg->set_pubkeys != NULL)
2536                 this_arg->set_pubkeys(this_arg);
2537         return this_arg->pubkeys;
2538 }
2539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2540         void* this_arg_ptr = untag_ptr(this_arg);
2541         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2542         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2543         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2544         int64_t ret_ref = 0;
2545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2547         return ret_ref;
2548 }
2549
2550 typedef struct LDKEcdsaChannelSigner_JCalls {
2551         atomic_size_t refcnt;
2552         JavaVM *vm;
2553         jweak o;
2554         LDKChannelSigner_JCalls* ChannelSigner;
2555         jmethodID sign_counterparty_commitment_meth;
2556         jmethodID validate_counterparty_revocation_meth;
2557         jmethodID sign_holder_commitment_and_htlcs_meth;
2558         jmethodID sign_justice_revoked_output_meth;
2559         jmethodID sign_justice_revoked_htlc_meth;
2560         jmethodID sign_holder_htlc_transaction_meth;
2561         jmethodID sign_counterparty_htlc_transaction_meth;
2562         jmethodID sign_closing_transaction_meth;
2563         jmethodID sign_holder_anchor_input_meth;
2564         jmethodID sign_channel_announcement_with_funding_key_meth;
2565 } LDKEcdsaChannelSigner_JCalls;
2566 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2567         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2568         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2569                 JNIEnv *env;
2570                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2571                 if (get_jenv_res == JNI_EDETACHED) {
2572                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2573                 } else {
2574                         DO_ASSERT(get_jenv_res == JNI_OK);
2575                 }
2576                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2577                 if (get_jenv_res == JNI_EDETACHED) {
2578                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2579                 }
2580                 FREE(j_calls);
2581         }
2582 }
2583 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
2584         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2585         JNIEnv *env;
2586         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2587         if (get_jenv_res == JNI_EDETACHED) {
2588                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2589         } else {
2590                 DO_ASSERT(get_jenv_res == JNI_OK);
2591         }
2592         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2593         int64_t commitment_tx_ref = 0;
2594         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2595         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2596         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2597         LDKCVec_PaymentPreimageZ preimages_var = preimages;
2598         jobjectArray preimages_arr = NULL;
2599         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2600         ;
2601         for (size_t i = 0; i < preimages_var.datalen; i++) {
2602                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2603                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2604                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2605         }
2606         
2607         FREE(preimages_var.data);
2608         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2609         CHECK(obj != NULL);
2610         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
2611         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2612                 (*env)->ExceptionDescribe(env);
2613                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2614         }
2615         void* ret_ptr = untag_ptr(ret);
2616         CHECK_ACCESS(ret_ptr);
2617         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2618         FREE(untag_ptr(ret));
2619         if (get_jenv_res == JNI_EDETACHED) {
2620                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2621         }
2622         return ret_conv;
2623 }
2624 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2625         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2626         JNIEnv *env;
2627         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2628         if (get_jenv_res == JNI_EDETACHED) {
2629                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2630         } else {
2631                 DO_ASSERT(get_jenv_res == JNI_OK);
2632         }
2633         int64_t idx_conv = idx;
2634         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2635         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2636         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2637         CHECK(obj != NULL);
2638         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
2639         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2640                 (*env)->ExceptionDescribe(env);
2641                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKEcdsaChannelSigner from rust threw an exception.");
2642         }
2643         void* ret_ptr = untag_ptr(ret);
2644         CHECK_ACCESS(ret_ptr);
2645         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2646         FREE(untag_ptr(ret));
2647         if (get_jenv_res == JNI_EDETACHED) {
2648                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2649         }
2650         return ret_conv;
2651 }
2652 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2653         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2654         JNIEnv *env;
2655         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2656         if (get_jenv_res == JNI_EDETACHED) {
2657                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2658         } else {
2659                 DO_ASSERT(get_jenv_res == JNI_OK);
2660         }
2661         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2662         int64_t commitment_tx_ref = 0;
2663         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2664         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2665         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2666         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2667         CHECK(obj != NULL);
2668         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2669         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2670                 (*env)->ExceptionDescribe(env);
2671                 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKEcdsaChannelSigner from rust threw an exception.");
2672         }
2673         void* ret_ptr = untag_ptr(ret);
2674         CHECK_ACCESS(ret_ptr);
2675         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2676         FREE(untag_ptr(ret));
2677         if (get_jenv_res == JNI_EDETACHED) {
2678                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2679         }
2680         return ret_conv;
2681 }
2682 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
2683         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2684         JNIEnv *env;
2685         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2686         if (get_jenv_res == JNI_EDETACHED) {
2687                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2688         } else {
2689                 DO_ASSERT(get_jenv_res == JNI_OK);
2690         }
2691         LDKTransaction justice_tx_var = justice_tx;
2692         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2693         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2694         Transaction_free(justice_tx_var);
2695         int64_t input_conv = input;
2696         int64_t amount_conv = amount;
2697         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2698         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2699         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2700         CHECK(obj != NULL);
2701         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr);
2702         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2703                 (*env)->ExceptionDescribe(env);
2704                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
2705         }
2706         void* ret_ptr = untag_ptr(ret);
2707         CHECK_ACCESS(ret_ptr);
2708         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2709         FREE(untag_ptr(ret));
2710         if (get_jenv_res == JNI_EDETACHED) {
2711                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2712         }
2713         return ret_conv;
2714 }
2715 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2716         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2717         JNIEnv *env;
2718         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2719         if (get_jenv_res == JNI_EDETACHED) {
2720                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2721         } else {
2722                 DO_ASSERT(get_jenv_res == JNI_OK);
2723         }
2724         LDKTransaction justice_tx_var = justice_tx;
2725         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2726         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2727         Transaction_free(justice_tx_var);
2728         int64_t input_conv = input;
2729         int64_t amount_conv = amount;
2730         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2731         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2732         LDKHTLCOutputInCommitment htlc_var = *htlc;
2733         int64_t htlc_ref = 0;
2734         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2735         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2736         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2737         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2738         CHECK(obj != NULL);
2739         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr, htlc_ref);
2740         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2741                 (*env)->ExceptionDescribe(env);
2742                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
2743         }
2744         void* ret_ptr = untag_ptr(ret);
2745         CHECK_ACCESS(ret_ptr);
2746         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2747         FREE(untag_ptr(ret));
2748         if (get_jenv_res == JNI_EDETACHED) {
2749                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2750         }
2751         return ret_conv;
2752 }
2753 LDKCResult_SignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
2754         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2755         JNIEnv *env;
2756         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2757         if (get_jenv_res == JNI_EDETACHED) {
2758                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2759         } else {
2760                 DO_ASSERT(get_jenv_res == JNI_OK);
2761         }
2762         LDKTransaction htlc_tx_var = htlc_tx;
2763         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2764         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2765         Transaction_free(htlc_tx_var);
2766         int64_t input_conv = input;
2767         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
2768         int64_t htlc_descriptor_ref = 0;
2769         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
2770         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
2771         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
2772         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2773         CHECK(obj != NULL);
2774         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
2775         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2776                 (*env)->ExceptionDescribe(env);
2777                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
2778         }
2779         void* ret_ptr = untag_ptr(ret);
2780         CHECK_ACCESS(ret_ptr);
2781         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2782         FREE(untag_ptr(ret));
2783         if (get_jenv_res == JNI_EDETACHED) {
2784                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2785         }
2786         return ret_conv;
2787 }
2788 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2789         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2790         JNIEnv *env;
2791         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2792         if (get_jenv_res == JNI_EDETACHED) {
2793                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2794         } else {
2795                 DO_ASSERT(get_jenv_res == JNI_OK);
2796         }
2797         LDKTransaction htlc_tx_var = htlc_tx;
2798         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2799         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2800         Transaction_free(htlc_tx_var);
2801         int64_t input_conv = input;
2802         int64_t amount_conv = amount;
2803         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2804         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2805         LDKHTLCOutputInCommitment htlc_var = *htlc;
2806         int64_t htlc_ref = 0;
2807         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2808         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2809         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2810         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2811         CHECK(obj != NULL);
2812         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input_conv, amount_conv, per_commitment_point_arr, htlc_ref);
2813         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2814                 (*env)->ExceptionDescribe(env);
2815                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
2816         }
2817         void* ret_ptr = untag_ptr(ret);
2818         CHECK_ACCESS(ret_ptr);
2819         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2820         FREE(untag_ptr(ret));
2821         if (get_jenv_res == JNI_EDETACHED) {
2822                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2823         }
2824         return ret_conv;
2825 }
2826 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2827         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2828         JNIEnv *env;
2829         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2830         if (get_jenv_res == JNI_EDETACHED) {
2831                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2832         } else {
2833                 DO_ASSERT(get_jenv_res == JNI_OK);
2834         }
2835         LDKClosingTransaction closing_tx_var = *closing_tx;
2836         int64_t closing_tx_ref = 0;
2837         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2838         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2839         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2840         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2841         CHECK(obj != NULL);
2842         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2843         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2844                 (*env)->ExceptionDescribe(env);
2845                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
2846         }
2847         void* ret_ptr = untag_ptr(ret);
2848         CHECK_ACCESS(ret_ptr);
2849         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2850         FREE(untag_ptr(ret));
2851         if (get_jenv_res == JNI_EDETACHED) {
2852                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2853         }
2854         return ret_conv;
2855 }
2856 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2857         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2858         JNIEnv *env;
2859         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2860         if (get_jenv_res == JNI_EDETACHED) {
2861                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2862         } else {
2863                 DO_ASSERT(get_jenv_res == JNI_OK);
2864         }
2865         LDKTransaction anchor_tx_var = anchor_tx;
2866         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
2867         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
2868         Transaction_free(anchor_tx_var);
2869         int64_t input_conv = input;
2870         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2871         CHECK(obj != NULL);
2872         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
2873         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2874                 (*env)->ExceptionDescribe(env);
2875                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
2876         }
2877         void* ret_ptr = untag_ptr(ret);
2878         CHECK_ACCESS(ret_ptr);
2879         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2880         FREE(untag_ptr(ret));
2881         if (get_jenv_res == JNI_EDETACHED) {
2882                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2883         }
2884         return ret_conv;
2885 }
2886 LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2887         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2888         JNIEnv *env;
2889         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2890         if (get_jenv_res == JNI_EDETACHED) {
2891                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2892         } else {
2893                 DO_ASSERT(get_jenv_res == JNI_OK);
2894         }
2895         LDKUnsignedChannelAnnouncement msg_var = *msg;
2896         int64_t msg_ref = 0;
2897         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2898         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2899         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2900         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2901         CHECK(obj != NULL);
2902         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
2903         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2904                 (*env)->ExceptionDescribe(env);
2905                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
2906         }
2907         void* ret_ptr = untag_ptr(ret);
2908         CHECK_ACCESS(ret_ptr);
2909         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2910         FREE(untag_ptr(ret));
2911         if (get_jenv_res == JNI_EDETACHED) {
2912                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2913         }
2914         return ret_conv;
2915 }
2916 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2917         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2918         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2919         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2920 }
2921 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
2922         jclass c = (*env)->GetObjectClass(env, o);
2923         CHECK(c != NULL);
2924         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2925         atomic_init(&calls->refcnt, 1);
2926         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2927         calls->o = (*env)->NewWeakGlobalRef(env, o);
2928         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
2929         CHECK(calls->sign_counterparty_commitment_meth != NULL);
2930         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2931         CHECK(calls->validate_counterparty_revocation_meth != NULL);
2932         calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2933         CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2934         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2935         CHECK(calls->sign_justice_revoked_output_meth != NULL);
2936         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2937         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2938         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
2939         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
2940         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2941         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2942         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2943         CHECK(calls->sign_closing_transaction_meth != NULL);
2944         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
2945         CHECK(calls->sign_holder_anchor_input_meth != NULL);
2946         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
2947         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
2948
2949         LDKChannelPublicKeys pubkeys_conv;
2950         pubkeys_conv.inner = untag_ptr(pubkeys);
2951         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2952         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2953
2954         LDKEcdsaChannelSigner ret = {
2955                 .this_arg = (void*) calls,
2956                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2957                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
2958                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
2959                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2960                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2961                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2962                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2963                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2964                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2965                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2966                 .free = LDKEcdsaChannelSigner_JCalls_free,
2967                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
2968         };
2969         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2970         return ret;
2971 }
2972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
2973         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2974         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
2975         return tag_ptr(res_ptr, true);
2976 }
2977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
2978         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
2979         return tag_ptr(&inp->ChannelSigner, false);
2980 }
2981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx, jobjectArray preimages) {
2982         void* this_arg_ptr = untag_ptr(this_arg);
2983         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2984         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2985         LDKCommitmentTransaction commitment_tx_conv;
2986         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2987         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2988         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2989         commitment_tx_conv.is_owned = false;
2990         LDKCVec_PaymentPreimageZ preimages_constr;
2991         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
2992         if (preimages_constr.datalen > 0)
2993                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
2994         else
2995                 preimages_constr.data = NULL;
2996         for (size_t i = 0; i < preimages_constr.datalen; i++) {
2997                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
2998                 LDKThirtyTwoBytes preimages_conv_8_ref;
2999                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
3000                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
3001                 preimages_constr.data[i] = preimages_conv_8_ref;
3002         }
3003         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3004         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3005         return tag_ptr(ret_conv, true);
3006 }
3007
3008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
3009         void* this_arg_ptr = untag_ptr(this_arg);
3010         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3011         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3012         uint8_t secret_arr[32];
3013         CHECK((*env)->GetArrayLength(env, secret) == 32);
3014         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3015         uint8_t (*secret_ref)[32] = &secret_arr;
3016         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3017         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3018         return tag_ptr(ret_conv, true);
3019 }
3020
3021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
3022         void* this_arg_ptr = untag_ptr(this_arg);
3023         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3024         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3025         LDKHolderCommitmentTransaction commitment_tx_conv;
3026         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3027         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3028         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3029         commitment_tx_conv.is_owned = false;
3030         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3031         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3032         return tag_ptr(ret_conv, true);
3033 }
3034
3035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
3036         void* this_arg_ptr = untag_ptr(this_arg);
3037         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3038         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3039         LDKTransaction justice_tx_ref;
3040         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3041         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3042         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3043         justice_tx_ref.data_is_owned = true;
3044         uint8_t per_commitment_key_arr[32];
3045         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3046         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3047         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3048         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3049         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3050         return tag_ptr(ret_conv, true);
3051 }
3052
3053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
3054         void* this_arg_ptr = untag_ptr(this_arg);
3055         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3056         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3057         LDKTransaction justice_tx_ref;
3058         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3059         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3060         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3061         justice_tx_ref.data_is_owned = true;
3062         uint8_t per_commitment_key_arr[32];
3063         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3064         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3065         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3066         LDKHTLCOutputInCommitment htlc_conv;
3067         htlc_conv.inner = untag_ptr(htlc);
3068         htlc_conv.is_owned = ptr_is_owned(htlc);
3069         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3070         htlc_conv.is_owned = false;
3071         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3072         *ret_conv = (this_arg_conv->sign_justice_revoked_htlc)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
3073         return tag_ptr(ret_conv, true);
3074 }
3075
3076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t htlc_descriptor) {
3077         void* this_arg_ptr = untag_ptr(this_arg);
3078         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3079         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3080         LDKTransaction htlc_tx_ref;
3081         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3082         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3083         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3084         htlc_tx_ref.data_is_owned = true;
3085         LDKHTLCDescriptor htlc_descriptor_conv;
3086         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3087         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3088         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3089         htlc_descriptor_conv.is_owned = false;
3090         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3091         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3092         return tag_ptr(ret_conv, true);
3093 }
3094
3095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_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) {
3096         void* this_arg_ptr = untag_ptr(this_arg);
3097         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3098         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3099         LDKTransaction htlc_tx_ref;
3100         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3101         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3102         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3103         htlc_tx_ref.data_is_owned = true;
3104         LDKPublicKey per_commitment_point_ref;
3105         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3106         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3107         LDKHTLCOutputInCommitment htlc_conv;
3108         htlc_conv.inner = untag_ptr(htlc);
3109         htlc_conv.is_owned = ptr_is_owned(htlc);
3110         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3111         htlc_conv.is_owned = false;
3112         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3113         *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);
3114         return tag_ptr(ret_conv, true);
3115 }
3116
3117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
3118         void* this_arg_ptr = untag_ptr(this_arg);
3119         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3120         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3121         LDKClosingTransaction closing_tx_conv;
3122         closing_tx_conv.inner = untag_ptr(closing_tx);
3123         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3124         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3125         closing_tx_conv.is_owned = false;
3126         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3127         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3128         return tag_ptr(ret_conv, true);
3129 }
3130
3131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1anchor_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray anchor_tx, int64_t input) {
3132         void* this_arg_ptr = untag_ptr(this_arg);
3133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3134         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3135         LDKTransaction anchor_tx_ref;
3136         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3137         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3138         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3139         anchor_tx_ref.data_is_owned = true;
3140         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3141         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3142         return tag_ptr(ret_conv, true);
3143 }
3144
3145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1channel_1announcement_1with_1funding_1key(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
3146         void* this_arg_ptr = untag_ptr(this_arg);
3147         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3148         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3149         LDKUnsignedChannelAnnouncement msg_conv;
3150         msg_conv.inner = untag_ptr(msg);
3151         msg_conv.is_owned = ptr_is_owned(msg);
3152         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3153         msg_conv.is_owned = false;
3154         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3155         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3156         return tag_ptr(ret_conv, true);
3157 }
3158
3159 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3160         atomic_size_t refcnt;
3161         JavaVM *vm;
3162         jweak o;
3163         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3164         LDKChannelSigner_JCalls* ChannelSigner;
3165         jmethodID write_meth;
3166 } LDKWriteableEcdsaChannelSigner_JCalls;
3167 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3168         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3169         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3170                 JNIEnv *env;
3171                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3172                 if (get_jenv_res == JNI_EDETACHED) {
3173                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3174                 } else {
3175                         DO_ASSERT(get_jenv_res == JNI_OK);
3176                 }
3177                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3178                 if (get_jenv_res == JNI_EDETACHED) {
3179                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3180                 }
3181                 FREE(j_calls);
3182         }
3183 }
3184 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3185         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3186         JNIEnv *env;
3187         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3188         if (get_jenv_res == JNI_EDETACHED) {
3189                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3190         } else {
3191                 DO_ASSERT(get_jenv_res == JNI_OK);
3192         }
3193         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3194         CHECK(obj != NULL);
3195         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3196         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3197                 (*env)->ExceptionDescribe(env);
3198                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3199         }
3200         LDKCVec_u8Z ret_ref;
3201         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3202         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3203         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3204         if (get_jenv_res == JNI_EDETACHED) {
3205                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3206         }
3207         return ret_ref;
3208 }
3209 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3210         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3211         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3212         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3213         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3214 }
3215 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3216         jclass c = (*env)->GetObjectClass(env, o);
3217         CHECK(c != NULL);
3218         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3219         atomic_init(&calls->refcnt, 1);
3220         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3221         calls->o = (*env)->NewWeakGlobalRef(env, o);
3222         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3223         CHECK(calls->write_meth != NULL);
3224
3225         LDKChannelPublicKeys pubkeys_conv;
3226         pubkeys_conv.inner = untag_ptr(pubkeys);
3227         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3228         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3229
3230         LDKWriteableEcdsaChannelSigner ret = {
3231                 .this_arg = (void*) calls,
3232                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3233                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3234                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3235                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3236         };
3237         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3238         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3239         return ret;
3240 }
3241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3242         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3243         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3244         return tag_ptr(res_ptr, true);
3245 }
3246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3247         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3248         return tag_ptr(&inp->EcdsaChannelSigner, false);
3249 }
3250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3251         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3252         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3253 }
3254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3255         void* this_arg_ptr = untag_ptr(this_arg);
3256         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3257         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3258         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3259         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3260         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3261         CVec_u8Z_free(ret_var);
3262         return ret_arr;
3263 }
3264
3265 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3266 CHECK(owner->result_ok);
3267         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3268 }
3269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3270         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3271         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3272         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3273         return tag_ptr(ret_ret, true);
3274 }
3275
3276 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3277 CHECK(!owner->result_ok);
3278         return DecodeError_clone(&*owner->contents.err);
3279 }
3280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3281         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3282         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3283         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3284         int64_t ret_ref = tag_ptr(ret_copy, true);
3285         return ret_ref;
3286 }
3287
3288 static inline struct LDKCVec_u8Z CResult_ScriptNoneZ_get_ok(LDKCResult_ScriptNoneZ *NONNULL_PTR owner){
3289 CHECK(owner->result_ok);
3290         return CVec_u8Z_clone(&*owner->contents.result);
3291 }
3292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3293         LDKCResult_ScriptNoneZ* owner_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(owner);
3294         LDKCVec_u8Z ret_var = CResult_ScriptNoneZ_get_ok(owner_conv);
3295         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3296         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3297         CVec_u8Z_free(ret_var);
3298         return ret_arr;
3299 }
3300
3301 static inline void CResult_ScriptNoneZ_get_err(LDKCResult_ScriptNoneZ *NONNULL_PTR owner){
3302 CHECK(!owner->result_ok);
3303         return *owner->contents.err;
3304 }
3305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3306         LDKCResult_ScriptNoneZ* owner_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(owner);
3307         CResult_ScriptNoneZ_get_err(owner_conv);
3308 }
3309
3310 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3311         LDKShutdownScript ret = *owner->contents.result;
3312         ret.is_owned = false;
3313         return ret;
3314 }
3315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3316         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3317         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3318         int64_t ret_ref = 0;
3319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3321         return ret_ref;
3322 }
3323
3324 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3325 CHECK(!owner->result_ok);
3326         return *owner->contents.err;
3327 }
3328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3329         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3330         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
3331 }
3332
3333 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3334         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3335         for (size_t i = 0; i < ret.datalen; i++) {
3336                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3337         }
3338         return ret;
3339 }
3340 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3341 CHECK(owner->result_ok);
3342         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
3343 }
3344 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3345         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3346         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
3347         jobjectArray ret_arr = NULL;
3348         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3349         ;
3350         for (size_t i = 0; i < ret_var.datalen; i++) {
3351                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
3352                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
3353                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
3354                 CVec_u8Z_free(ret_conv_8_var);
3355                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3356         }
3357         
3358         FREE(ret_var.data);
3359         return ret_arr;
3360 }
3361
3362 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3363 CHECK(!owner->result_ok);
3364         return *owner->contents.err;
3365 }
3366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3367         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3368         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
3369 }
3370
3371 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3372         LDKInMemorySigner ret = *owner->contents.result;
3373         ret.is_owned = false;
3374         return ret;
3375 }
3376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3377         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3378         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3379         int64_t ret_ref = 0;
3380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3382         return ret_ref;
3383 }
3384
3385 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3386 CHECK(!owner->result_ok);
3387         return DecodeError_clone(&*owner->contents.err);
3388 }
3389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3390         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3391         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3392         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3393         int64_t ret_ref = tag_ptr(ret_copy, true);
3394         return ret_ref;
3395 }
3396
3397 static inline struct LDKCVec_u8Z CResult_PartiallySignedTransactionNoneZ_get_ok(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR owner){
3398 CHECK(owner->result_ok);
3399         return CVec_u8Z_clone(&*owner->contents.result);
3400 }
3401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3402         LDKCResult_PartiallySignedTransactionNoneZ* owner_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(owner);
3403         LDKCVec_u8Z ret_var = CResult_PartiallySignedTransactionNoneZ_get_ok(owner_conv);
3404         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3405         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3406         CVec_u8Z_free(ret_var);
3407         return ret_arr;
3408 }
3409
3410 static inline void CResult_PartiallySignedTransactionNoneZ_get_err(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR owner){
3411 CHECK(!owner->result_ok);
3412         return *owner->contents.err;
3413 }
3414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3415         LDKCResult_PartiallySignedTransactionNoneZ* owner_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(owner);
3416         CResult_PartiallySignedTransactionNoneZ_get_err(owner_conv);
3417 }
3418
3419 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3420 CHECK(owner->result_ok);
3421         return *owner->contents.result;
3422 }
3423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3424         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3425         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3426         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3427         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3428         return ret_arr;
3429 }
3430
3431 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3432 CHECK(!owner->result_ok);
3433         return *owner->contents.err;
3434 }
3435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3436         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3437         CResult_TransactionNoneZ_get_err(owner_conv);
3438 }
3439
3440 typedef struct LDKScore_JCalls {
3441         atomic_size_t refcnt;
3442         JavaVM *vm;
3443         jweak o;
3444         jmethodID channel_penalty_msat_meth;
3445         jmethodID payment_path_failed_meth;
3446         jmethodID payment_path_successful_meth;
3447         jmethodID probe_failed_meth;
3448         jmethodID probe_successful_meth;
3449         jmethodID write_meth;
3450 } LDKScore_JCalls;
3451 static void LDKScore_JCalls_free(void* this_arg) {
3452         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3453         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3454                 JNIEnv *env;
3455                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3456                 if (get_jenv_res == JNI_EDETACHED) {
3457                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3458                 } else {
3459                         DO_ASSERT(get_jenv_res == JNI_OK);
3460                 }
3461                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3462                 if (get_jenv_res == JNI_EDETACHED) {
3463                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3464                 }
3465                 FREE(j_calls);
3466         }
3467 }
3468 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
3469         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3470         JNIEnv *env;
3471         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3472         if (get_jenv_res == JNI_EDETACHED) {
3473                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3474         } else {
3475                 DO_ASSERT(get_jenv_res == JNI_OK);
3476         }
3477         int64_t short_channel_id_conv = short_channel_id;
3478         LDKNodeId source_var = *source;
3479         int64_t source_ref = 0;
3480         source_var = NodeId_clone(&source_var);
3481         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
3482         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
3483         LDKNodeId target_var = *target;
3484         int64_t target_ref = 0;
3485         target_var = NodeId_clone(&target_var);
3486         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
3487         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
3488         LDKChannelUsage usage_var = usage;
3489         int64_t usage_ref = 0;
3490         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
3491         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
3492         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
3493         int64_t score_params_ref = 0;
3494         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
3495         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
3496         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
3497         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3498         CHECK(obj != NULL);
3499         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref);
3500         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3501                 (*env)->ExceptionDescribe(env);
3502                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
3503         }
3504         if (get_jenv_res == JNI_EDETACHED) {
3505                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3506         }
3507         return ret;
3508 }
3509 void payment_path_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3510         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3511         JNIEnv *env;
3512         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3513         if (get_jenv_res == JNI_EDETACHED) {
3514                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3515         } else {
3516                 DO_ASSERT(get_jenv_res == JNI_OK);
3517         }
3518         LDKPath path_var = *path;
3519         int64_t path_ref = 0;
3520         path_var = Path_clone(&path_var);
3521         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3522         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3523         int64_t short_channel_id_conv = short_channel_id;
3524         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3525         CHECK(obj != NULL);
3526         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv);
3527         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3528                 (*env)->ExceptionDescribe(env);
3529                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
3530         }
3531         if (get_jenv_res == JNI_EDETACHED) {
3532                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3533         }
3534 }
3535 void payment_path_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
3536         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3537         JNIEnv *env;
3538         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3539         if (get_jenv_res == JNI_EDETACHED) {
3540                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3541         } else {
3542                 DO_ASSERT(get_jenv_res == JNI_OK);
3543         }
3544         LDKPath path_var = *path;
3545         int64_t path_ref = 0;
3546         path_var = Path_clone(&path_var);
3547         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3548         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3549         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3550         CHECK(obj != NULL);
3551         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref);
3552         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3553                 (*env)->ExceptionDescribe(env);
3554                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
3555         }
3556         if (get_jenv_res == JNI_EDETACHED) {
3557                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3558         }
3559 }
3560 void probe_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3561         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3562         JNIEnv *env;
3563         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3564         if (get_jenv_res == JNI_EDETACHED) {
3565                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3566         } else {
3567                 DO_ASSERT(get_jenv_res == JNI_OK);
3568         }
3569         LDKPath path_var = *path;
3570         int64_t path_ref = 0;
3571         path_var = Path_clone(&path_var);
3572         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3573         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3574         int64_t short_channel_id_conv = short_channel_id;
3575         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3576         CHECK(obj != NULL);
3577         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv);
3578         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3579                 (*env)->ExceptionDescribe(env);
3580                 (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception.");
3581         }
3582         if (get_jenv_res == JNI_EDETACHED) {
3583                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3584         }
3585 }
3586 void probe_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
3587         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3588         JNIEnv *env;
3589         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3590         if (get_jenv_res == JNI_EDETACHED) {
3591                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3592         } else {
3593                 DO_ASSERT(get_jenv_res == JNI_OK);
3594         }
3595         LDKPath path_var = *path;
3596         int64_t path_ref = 0;
3597         path_var = Path_clone(&path_var);
3598         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3599         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3600         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3601         CHECK(obj != NULL);
3602         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref);
3603         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3604                 (*env)->ExceptionDescribe(env);
3605                 (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception.");
3606         }
3607         if (get_jenv_res == JNI_EDETACHED) {
3608                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3609         }
3610 }
3611 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
3612         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3613         JNIEnv *env;
3614         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3615         if (get_jenv_res == JNI_EDETACHED) {
3616                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3617         } else {
3618                 DO_ASSERT(get_jenv_res == JNI_OK);
3619         }
3620         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3621         CHECK(obj != NULL);
3622         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3623         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3624                 (*env)->ExceptionDescribe(env);
3625                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
3626         }
3627         LDKCVec_u8Z ret_ref;
3628         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3629         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3630         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3631         if (get_jenv_res == JNI_EDETACHED) {
3632                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3633         }
3634         return ret_ref;
3635 }
3636 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
3637         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
3638         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3639 }
3640 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
3641         jclass c = (*env)->GetObjectClass(env, o);
3642         CHECK(c != NULL);
3643         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
3644         atomic_init(&calls->refcnt, 1);
3645         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3646         calls->o = (*env)->NewWeakGlobalRef(env, o);
3647         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
3648         CHECK(calls->channel_penalty_msat_meth != NULL);
3649         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJ)V");
3650         CHECK(calls->payment_path_failed_meth != NULL);
3651         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(J)V");
3652         CHECK(calls->payment_path_successful_meth != NULL);
3653         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJ)V");
3654         CHECK(calls->probe_failed_meth != NULL);
3655         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(J)V");
3656         CHECK(calls->probe_successful_meth != NULL);
3657         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3658         CHECK(calls->write_meth != NULL);
3659
3660         LDKScore ret = {
3661                 .this_arg = (void*) calls,
3662                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
3663                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
3664                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
3665                 .probe_failed = probe_failed_LDKScore_jcall,
3666                 .probe_successful = probe_successful_LDKScore_jcall,
3667                 .write = write_LDKScore_jcall,
3668                 .free = LDKScore_JCalls_free,
3669         };
3670         return ret;
3671 }
3672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
3673         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
3674         *res_ptr = LDKScore_init(env, clz, o);
3675         return tag_ptr(res_ptr, true);
3676 }
3677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t source, int64_t target, int64_t usage, int64_t score_params) {
3678         void* this_arg_ptr = untag_ptr(this_arg);
3679         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3680         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3681         LDKNodeId source_conv;
3682         source_conv.inner = untag_ptr(source);
3683         source_conv.is_owned = ptr_is_owned(source);
3684         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
3685         source_conv.is_owned = false;
3686         LDKNodeId target_conv;
3687         target_conv.inner = untag_ptr(target);
3688         target_conv.is_owned = ptr_is_owned(target);
3689         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
3690         target_conv.is_owned = false;
3691         LDKChannelUsage usage_conv;
3692         usage_conv.inner = untag_ptr(usage);
3693         usage_conv.is_owned = ptr_is_owned(usage);
3694         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
3695         usage_conv = ChannelUsage_clone(&usage_conv);
3696         LDKProbabilisticScoringFeeParameters score_params_conv;
3697         score_params_conv.inner = untag_ptr(score_params);
3698         score_params_conv.is_owned = ptr_is_owned(score_params);
3699         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
3700         score_params_conv.is_owned = false;
3701         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv, &score_params_conv);
3702         return ret_conv;
3703 }
3704
3705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t short_channel_id) {
3706         void* this_arg_ptr = untag_ptr(this_arg);
3707         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3708         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3709         LDKPath path_conv;
3710         path_conv.inner = untag_ptr(path);
3711         path_conv.is_owned = ptr_is_owned(path);
3712         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
3713         path_conv.is_owned = false;
3714         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
3715 }
3716
3717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
3718         void* this_arg_ptr = untag_ptr(this_arg);
3719         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3720         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3721         LDKPath path_conv;
3722         path_conv.inner = untag_ptr(path);
3723         path_conv.is_owned = ptr_is_owned(path);
3724         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
3725         path_conv.is_owned = false;
3726         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
3727 }
3728
3729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t short_channel_id) {
3730         void* this_arg_ptr = untag_ptr(this_arg);
3731         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3732         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3733         LDKPath path_conv;
3734         path_conv.inner = untag_ptr(path);
3735         path_conv.is_owned = ptr_is_owned(path);
3736         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
3737         path_conv.is_owned = false;
3738         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
3739 }
3740
3741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
3742         void* this_arg_ptr = untag_ptr(this_arg);
3743         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3744         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3745         LDKPath path_conv;
3746         path_conv.inner = untag_ptr(path);
3747         path_conv.is_owned = ptr_is_owned(path);
3748         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
3749         path_conv.is_owned = false;
3750         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
3751 }
3752
3753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3754         void* this_arg_ptr = untag_ptr(this_arg);
3755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3756         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3757         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3758         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3759         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3760         CVec_u8Z_free(ret_var);
3761         return ret_arr;
3762 }
3763
3764 typedef struct LDKLockableScore_JCalls {
3765         atomic_size_t refcnt;
3766         JavaVM *vm;
3767         jweak o;
3768         jmethodID lock_meth;
3769 } LDKLockableScore_JCalls;
3770 static void LDKLockableScore_JCalls_free(void* this_arg) {
3771         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
3772         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3773                 JNIEnv *env;
3774                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3775                 if (get_jenv_res == JNI_EDETACHED) {
3776                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3777                 } else {
3778                         DO_ASSERT(get_jenv_res == JNI_OK);
3779                 }
3780                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3781                 if (get_jenv_res == JNI_EDETACHED) {
3782                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3783                 }
3784                 FREE(j_calls);
3785         }
3786 }
3787 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
3788         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
3789         JNIEnv *env;
3790         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3791         if (get_jenv_res == JNI_EDETACHED) {
3792                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3793         } else {
3794                 DO_ASSERT(get_jenv_res == JNI_OK);
3795         }
3796         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3797         CHECK(obj != NULL);
3798         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
3799         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3800                 (*env)->ExceptionDescribe(env);
3801                 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
3802         }
3803         void* ret_ptr = untag_ptr(ret);
3804         CHECK_ACCESS(ret_ptr);
3805         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
3806         if (ret_conv.free == LDKScore_JCalls_free) {
3807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3808                 LDKScore_JCalls_cloned(&ret_conv);
3809         }// WARNING: we may need a move here but no clone is available for LDKScore
3810         
3811         if (get_jenv_res == JNI_EDETACHED) {
3812                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3813         }
3814         return ret_conv;
3815 }
3816 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
3817         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
3818         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3819 }
3820 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
3821         jclass c = (*env)->GetObjectClass(env, o);
3822         CHECK(c != NULL);
3823         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
3824         atomic_init(&calls->refcnt, 1);
3825         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3826         calls->o = (*env)->NewWeakGlobalRef(env, o);
3827         calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
3828         CHECK(calls->lock_meth != NULL);
3829
3830         LDKLockableScore ret = {
3831                 .this_arg = (void*) calls,
3832                 .lock = lock_LDKLockableScore_jcall,
3833                 .free = LDKLockableScore_JCalls_free,
3834         };
3835         return ret;
3836 }
3837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
3838         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
3839         *res_ptr = LDKLockableScore_init(env, clz, o);
3840         return tag_ptr(res_ptr, true);
3841 }
3842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
3843         void* this_arg_ptr = untag_ptr(this_arg);
3844         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3845         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
3846         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
3847         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
3848         return tag_ptr(ret_ret, true);
3849 }
3850
3851 typedef struct LDKWriteableScore_JCalls {
3852         atomic_size_t refcnt;
3853         JavaVM *vm;
3854         jweak o;
3855         LDKLockableScore_JCalls* LockableScore;
3856         jmethodID write_meth;
3857 } LDKWriteableScore_JCalls;
3858 static void LDKWriteableScore_JCalls_free(void* this_arg) {
3859         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
3860         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3861                 JNIEnv *env;
3862                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3863                 if (get_jenv_res == JNI_EDETACHED) {
3864                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3865                 } else {
3866                         DO_ASSERT(get_jenv_res == JNI_OK);
3867                 }
3868                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3869                 if (get_jenv_res == JNI_EDETACHED) {
3870                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3871                 }
3872                 FREE(j_calls);
3873         }
3874 }
3875 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
3876         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
3877         JNIEnv *env;
3878         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3879         if (get_jenv_res == JNI_EDETACHED) {
3880                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3881         } else {
3882                 DO_ASSERT(get_jenv_res == JNI_OK);
3883         }
3884         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3885         CHECK(obj != NULL);
3886         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3887         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3888                 (*env)->ExceptionDescribe(env);
3889                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
3890         }
3891         LDKCVec_u8Z ret_ref;
3892         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3893         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3894         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3895         if (get_jenv_res == JNI_EDETACHED) {
3896                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3897         }
3898         return ret_ref;
3899 }
3900 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
3901         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
3902         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3903         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
3904 }
3905 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
3906         jclass c = (*env)->GetObjectClass(env, o);
3907         CHECK(c != NULL);
3908         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
3909         atomic_init(&calls->refcnt, 1);
3910         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3911         calls->o = (*env)->NewWeakGlobalRef(env, o);
3912         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3913         CHECK(calls->write_meth != NULL);
3914
3915         LDKWriteableScore ret = {
3916                 .this_arg = (void*) calls,
3917                 .write = write_LDKWriteableScore_jcall,
3918                 .free = LDKWriteableScore_JCalls_free,
3919                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
3920         };
3921         calls->LockableScore = ret.LockableScore.this_arg;
3922         return ret;
3923 }
3924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
3925         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
3926         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
3927         return tag_ptr(res_ptr, true);
3928 }
3929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
3930         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
3931         return tag_ptr(&inp->LockableScore, false);
3932 }
3933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3934         void* this_arg_ptr = untag_ptr(this_arg);
3935         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3936         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
3937         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3938         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3939         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3940         CVec_u8Z_free(ret_var);
3941         return ret_arr;
3942 }
3943
3944 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
3945 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
3946 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
3947 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
3948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
3949         LDKCOption_WriteableScoreZ_Some_class =
3950                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
3951         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
3952         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
3953         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
3954         LDKCOption_WriteableScoreZ_None_class =
3955                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
3956         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
3957         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
3958         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
3959 }
3960 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3961         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
3962         switch(obj->tag) {
3963                 case LDKCOption_WriteableScoreZ_Some: {
3964                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
3965                         *some_ret = obj->some;
3966                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3967                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
3968                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3969                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
3970                         }
3971                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
3972                 }
3973                 case LDKCOption_WriteableScoreZ_None: {
3974                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
3975                 }
3976                 default: abort();
3977         }
3978 }
3979 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
3980 CHECK(owner->result_ok);
3981         return *owner->contents.result;
3982 }
3983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3984         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
3985         CResult_NoneErrorZ_get_ok(owner_conv);
3986 }
3987
3988 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
3989 CHECK(!owner->result_ok);
3990         return *owner->contents.err;
3991 }
3992 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3993         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
3994         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
3995         return ret_conv;
3996 }
3997
3998 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
3999         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4000         for (size_t i = 0; i < ret.datalen; i++) {
4001                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4002         }
4003         return ret;
4004 }
4005 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4006         LDKRoute ret = *owner->contents.result;
4007         ret.is_owned = false;
4008         return ret;
4009 }
4010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4011         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4012         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4013         int64_t ret_ref = 0;
4014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4016         return ret_ref;
4017 }
4018
4019 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4020         LDKLightningError ret = *owner->contents.err;
4021         ret.is_owned = false;
4022         return ret;
4023 }
4024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4025         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4026         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4027         int64_t ret_ref = 0;
4028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4030         return ret_ref;
4031 }
4032
4033 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4034         LDKInFlightHtlcs ret = *owner->contents.result;
4035         ret.is_owned = false;
4036         return ret;
4037 }
4038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4039         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4040         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4041         int64_t ret_ref = 0;
4042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4044         return ret_ref;
4045 }
4046
4047 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4048 CHECK(!owner->result_ok);
4049         return DecodeError_clone(&*owner->contents.err);
4050 }
4051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4052         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4053         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4054         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4055         int64_t ret_ref = tag_ptr(ret_copy, true);
4056         return ret_ref;
4057 }
4058
4059 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4060         LDKRouteHop ret = *owner->contents.result;
4061         ret.is_owned = false;
4062         return ret;
4063 }
4064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4065         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4066         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4067         int64_t ret_ref = 0;
4068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4070         return ret_ref;
4071 }
4072
4073 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4074 CHECK(!owner->result_ok);
4075         return DecodeError_clone(&*owner->contents.err);
4076 }
4077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4078         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4079         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4080         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
4081         int64_t ret_ref = tag_ptr(ret_copy, true);
4082         return ret_ref;
4083 }
4084
4085 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
4086         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
4087         for (size_t i = 0; i < ret.datalen; i++) {
4088                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
4089         }
4090         return ret;
4091 }
4092 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4093         LDKBlindedTail ret = *owner->contents.result;
4094         ret.is_owned = false;
4095         return ret;
4096 }
4097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4098         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4099         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
4100         int64_t ret_ref = 0;
4101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4103         return ret_ref;
4104 }
4105
4106 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4107 CHECK(!owner->result_ok);
4108         return DecodeError_clone(&*owner->contents.err);
4109 }
4110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4111         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4112         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4113         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
4114         int64_t ret_ref = tag_ptr(ret_copy, true);
4115         return ret_ref;
4116 }
4117
4118 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
4119         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
4120         for (size_t i = 0; i < ret.datalen; i++) {
4121                 ret.data[i] = RouteHop_clone(&orig->data[i]);
4122         }
4123         return ret;
4124 }
4125 static jclass LDKCOption_u32Z_Some_class = NULL;
4126 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
4127 static jclass LDKCOption_u32Z_None_class = NULL;
4128 static jmethodID LDKCOption_u32Z_None_meth = NULL;
4129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
4130         LDKCOption_u32Z_Some_class =
4131                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
4132         CHECK(LDKCOption_u32Z_Some_class != NULL);
4133         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
4134         CHECK(LDKCOption_u32Z_Some_meth != NULL);
4135         LDKCOption_u32Z_None_class =
4136                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
4137         CHECK(LDKCOption_u32Z_None_class != NULL);
4138         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
4139         CHECK(LDKCOption_u32Z_None_meth != NULL);
4140 }
4141 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4142         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
4143         switch(obj->tag) {
4144                 case LDKCOption_u32Z_Some: {
4145                         int32_t some_conv = obj->some;
4146                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
4147                 }
4148                 case LDKCOption_u32Z_None: {
4149                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
4150                 }
4151                 default: abort();
4152         }
4153 }
4154 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
4155         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
4156         for (size_t i = 0; i < ret.datalen; i++) {
4157                 ret.data[i] = Path_clone(&orig->data[i]);
4158         }
4159         return ret;
4160 }
4161 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4162         LDKRoute ret = *owner->contents.result;
4163         ret.is_owned = false;
4164         return ret;
4165 }
4166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4167         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4168         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
4169         int64_t ret_ref = 0;
4170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4172         return ret_ref;
4173 }
4174
4175 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4176 CHECK(!owner->result_ok);
4177         return DecodeError_clone(&*owner->contents.err);
4178 }
4179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4180         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4181         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4182         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
4183         int64_t ret_ref = tag_ptr(ret_copy, true);
4184         return ret_ref;
4185 }
4186
4187 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4188         LDKRouteParameters ret = *owner->contents.result;
4189         ret.is_owned = false;
4190         return ret;
4191 }
4192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4193         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4194         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
4195         int64_t ret_ref = 0;
4196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4198         return ret_ref;
4199 }
4200
4201 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4202 CHECK(!owner->result_ok);
4203         return DecodeError_clone(&*owner->contents.err);
4204 }
4205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4206         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4207         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4208         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
4209         int64_t ret_ref = tag_ptr(ret_copy, true);
4210         return ret_ref;
4211 }
4212
4213 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4214         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4215         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4216         return ret;
4217 }
4218 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4219         LDKPaymentParameters ret = *owner->contents.result;
4220         ret.is_owned = false;
4221         return ret;
4222 }
4223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4224         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4225         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
4226         int64_t ret_ref = 0;
4227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4229         return ret_ref;
4230 }
4231
4232 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4233 CHECK(!owner->result_ok);
4234         return DecodeError_clone(&*owner->contents.err);
4235 }
4236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4237         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4238         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4239         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
4240         int64_t ret_ref = tag_ptr(ret_copy, true);
4241         return ret_ref;
4242 }
4243
4244 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4245         LDKBlindedPayInfo ret = owner->a;
4246         ret.is_owned = false;
4247         return ret;
4248 }
4249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4250         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4251         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4252         int64_t ret_ref = 0;
4253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4255         return ret_ref;
4256 }
4257
4258 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4259         LDKBlindedPath ret = owner->b;
4260         ret.is_owned = false;
4261         return ret;
4262 }
4263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4264         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4265         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4266         int64_t ret_ref = 0;
4267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4269         return ret_ref;
4270 }
4271
4272 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4273         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4274         for (size_t i = 0; i < ret.datalen; i++) {
4275                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4276         }
4277         return ret;
4278 }
4279 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
4280         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
4281         for (size_t i = 0; i < ret.datalen; i++) {
4282                 ret.data[i] = RouteHint_clone(&orig->data[i]);
4283         }
4284         return ret;
4285 }
4286 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
4287         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
4288         for (size_t i = 0; i < ret.datalen; i++) {
4289                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
4290         }
4291         return ret;
4292 }
4293 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4294         LDKRouteHint ret = *owner->contents.result;
4295         ret.is_owned = false;
4296         return ret;
4297 }
4298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4299         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4300         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
4301         int64_t ret_ref = 0;
4302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4304         return ret_ref;
4305 }
4306
4307 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4308 CHECK(!owner->result_ok);
4309         return DecodeError_clone(&*owner->contents.err);
4310 }
4311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4312         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4313         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4314         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
4315         int64_t ret_ref = tag_ptr(ret_copy, true);
4316         return ret_ref;
4317 }
4318
4319 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4320         LDKRouteHintHop ret = *owner->contents.result;
4321         ret.is_owned = false;
4322         return ret;
4323 }
4324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4325         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4326         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
4327         int64_t ret_ref = 0;
4328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4330         return ret_ref;
4331 }
4332
4333 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4334 CHECK(!owner->result_ok);
4335         return DecodeError_clone(&*owner->contents.err);
4336 }
4337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4338         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4339         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4340         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
4341         int64_t ret_ref = tag_ptr(ret_copy, true);
4342         return ret_ref;
4343 }
4344
4345 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4346         LDKFixedPenaltyScorer ret = *owner->contents.result;
4347         ret.is_owned = false;
4348         return ret;
4349 }
4350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4351         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4352         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
4353         int64_t ret_ref = 0;
4354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4356         return ret_ref;
4357 }
4358
4359 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4360 CHECK(!owner->result_ok);
4361         return DecodeError_clone(&*owner->contents.err);
4362 }
4363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4364         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4365         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4366         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
4367         int64_t ret_ref = tag_ptr(ret_copy, true);
4368         return ret_ref;
4369 }
4370
4371 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4372         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4373         for (size_t i = 0; i < ret.datalen; i++) {
4374                 ret.data[i] = NodeId_clone(&orig->data[i]);
4375         }
4376         return ret;
4377 }
4378 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4379         return owner->a;
4380 }
4381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4382         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4383         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
4384         return ret_conv;
4385 }
4386
4387 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4388         return owner->b;
4389 }
4390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4391         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4392         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
4393         return ret_conv;
4394 }
4395
4396 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
4397 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
4398 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
4399 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
4400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
4401         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4402                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4403         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4404         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4405         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4406         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4407                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4408         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4409         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4410         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4411 }
4412 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4413         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4414         switch(obj->tag) {
4415                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4416                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4417                         *some_conv = obj->some;
4418                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4419                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4420                 }
4421                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4422                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4423                 }
4424                 default: abort();
4425         }
4426 }
4427 static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
4428         return owner->a;
4429 }
4430 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4431         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4432         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4433         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_a(owner_conv).data);
4434         return ret_arr;
4435 }
4436
4437 static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
4438         return owner->b;
4439 }
4440 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4441         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4442         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4443         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_b(owner_conv).data);
4444         return ret_arr;
4445 }
4446
4447 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
4448         return owner->a;
4449 }
4450 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4451         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
4452         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4453         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_a(owner_conv).data);
4454         return ret_arr;
4455 }
4456
4457 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
4458         return owner->b;
4459 }
4460 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4461         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
4462         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4463         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_b(owner_conv).data);
4464         return ret_arr;
4465 }
4466
4467 static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class = NULL;
4468 static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = NULL;
4469 static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class = NULL;
4470 static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = NULL;
4471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_init (JNIEnv *env, jclass clz) {
4472         LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class =
4473                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$Some"));
4474         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class != NULL);
4475         LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, "<init>", "(J)V");
4476         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth != NULL);
4477         LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class =
4478                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$None"));
4479         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class != NULL);
4480         LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, "<init>", "()V");
4481         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth != NULL);
4482 }
4483 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4484         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
4485         switch(obj->tag) {
4486                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: {
4487                         LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
4488                         *some_conv = obj->some;
4489                         *some_conv = C2Tuple__u168_u168Z_clone(some_conv);
4490                         return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth, tag_ptr(some_conv, true));
4491                 }
4492                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: {
4493                         return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth);
4494                 }
4495                 default: abort();
4496         }
4497 }
4498 typedef struct LDKLogger_JCalls {
4499         atomic_size_t refcnt;
4500         JavaVM *vm;
4501         jweak o;
4502         jmethodID log_meth;
4503 } LDKLogger_JCalls;
4504 static void LDKLogger_JCalls_free(void* this_arg) {
4505         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4506         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4507                 JNIEnv *env;
4508                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4509                 if (get_jenv_res == JNI_EDETACHED) {
4510                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4511                 } else {
4512                         DO_ASSERT(get_jenv_res == JNI_OK);
4513                 }
4514                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4515                 if (get_jenv_res == JNI_EDETACHED) {
4516                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4517                 }
4518                 FREE(j_calls);
4519         }
4520 }
4521 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4522         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4523         JNIEnv *env;
4524         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4525         if (get_jenv_res == JNI_EDETACHED) {
4526                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4527         } else {
4528                 DO_ASSERT(get_jenv_res == JNI_OK);
4529         }
4530         LDKRecord record_var = *record;
4531         int64_t record_ref = 0;
4532         record_var = Record_clone(&record_var);
4533         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4534         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
4535         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4536         CHECK(obj != NULL);
4537         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
4538         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4539                 (*env)->ExceptionDescribe(env);
4540                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4541         }
4542         if (get_jenv_res == JNI_EDETACHED) {
4543                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4544         }
4545 }
4546 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4547         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4548         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4549 }
4550 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4551         jclass c = (*env)->GetObjectClass(env, o);
4552         CHECK(c != NULL);
4553         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4554         atomic_init(&calls->refcnt, 1);
4555         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4556         calls->o = (*env)->NewWeakGlobalRef(env, o);
4557         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
4558         CHECK(calls->log_meth != NULL);
4559
4560         LDKLogger ret = {
4561                 .this_arg = (void*) calls,
4562                 .log = log_LDKLogger_jcall,
4563                 .free = LDKLogger_JCalls_free,
4564         };
4565         return ret;
4566 }
4567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4568         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4569         *res_ptr = LDKLogger_init(env, clz, o);
4570         return tag_ptr(res_ptr, true);
4571 }
4572 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4573         LDKProbabilisticScorer ret = *owner->contents.result;
4574         ret.is_owned = false;
4575         return ret;
4576 }
4577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4578         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4579         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
4580         int64_t ret_ref = 0;
4581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4583         return ret_ref;
4584 }
4585
4586 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4587 CHECK(!owner->result_ok);
4588         return DecodeError_clone(&*owner->contents.err);
4589 }
4590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4591         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4593         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
4594         int64_t ret_ref = tag_ptr(ret_copy, true);
4595         return ret_ref;
4596 }
4597
4598 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4599         return owner->a;
4600 }
4601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4602         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4603         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
4604         return ret_conv;
4605 }
4606
4607 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4608         return owner->b;
4609 }
4610 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4611         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4612         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
4613         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4614         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4615         return ret_arr;
4616 }
4617
4618 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
4619         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
4620         for (size_t i = 0; i < ret.datalen; i++) {
4621                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
4622         }
4623         return ret;
4624 }
4625 static jclass LDKCOption_BlockHashZ_Some_class = NULL;
4626 static jmethodID LDKCOption_BlockHashZ_Some_meth = NULL;
4627 static jclass LDKCOption_BlockHashZ_None_class = NULL;
4628 static jmethodID LDKCOption_BlockHashZ_None_meth = NULL;
4629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BlockHashZ_init (JNIEnv *env, jclass clz) {
4630         LDKCOption_BlockHashZ_Some_class =
4631                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BlockHashZ$Some"));
4632         CHECK(LDKCOption_BlockHashZ_Some_class != NULL);
4633         LDKCOption_BlockHashZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BlockHashZ_Some_class, "<init>", "([B)V");
4634         CHECK(LDKCOption_BlockHashZ_Some_meth != NULL);
4635         LDKCOption_BlockHashZ_None_class =
4636                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BlockHashZ$None"));
4637         CHECK(LDKCOption_BlockHashZ_None_class != NULL);
4638         LDKCOption_BlockHashZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BlockHashZ_None_class, "<init>", "()V");
4639         CHECK(LDKCOption_BlockHashZ_None_meth != NULL);
4640 }
4641 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BlockHashZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4642         LDKCOption_BlockHashZ *obj = (LDKCOption_BlockHashZ*)untag_ptr(ptr);
4643         switch(obj->tag) {
4644                 case LDKCOption_BlockHashZ_Some: {
4645                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
4646                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
4647                         return (*env)->NewObject(env, LDKCOption_BlockHashZ_Some_class, LDKCOption_BlockHashZ_Some_meth, some_arr);
4648                 }
4649                 case LDKCOption_BlockHashZ_None: {
4650                         return (*env)->NewObject(env, LDKCOption_BlockHashZ_None_class, LDKCOption_BlockHashZ_None_meth);
4651                 }
4652                 default: abort();
4653         }
4654 }
4655 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCOption_BlockHashZZ_get_a(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR owner){
4656         return ThirtyTwoBytes_clone(&owner->a);
4657 }
4658 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4659         LDKC2Tuple_TxidCOption_BlockHashZZ* owner_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(owner);
4660         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4661         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCOption_BlockHashZZ_get_a(owner_conv).data);
4662         return ret_arr;
4663 }
4664
4665 static inline struct LDKCOption_BlockHashZ C2Tuple_TxidCOption_BlockHashZZ_get_b(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR owner){
4666         return COption_BlockHashZ_clone(&owner->b);
4667 }
4668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4669         LDKC2Tuple_TxidCOption_BlockHashZZ* owner_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(owner);
4670         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
4671         *ret_copy = C2Tuple_TxidCOption_BlockHashZZ_get_b(owner_conv);
4672         int64_t ret_ref = tag_ptr(ret_copy, true);
4673         return ret_ref;
4674 }
4675
4676 static inline LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ CVec_C2Tuple_TxidCOption_BlockHashZZZ_clone(const LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ *orig) {
4677         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ clone bytes"), .datalen = orig->datalen };
4678         for (size_t i = 0; i < ret.datalen; i++) {
4679                 ret.data[i] = C2Tuple_TxidCOption_BlockHashZZ_clone(&orig->data[i]);
4680         }
4681         return ret;
4682 }
4683 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
4684 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
4685 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
4686 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
4687 static jclass LDKMonitorEvent_Completed_class = NULL;
4688 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
4689 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
4690 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
4691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
4692         LDKMonitorEvent_HTLCEvent_class =
4693                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
4694         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
4695         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
4696         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
4697         LDKMonitorEvent_CommitmentTxConfirmed_class =
4698                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
4699         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
4700         LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
4701         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
4702         LDKMonitorEvent_Completed_class =
4703                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
4704         CHECK(LDKMonitorEvent_Completed_class != NULL);
4705         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJ)V");
4706         CHECK(LDKMonitorEvent_Completed_meth != NULL);
4707         LDKMonitorEvent_UpdateFailed_class =
4708                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
4709         CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
4710         LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
4711         CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
4712 }
4713 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4714         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
4715         switch(obj->tag) {
4716                 case LDKMonitorEvent_HTLCEvent: {
4717                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
4718                         int64_t htlc_event_ref = 0;
4719                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
4720                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
4721                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
4722                 }
4723                 case LDKMonitorEvent_CommitmentTxConfirmed: {
4724                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
4725                         int64_t commitment_tx_confirmed_ref = 0;
4726                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
4727                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
4728                         return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
4729                 }
4730                 case LDKMonitorEvent_Completed: {
4731                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
4732                         int64_t funding_txo_ref = 0;
4733                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4734                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
4735                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
4736                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, monitor_update_id_conv);
4737                 }
4738                 case LDKMonitorEvent_UpdateFailed: {
4739                         LDKOutPoint update_failed_var = obj->update_failed;
4740                         int64_t update_failed_ref = 0;
4741                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
4742                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
4743                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
4744                 }
4745                 default: abort();
4746         }
4747 }
4748 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
4749         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
4750         for (size_t i = 0; i < ret.datalen; i++) {
4751                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
4752         }
4753         return ret;
4754 }
4755 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4756         LDKOutPoint ret = owner->a;
4757         ret.is_owned = false;
4758         return ret;
4759 }
4760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4761         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4762         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
4763         int64_t ret_ref = 0;
4764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4766         return ret_ref;
4767 }
4768
4769 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4770         return CVec_MonitorEventZ_clone(&owner->b);
4771 }
4772 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4773         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4774         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
4775         int64_tArray ret_arr = NULL;
4776         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4777         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4778         for (size_t o = 0; o < ret_var.datalen; o++) {
4779                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
4780                 *ret_conv_14_copy = ret_var.data[o];
4781                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
4782                 ret_arr_ptr[o] = ret_conv_14_ref;
4783         }
4784         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4785         FREE(ret_var.data);
4786         return ret_arr;
4787 }
4788
4789 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4790         return owner->c;
4791 }
4792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
4793         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4794         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4795         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
4796         return ret_arr;
4797 }
4798
4799 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
4800         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
4801         for (size_t i = 0; i < ret.datalen; i++) {
4802                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
4803         }
4804         return ret;
4805 }
4806 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4807         LDKInitFeatures ret = *owner->contents.result;
4808         ret.is_owned = false;
4809         return ret;
4810 }
4811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4812         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4813         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
4814         int64_t ret_ref = 0;
4815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4817         return ret_ref;
4818 }
4819
4820 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4821 CHECK(!owner->result_ok);
4822         return DecodeError_clone(&*owner->contents.err);
4823 }
4824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4825         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4826         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4827         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
4828         int64_t ret_ref = tag_ptr(ret_copy, true);
4829         return ret_ref;
4830 }
4831
4832 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4833         LDKChannelFeatures ret = *owner->contents.result;
4834         ret.is_owned = false;
4835         return ret;
4836 }
4837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4838         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4839         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
4840         int64_t ret_ref = 0;
4841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4843         return ret_ref;
4844 }
4845
4846 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4847 CHECK(!owner->result_ok);
4848         return DecodeError_clone(&*owner->contents.err);
4849 }
4850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4851         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4852         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4853         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
4854         int64_t ret_ref = tag_ptr(ret_copy, true);
4855         return ret_ref;
4856 }
4857
4858 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4859         LDKNodeFeatures ret = *owner->contents.result;
4860         ret.is_owned = false;
4861         return ret;
4862 }
4863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4864         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4865         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
4866         int64_t ret_ref = 0;
4867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4869         return ret_ref;
4870 }
4871
4872 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4873 CHECK(!owner->result_ok);
4874         return DecodeError_clone(&*owner->contents.err);
4875 }
4876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4877         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4878         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4879         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
4880         int64_t ret_ref = tag_ptr(ret_copy, true);
4881         return ret_ref;
4882 }
4883
4884 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4885         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
4886         ret.is_owned = false;
4887         return ret;
4888 }
4889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4890         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4891         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4892         int64_t ret_ref = 0;
4893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4895         return ret_ref;
4896 }
4897
4898 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4899 CHECK(!owner->result_ok);
4900         return DecodeError_clone(&*owner->contents.err);
4901 }
4902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4903         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4904         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4905         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4906         int64_t ret_ref = tag_ptr(ret_copy, true);
4907         return ret_ref;
4908 }
4909
4910 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4911         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
4912         ret.is_owned = false;
4913         return ret;
4914 }
4915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4916         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4917         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4918         int64_t ret_ref = 0;
4919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4921         return ret_ref;
4922 }
4923
4924 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4925 CHECK(!owner->result_ok);
4926         return DecodeError_clone(&*owner->contents.err);
4927 }
4928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4929         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4930         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4931         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4932         int64_t ret_ref = tag_ptr(ret_copy, true);
4933         return ret_ref;
4934 }
4935
4936 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4937         LDKBlindedHopFeatures ret = *owner->contents.result;
4938         ret.is_owned = false;
4939         return ret;
4940 }
4941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4942         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4943         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
4944         int64_t ret_ref = 0;
4945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4947         return ret_ref;
4948 }
4949
4950 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4951 CHECK(!owner->result_ok);
4952         return DecodeError_clone(&*owner->contents.err);
4953 }
4954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4955         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4956         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4957         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
4958         int64_t ret_ref = tag_ptr(ret_copy, true);
4959         return ret_ref;
4960 }
4961
4962 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4963         LDKChannelTypeFeatures ret = *owner->contents.result;
4964         ret.is_owned = false;
4965         return ret;
4966 }
4967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4968         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4969         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
4970         int64_t ret_ref = 0;
4971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4973         return ret_ref;
4974 }
4975
4976 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4977 CHECK(!owner->result_ok);
4978         return DecodeError_clone(&*owner->contents.err);
4979 }
4980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4981         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4982         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4983         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
4984         int64_t ret_ref = tag_ptr(ret_copy, true);
4985         return ret_ref;
4986 }
4987
4988 static inline LDKCVec_ChainHashZ CVec_ChainHashZ_clone(const LDKCVec_ChainHashZ *orig) {
4989         LDKCVec_ChainHashZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ChainHashZ clone bytes"), .datalen = orig->datalen };
4990         for (size_t i = 0; i < ret.datalen; i++) {
4991                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4992         }
4993         return ret;
4994 }
4995 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
4996         LDKOffer ret = *owner->contents.result;
4997         ret.is_owned = false;
4998         return ret;
4999 }
5000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5001         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5002         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5003         int64_t ret_ref = 0;
5004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5006         return ret_ref;
5007 }
5008
5009 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5010         LDKBolt12ParseError ret = *owner->contents.err;
5011         ret.is_owned = false;
5012         return ret;
5013 }
5014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5015         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5016         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5017         int64_t ret_ref = 0;
5018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5020         return ret_ref;
5021 }
5022
5023 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5024 CHECK(owner->result_ok);
5025         return *owner->contents.result;
5026 }
5027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5028         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5029         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5030         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
5031         return ret_arr;
5032 }
5033
5034 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5035 CHECK(!owner->result_ok);
5036         return *owner->contents.err;
5037 }
5038 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5039         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5040         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
5041         return ret_conv;
5042 }
5043
5044 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5045         LDKNodeId ret = *owner->contents.result;
5046         ret.is_owned = false;
5047         return ret;
5048 }
5049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5050         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5051         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5052         int64_t ret_ref = 0;
5053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5055         return ret_ref;
5056 }
5057
5058 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5059 CHECK(!owner->result_ok);
5060         return DecodeError_clone(&*owner->contents.err);
5061 }
5062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5063         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5064         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5065         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5066         int64_t ret_ref = tag_ptr(ret_copy, true);
5067         return ret_ref;
5068 }
5069
5070 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
5071 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
5072 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
5073 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
5074 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
5075 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
5076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
5077         LDKNetworkUpdate_ChannelUpdateMessage_class =
5078                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
5079         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
5080         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
5081         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
5082         LDKNetworkUpdate_ChannelFailure_class =
5083                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
5084         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
5085         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
5086         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
5087         LDKNetworkUpdate_NodeFailure_class =
5088                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
5089         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
5090         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
5091         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
5092 }
5093 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5094         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
5095         switch(obj->tag) {
5096                 case LDKNetworkUpdate_ChannelUpdateMessage: {
5097                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
5098                         int64_t msg_ref = 0;
5099                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5100                         msg_ref = tag_ptr(msg_var.inner, false);
5101                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
5102                 }
5103                 case LDKNetworkUpdate_ChannelFailure: {
5104                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
5105                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
5106                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
5107                 }
5108                 case LDKNetworkUpdate_NodeFailure: {
5109                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5110                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
5111                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
5112                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
5113                 }
5114                 default: abort();
5115         }
5116 }
5117 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
5118 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
5119 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
5120 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
5121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
5122         LDKCOption_NetworkUpdateZ_Some_class =
5123                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
5124         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
5125         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
5126         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
5127         LDKCOption_NetworkUpdateZ_None_class =
5128                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
5129         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
5130         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
5131         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
5132 }
5133 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5134         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
5135         switch(obj->tag) {
5136                 case LDKCOption_NetworkUpdateZ_Some: {
5137                         int64_t some_ref = tag_ptr(&obj->some, false);
5138                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
5139                 }
5140                 case LDKCOption_NetworkUpdateZ_None: {
5141                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
5142                 }
5143                 default: abort();
5144         }
5145 }
5146 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5147 CHECK(owner->result_ok);
5148         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5149 }
5150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5151         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5152         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5153         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5154         int64_t ret_ref = tag_ptr(ret_copy, true);
5155         return ret_ref;
5156 }
5157
5158 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5159 CHECK(!owner->result_ok);
5160         return DecodeError_clone(&*owner->contents.err);
5161 }
5162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5163         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5164         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5165         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5166         int64_t ret_ref = tag_ptr(ret_copy, true);
5167         return ret_ref;
5168 }
5169
5170 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5171 CHECK(owner->result_ok);
5172         return TxOut_clone(&*owner->contents.result);
5173 }
5174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5175         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5176         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5177         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5178         return tag_ptr(ret_ref, true);
5179 }
5180
5181 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5182 CHECK(!owner->result_ok);
5183         return UtxoLookupError_clone(&*owner->contents.err);
5184 }
5185 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5186         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5187         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5188         return ret_conv;
5189 }
5190
5191 static jclass LDKUtxoResult_Sync_class = NULL;
5192 static jmethodID LDKUtxoResult_Sync_meth = NULL;
5193 static jclass LDKUtxoResult_Async_class = NULL;
5194 static jmethodID LDKUtxoResult_Async_meth = NULL;
5195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
5196         LDKUtxoResult_Sync_class =
5197                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
5198         CHECK(LDKUtxoResult_Sync_class != NULL);
5199         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
5200         CHECK(LDKUtxoResult_Sync_meth != NULL);
5201         LDKUtxoResult_Async_class =
5202                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
5203         CHECK(LDKUtxoResult_Async_class != NULL);
5204         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
5205         CHECK(LDKUtxoResult_Async_meth != NULL);
5206 }
5207 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5208         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5209         switch(obj->tag) {
5210                 case LDKUtxoResult_Sync: {
5211                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5212                         *sync_conv = obj->sync;
5213                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5214                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
5215                 }
5216                 case LDKUtxoResult_Async: {
5217                         LDKUtxoFuture async_var = obj->async;
5218                         int64_t async_ref = 0;
5219                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5220                         async_ref = tag_ptr(async_var.inner, false);
5221                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
5222                 }
5223                 default: abort();
5224         }
5225 }
5226 typedef struct LDKUtxoLookup_JCalls {
5227         atomic_size_t refcnt;
5228         JavaVM *vm;
5229         jweak o;
5230         jmethodID get_utxo_meth;
5231 } LDKUtxoLookup_JCalls;
5232 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5233         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5234         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5235                 JNIEnv *env;
5236                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5237                 if (get_jenv_res == JNI_EDETACHED) {
5238                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5239                 } else {
5240                         DO_ASSERT(get_jenv_res == JNI_OK);
5241                 }
5242                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5243                 if (get_jenv_res == JNI_EDETACHED) {
5244                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5245                 }
5246                 FREE(j_calls);
5247         }
5248 }
5249 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
5250         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5251         JNIEnv *env;
5252         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5253         if (get_jenv_res == JNI_EDETACHED) {
5254                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5255         } else {
5256                 DO_ASSERT(get_jenv_res == JNI_OK);
5257         }
5258         int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
5259         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
5260         int64_t short_channel_id_conv = short_channel_id;
5261         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5262         CHECK(obj != NULL);
5263         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
5264         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5265                 (*env)->ExceptionDescribe(env);
5266                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
5267         }
5268         void* ret_ptr = untag_ptr(ret);
5269         CHECK_ACCESS(ret_ptr);
5270         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5271         FREE(untag_ptr(ret));
5272         if (get_jenv_res == JNI_EDETACHED) {
5273                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5274         }
5275         return ret_conv;
5276 }
5277 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5278         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5279         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5280 }
5281 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
5282         jclass c = (*env)->GetObjectClass(env, o);
5283         CHECK(c != NULL);
5284         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5285         atomic_init(&calls->refcnt, 1);
5286         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5287         calls->o = (*env)->NewWeakGlobalRef(env, o);
5288         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5289         CHECK(calls->get_utxo_meth != NULL);
5290
5291         LDKUtxoLookup ret = {
5292                 .this_arg = (void*) calls,
5293                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5294                 .free = LDKUtxoLookup_JCalls_free,
5295         };
5296         return ret;
5297 }
5298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
5299         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5300         *res_ptr = LDKUtxoLookup_init(env, clz, o);
5301         return tag_ptr(res_ptr, true);
5302 }
5303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
5304         void* this_arg_ptr = untag_ptr(this_arg);
5305         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5306         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5307         uint8_t genesis_hash_arr[32];
5308         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
5309         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
5310         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
5311         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5312         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
5313         int64_t ret_ref = tag_ptr(ret_copy, true);
5314         return ret_ref;
5315 }
5316
5317 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
5318 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
5319 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
5320 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
5321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
5322         LDKCOption_UtxoLookupZ_Some_class =
5323                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
5324         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
5325         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
5326         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
5327         LDKCOption_UtxoLookupZ_None_class =
5328                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
5329         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
5330         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
5331         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
5332 }
5333 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5334         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5335         switch(obj->tag) {
5336                 case LDKCOption_UtxoLookupZ_Some: {
5337                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5338                         *some_ret = obj->some;
5339                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5340                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5341                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5342                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5343                         }
5344                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
5345                 }
5346                 case LDKCOption_UtxoLookupZ_None: {
5347                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
5348                 }
5349                 default: abort();
5350         }
5351 }
5352 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5353 CHECK(owner->result_ok);
5354         return *owner->contents.result;
5355 }
5356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5357         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5358         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5359 }
5360
5361 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5362         LDKLightningError ret = *owner->contents.err;
5363         ret.is_owned = false;
5364         return ret;
5365 }
5366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5367         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5368         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5369         int64_t ret_ref = 0;
5370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5372         return ret_ref;
5373 }
5374
5375 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5376 CHECK(owner->result_ok);
5377         return *owner->contents.result;
5378 }
5379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5380         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5381         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5382         return ret_conv;
5383 }
5384
5385 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5386         LDKLightningError ret = *owner->contents.err;
5387         ret.is_owned = false;
5388         return ret;
5389 }
5390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5391         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5392         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5393         int64_t ret_ref = 0;
5394         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5395         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5396         return ret_ref;
5397 }
5398
5399 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5400         LDKChannelAnnouncement ret = owner->a;
5401         ret.is_owned = false;
5402         return ret;
5403 }
5404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5405         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5406         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5407         int64_t ret_ref = 0;
5408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5410         return ret_ref;
5411 }
5412
5413 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5414         LDKChannelUpdate ret = owner->b;
5415         ret.is_owned = false;
5416         return ret;
5417 }
5418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5419         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5420         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5421         int64_t ret_ref = 0;
5422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5424         return ret_ref;
5425 }
5426
5427 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5428         LDKChannelUpdate ret = owner->c;
5429         ret.is_owned = false;
5430         return ret;
5431 }
5432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5433         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5434         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5435         int64_t ret_ref = 0;
5436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5438         return ret_ref;
5439 }
5440
5441 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
5442 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
5443 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
5444 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
5445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
5446         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
5447                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
5448         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
5449         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
5450         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
5451         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
5452                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
5453         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
5454         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
5455         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
5456 }
5457 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5458         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5459         switch(obj->tag) {
5460                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
5461                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5462                         *some_conv = obj->some;
5463                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
5464                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
5465                 }
5466                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
5467                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
5468                 }
5469                 default: abort();
5470         }
5471 }
5472 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
5473 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
5474 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
5475 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
5476 static jclass LDKErrorAction_IgnoreError_class = NULL;
5477 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
5478 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
5479 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
5480 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
5481 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
5482 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
5483 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
5484 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
5485 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
5486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
5487         LDKErrorAction_DisconnectPeer_class =
5488                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
5489         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
5490         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
5491         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
5492         LDKErrorAction_DisconnectPeerWithWarning_class =
5493                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
5494         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
5495         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
5496         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
5497         LDKErrorAction_IgnoreError_class =
5498                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
5499         CHECK(LDKErrorAction_IgnoreError_class != NULL);
5500         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
5501         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
5502         LDKErrorAction_IgnoreAndLog_class =
5503                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
5504         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
5505         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
5506         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
5507         LDKErrorAction_IgnoreDuplicateGossip_class =
5508                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
5509         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
5510         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
5511         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
5512         LDKErrorAction_SendErrorMessage_class =
5513                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
5514         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
5515         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
5516         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
5517         LDKErrorAction_SendWarningMessage_class =
5518                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
5519         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
5520         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
5521         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
5522 }
5523 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5524         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
5525         switch(obj->tag) {
5526                 case LDKErrorAction_DisconnectPeer: {
5527                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
5528                         int64_t msg_ref = 0;
5529                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5530                         msg_ref = tag_ptr(msg_var.inner, false);
5531                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
5532                 }
5533                 case LDKErrorAction_DisconnectPeerWithWarning: {
5534                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
5535                         int64_t msg_ref = 0;
5536                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5537                         msg_ref = tag_ptr(msg_var.inner, false);
5538                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
5539                 }
5540                 case LDKErrorAction_IgnoreError: {
5541                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
5542                 }
5543                 case LDKErrorAction_IgnoreAndLog: {
5544                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
5545                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
5546                 }
5547                 case LDKErrorAction_IgnoreDuplicateGossip: {
5548                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
5549                 }
5550                 case LDKErrorAction_SendErrorMessage: {
5551                         LDKErrorMessage msg_var = obj->send_error_message.msg;
5552                         int64_t msg_ref = 0;
5553                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5554                         msg_ref = tag_ptr(msg_var.inner, false);
5555                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
5556                 }
5557                 case LDKErrorAction_SendWarningMessage: {
5558                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
5559                         int64_t msg_ref = 0;
5560                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5561                         msg_ref = tag_ptr(msg_var.inner, false);
5562                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
5563                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
5564                 }
5565                 default: abort();
5566         }
5567 }
5568 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
5569 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
5570 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
5571 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
5572 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
5573 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
5574 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
5575 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
5576 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
5577 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
5578 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
5579 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
5580 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
5581 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
5582 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
5583 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
5584 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
5585 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
5586 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
5587 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
5588 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
5589 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
5590 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
5591 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
5592 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
5593 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
5594 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
5595 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
5596 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
5597 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
5598 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
5599 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
5600 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
5601 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
5602 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
5603 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
5604 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
5605 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
5606 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
5607 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
5608 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
5609 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
5610 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
5611 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
5612 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
5613 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
5614 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
5615 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
5616 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
5617 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
5618 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
5619 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
5620 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
5621 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
5622 static jclass LDKMessageSendEvent_HandleError_class = NULL;
5623 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
5624 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
5625 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
5626 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
5627 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
5628 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
5629 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
5630 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
5631 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
5632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
5633         LDKMessageSendEvent_SendAcceptChannel_class =
5634                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
5635         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
5636         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
5637         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
5638         LDKMessageSendEvent_SendAcceptChannelV2_class =
5639                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
5640         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
5641         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
5642         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
5643         LDKMessageSendEvent_SendOpenChannel_class =
5644                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
5645         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
5646         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
5647         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
5648         LDKMessageSendEvent_SendOpenChannelV2_class =
5649                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
5650         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
5651         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
5652         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
5653         LDKMessageSendEvent_SendFundingCreated_class =
5654                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
5655         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
5656         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
5657         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
5658         LDKMessageSendEvent_SendFundingSigned_class =
5659                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
5660         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
5661         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
5662         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
5663         LDKMessageSendEvent_SendTxAddInput_class =
5664                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
5665         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
5666         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
5667         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
5668         LDKMessageSendEvent_SendTxAddOutput_class =
5669                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
5670         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
5671         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
5672         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
5673         LDKMessageSendEvent_SendTxRemoveInput_class =
5674                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
5675         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
5676         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
5677         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
5678         LDKMessageSendEvent_SendTxRemoveOutput_class =
5679                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
5680         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
5681         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
5682         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
5683         LDKMessageSendEvent_SendTxComplete_class =
5684                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
5685         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
5686         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
5687         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
5688         LDKMessageSendEvent_SendTxSignatures_class =
5689                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
5690         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
5691         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
5692         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
5693         LDKMessageSendEvent_SendTxInitRbf_class =
5694                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
5695         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
5696         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
5697         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
5698         LDKMessageSendEvent_SendTxAckRbf_class =
5699                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
5700         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
5701         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
5702         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
5703         LDKMessageSendEvent_SendTxAbort_class =
5704                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
5705         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
5706         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
5707         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
5708         LDKMessageSendEvent_SendChannelReady_class =
5709                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
5710         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
5711         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
5712         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
5713         LDKMessageSendEvent_SendAnnouncementSignatures_class =
5714                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
5715         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
5716         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
5717         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
5718         LDKMessageSendEvent_UpdateHTLCs_class =
5719                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
5720         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
5721         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
5722         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
5723         LDKMessageSendEvent_SendRevokeAndACK_class =
5724                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
5725         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
5726         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
5727         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
5728         LDKMessageSendEvent_SendClosingSigned_class =
5729                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
5730         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
5731         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
5732         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
5733         LDKMessageSendEvent_SendShutdown_class =
5734                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
5735         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
5736         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
5737         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
5738         LDKMessageSendEvent_SendChannelReestablish_class =
5739                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
5740         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
5741         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
5742         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
5743         LDKMessageSendEvent_SendChannelAnnouncement_class =
5744                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
5745         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
5746         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
5747         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
5748         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
5749                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
5750         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
5751         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
5752         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
5753         LDKMessageSendEvent_BroadcastChannelUpdate_class =
5754                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
5755         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
5756         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
5757         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
5758         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
5759                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
5760         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
5761         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
5762         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
5763         LDKMessageSendEvent_SendChannelUpdate_class =
5764                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
5765         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
5766         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
5767         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
5768         LDKMessageSendEvent_HandleError_class =
5769                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
5770         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
5771         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
5772         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
5773         LDKMessageSendEvent_SendChannelRangeQuery_class =
5774                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
5775         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
5776         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
5777         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
5778         LDKMessageSendEvent_SendShortIdsQuery_class =
5779                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
5780         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
5781         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
5782         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
5783         LDKMessageSendEvent_SendReplyChannelRange_class =
5784                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
5785         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
5786         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
5787         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
5788         LDKMessageSendEvent_SendGossipTimestampFilter_class =
5789                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
5790         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
5791         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
5792         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
5793 }
5794 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5795         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5796         switch(obj->tag) {
5797                 case LDKMessageSendEvent_SendAcceptChannel: {
5798                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5799                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
5800                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
5801                         int64_t msg_ref = 0;
5802                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5803                         msg_ref = tag_ptr(msg_var.inner, false);
5804                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
5805                 }
5806                 case LDKMessageSendEvent_SendAcceptChannelV2: {
5807                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5808                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
5809                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
5810                         int64_t msg_ref = 0;
5811                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5812                         msg_ref = tag_ptr(msg_var.inner, false);
5813                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
5814                 }
5815                 case LDKMessageSendEvent_SendOpenChannel: {
5816                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5817                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
5818                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
5819                         int64_t msg_ref = 0;
5820                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5821                         msg_ref = tag_ptr(msg_var.inner, false);
5822                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
5823                 }
5824                 case LDKMessageSendEvent_SendOpenChannelV2: {
5825                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5826                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
5827                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
5828                         int64_t msg_ref = 0;
5829                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5830                         msg_ref = tag_ptr(msg_var.inner, false);
5831                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
5832                 }
5833                 case LDKMessageSendEvent_SendFundingCreated: {
5834                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5835                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
5836                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
5837                         int64_t msg_ref = 0;
5838                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5839                         msg_ref = tag_ptr(msg_var.inner, false);
5840                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
5841                 }
5842                 case LDKMessageSendEvent_SendFundingSigned: {
5843                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5844                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
5845                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
5846                         int64_t msg_ref = 0;
5847                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5848                         msg_ref = tag_ptr(msg_var.inner, false);
5849                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
5850                 }
5851                 case LDKMessageSendEvent_SendTxAddInput: {
5852                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5853                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
5854                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
5855                         int64_t msg_ref = 0;
5856                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5857                         msg_ref = tag_ptr(msg_var.inner, false);
5858                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
5859                 }
5860                 case LDKMessageSendEvent_SendTxAddOutput: {
5861                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5862                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
5863                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
5864                         int64_t msg_ref = 0;
5865                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5866                         msg_ref = tag_ptr(msg_var.inner, false);
5867                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
5868                 }
5869                 case LDKMessageSendEvent_SendTxRemoveInput: {
5870                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5871                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
5872                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
5873                         int64_t msg_ref = 0;
5874                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5875                         msg_ref = tag_ptr(msg_var.inner, false);
5876                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
5877                 }
5878                 case LDKMessageSendEvent_SendTxRemoveOutput: {
5879                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5880                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
5881                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
5882                         int64_t msg_ref = 0;
5883                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5884                         msg_ref = tag_ptr(msg_var.inner, false);
5885                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
5886                 }
5887                 case LDKMessageSendEvent_SendTxComplete: {
5888                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5889                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
5890                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
5891                         int64_t msg_ref = 0;
5892                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5893                         msg_ref = tag_ptr(msg_var.inner, false);
5894                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
5895                 }
5896                 case LDKMessageSendEvent_SendTxSignatures: {
5897                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5898                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
5899                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
5900                         int64_t msg_ref = 0;
5901                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5902                         msg_ref = tag_ptr(msg_var.inner, false);
5903                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
5904                 }
5905                 case LDKMessageSendEvent_SendTxInitRbf: {
5906                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5907                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
5908                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
5909                         int64_t msg_ref = 0;
5910                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5911                         msg_ref = tag_ptr(msg_var.inner, false);
5912                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
5913                 }
5914                 case LDKMessageSendEvent_SendTxAckRbf: {
5915                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5916                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
5917                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
5918                         int64_t msg_ref = 0;
5919                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5920                         msg_ref = tag_ptr(msg_var.inner, false);
5921                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
5922                 }
5923                 case LDKMessageSendEvent_SendTxAbort: {
5924                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5925                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
5926                         LDKTxAddInput msg_var = obj->send_tx_abort.msg;
5927                         int64_t msg_ref = 0;
5928                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5929                         msg_ref = tag_ptr(msg_var.inner, false);
5930                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
5931                 }
5932                 case LDKMessageSendEvent_SendChannelReady: {
5933                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5934                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
5935                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
5936                         int64_t msg_ref = 0;
5937                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5938                         msg_ref = tag_ptr(msg_var.inner, false);
5939                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
5940                 }
5941                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
5942                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5943                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
5944                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
5945                         int64_t msg_ref = 0;
5946                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5947                         msg_ref = tag_ptr(msg_var.inner, false);
5948                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
5949                 }
5950                 case LDKMessageSendEvent_UpdateHTLCs: {
5951                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5952                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
5953                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
5954                         int64_t updates_ref = 0;
5955                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
5956                         updates_ref = tag_ptr(updates_var.inner, false);
5957                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
5958                 }
5959                 case LDKMessageSendEvent_SendRevokeAndACK: {
5960                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5961                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
5962                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
5963                         int64_t msg_ref = 0;
5964                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5965                         msg_ref = tag_ptr(msg_var.inner, false);
5966                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
5967                 }
5968                 case LDKMessageSendEvent_SendClosingSigned: {
5969                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5970                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
5971                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
5972                         int64_t msg_ref = 0;
5973                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5974                         msg_ref = tag_ptr(msg_var.inner, false);
5975                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
5976                 }
5977                 case LDKMessageSendEvent_SendShutdown: {
5978                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5979                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
5980                         LDKShutdown msg_var = obj->send_shutdown.msg;
5981                         int64_t msg_ref = 0;
5982                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5983                         msg_ref = tag_ptr(msg_var.inner, false);
5984                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
5985                 }
5986                 case LDKMessageSendEvent_SendChannelReestablish: {
5987                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5988                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
5989                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
5990                         int64_t msg_ref = 0;
5991                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5992                         msg_ref = tag_ptr(msg_var.inner, false);
5993                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
5994                 }
5995                 case LDKMessageSendEvent_SendChannelAnnouncement: {
5996                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5997                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
5998                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
5999                         int64_t msg_ref = 0;
6000                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6001                         msg_ref = tag_ptr(msg_var.inner, false);
6002                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
6003                         int64_t update_msg_ref = 0;
6004                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6005                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6006                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
6007                 }
6008                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
6009                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
6010                         int64_t msg_ref = 0;
6011                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6012                         msg_ref = tag_ptr(msg_var.inner, false);
6013                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
6014                         int64_t update_msg_ref = 0;
6015                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6016                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6017                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
6018                 }
6019                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
6020                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
6021                         int64_t msg_ref = 0;
6022                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6023                         msg_ref = tag_ptr(msg_var.inner, false);
6024                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
6025                 }
6026                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
6027                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
6028                         int64_t msg_ref = 0;
6029                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6030                         msg_ref = tag_ptr(msg_var.inner, false);
6031                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
6032                 }
6033                 case LDKMessageSendEvent_SendChannelUpdate: {
6034                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6035                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
6036                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
6037                         int64_t msg_ref = 0;
6038                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6039                         msg_ref = tag_ptr(msg_var.inner, false);
6040                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
6041                 }
6042                 case LDKMessageSendEvent_HandleError: {
6043                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6044                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
6045                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
6046                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
6047                 }
6048                 case LDKMessageSendEvent_SendChannelRangeQuery: {
6049                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6050                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
6051                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
6052                         int64_t msg_ref = 0;
6053                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6054                         msg_ref = tag_ptr(msg_var.inner, false);
6055                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
6056                 }
6057                 case LDKMessageSendEvent_SendShortIdsQuery: {
6058                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6059                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
6060                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
6061                         int64_t msg_ref = 0;
6062                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6063                         msg_ref = tag_ptr(msg_var.inner, false);
6064                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
6065                 }
6066                 case LDKMessageSendEvent_SendReplyChannelRange: {
6067                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6068                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
6069                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
6070                         int64_t msg_ref = 0;
6071                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6072                         msg_ref = tag_ptr(msg_var.inner, false);
6073                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
6074                 }
6075                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
6076                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6077                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
6078                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
6079                         int64_t msg_ref = 0;
6080                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6081                         msg_ref = tag_ptr(msg_var.inner, false);
6082                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
6083                 }
6084                 default: abort();
6085         }
6086 }
6087 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
6088         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
6089         for (size_t i = 0; i < ret.datalen; i++) {
6090                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
6091         }
6092         return ret;
6093 }
6094 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6095         LDKChannelUpdateInfo ret = *owner->contents.result;
6096         ret.is_owned = false;
6097         return ret;
6098 }
6099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6100         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6101         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6102         int64_t ret_ref = 0;
6103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6105         return ret_ref;
6106 }
6107
6108 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6109 CHECK(!owner->result_ok);
6110         return DecodeError_clone(&*owner->contents.err);
6111 }
6112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6113         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6114         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6115         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6116         int64_t ret_ref = tag_ptr(ret_copy, true);
6117         return ret_ref;
6118 }
6119
6120 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6121         LDKChannelInfo ret = *owner->contents.result;
6122         ret.is_owned = false;
6123         return ret;
6124 }
6125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6126         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6127         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6128         int64_t ret_ref = 0;
6129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6131         return ret_ref;
6132 }
6133
6134 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6135 CHECK(!owner->result_ok);
6136         return DecodeError_clone(&*owner->contents.err);
6137 }
6138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6139         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6140         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6141         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6142         int64_t ret_ref = tag_ptr(ret_copy, true);
6143         return ret_ref;
6144 }
6145
6146 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6147         LDKRoutingFees ret = *owner->contents.result;
6148         ret.is_owned = false;
6149         return ret;
6150 }
6151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6152         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6153         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6154         int64_t ret_ref = 0;
6155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6157         return ret_ref;
6158 }
6159
6160 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6161 CHECK(!owner->result_ok);
6162         return DecodeError_clone(&*owner->contents.err);
6163 }
6164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6165         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6166         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6167         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6168         int64_t ret_ref = tag_ptr(ret_copy, true);
6169         return ret_ref;
6170 }
6171
6172 static jclass LDKNetAddress_IPv4_class = NULL;
6173 static jmethodID LDKNetAddress_IPv4_meth = NULL;
6174 static jclass LDKNetAddress_IPv6_class = NULL;
6175 static jmethodID LDKNetAddress_IPv6_meth = NULL;
6176 static jclass LDKNetAddress_OnionV2_class = NULL;
6177 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
6178 static jclass LDKNetAddress_OnionV3_class = NULL;
6179 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
6180 static jclass LDKNetAddress_Hostname_class = NULL;
6181 static jmethodID LDKNetAddress_Hostname_meth = NULL;
6182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
6183         LDKNetAddress_IPv4_class =
6184                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
6185         CHECK(LDKNetAddress_IPv4_class != NULL);
6186         LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
6187         CHECK(LDKNetAddress_IPv4_meth != NULL);
6188         LDKNetAddress_IPv6_class =
6189                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
6190         CHECK(LDKNetAddress_IPv6_class != NULL);
6191         LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
6192         CHECK(LDKNetAddress_IPv6_meth != NULL);
6193         LDKNetAddress_OnionV2_class =
6194                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
6195         CHECK(LDKNetAddress_OnionV2_class != NULL);
6196         LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
6197         CHECK(LDKNetAddress_OnionV2_meth != NULL);
6198         LDKNetAddress_OnionV3_class =
6199                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
6200         CHECK(LDKNetAddress_OnionV3_class != NULL);
6201         LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
6202         CHECK(LDKNetAddress_OnionV3_meth != NULL);
6203         LDKNetAddress_Hostname_class =
6204                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname"));
6205         CHECK(LDKNetAddress_Hostname_class != NULL);
6206         LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "<init>", "(JS)V");
6207         CHECK(LDKNetAddress_Hostname_meth != NULL);
6208 }
6209 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6210         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
6211         switch(obj->tag) {
6212                 case LDKNetAddress_IPv4: {
6213                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
6214                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
6215                         int16_t port_conv = obj->i_pv4.port;
6216                         return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
6217                 }
6218                 case LDKNetAddress_IPv6: {
6219                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
6220                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
6221                         int16_t port_conv = obj->i_pv6.port;
6222                         return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
6223                 }
6224                 case LDKNetAddress_OnionV2: {
6225                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
6226                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
6227                         return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
6228                 }
6229                 case LDKNetAddress_OnionV3: {
6230                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
6231                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
6232                         int16_t checksum_conv = obj->onion_v3.checksum;
6233                         int8_t version_conv = obj->onion_v3.version;
6234                         int16_t port_conv = obj->onion_v3.port;
6235                         return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
6236                 }
6237                 case LDKNetAddress_Hostname: {
6238                         LDKHostname hostname_var = obj->hostname.hostname;
6239                         int64_t hostname_ref = 0;
6240                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
6241                         hostname_ref = tag_ptr(hostname_var.inner, false);
6242                         int16_t port_conv = obj->hostname.port;
6243                         return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv);
6244                 }
6245                 default: abort();
6246         }
6247 }
6248 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
6249         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
6250         for (size_t i = 0; i < ret.datalen; i++) {
6251                 ret.data[i] = NetAddress_clone(&orig->data[i]);
6252         }
6253         return ret;
6254 }
6255 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6256         LDKNodeAnnouncementInfo ret = *owner->contents.result;
6257         ret.is_owned = false;
6258         return ret;
6259 }
6260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6261         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6262         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6263         int64_t ret_ref = 0;
6264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6266         return ret_ref;
6267 }
6268
6269 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6270 CHECK(!owner->result_ok);
6271         return DecodeError_clone(&*owner->contents.err);
6272 }
6273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6274         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6275         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6276         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6277         int64_t ret_ref = tag_ptr(ret_copy, true);
6278         return ret_ref;
6279 }
6280
6281 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6282         LDKNodeAlias ret = *owner->contents.result;
6283         ret.is_owned = false;
6284         return ret;
6285 }
6286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6287         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6288         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
6289         int64_t ret_ref = 0;
6290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6292         return ret_ref;
6293 }
6294
6295 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6296 CHECK(!owner->result_ok);
6297         return DecodeError_clone(&*owner->contents.err);
6298 }
6299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6300         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6301         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6302         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
6303         int64_t ret_ref = tag_ptr(ret_copy, true);
6304         return ret_ref;
6305 }
6306
6307 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6308         LDKNodeInfo ret = *owner->contents.result;
6309         ret.is_owned = false;
6310         return ret;
6311 }
6312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6313         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6314         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6315         int64_t ret_ref = 0;
6316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6318         return ret_ref;
6319 }
6320
6321 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6322 CHECK(!owner->result_ok);
6323         return DecodeError_clone(&*owner->contents.err);
6324 }
6325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6326         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6327         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6328         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6329         int64_t ret_ref = tag_ptr(ret_copy, true);
6330         return ret_ref;
6331 }
6332
6333 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6334         LDKNetworkGraph ret = *owner->contents.result;
6335         ret.is_owned = false;
6336         return ret;
6337 }
6338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6339         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6340         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6341         int64_t ret_ref = 0;
6342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6344         return ret_ref;
6345 }
6346
6347 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6348 CHECK(!owner->result_ok);
6349         return DecodeError_clone(&*owner->contents.err);
6350 }
6351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6352         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6353         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6354         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6355         int64_t ret_ref = tag_ptr(ret_copy, true);
6356         return ret_ref;
6357 }
6358
6359 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
6360 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
6361 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
6362 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
6363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
6364         LDKCOption_CVec_NetAddressZZ_Some_class =
6365                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
6366         CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
6367         LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
6368         CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
6369         LDKCOption_CVec_NetAddressZZ_None_class =
6370                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
6371         CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
6372         LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
6373         CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
6374 }
6375 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6376         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
6377         switch(obj->tag) {
6378                 case LDKCOption_CVec_NetAddressZZ_Some: {
6379                         LDKCVec_NetAddressZ some_var = obj->some;
6380                         int64_tArray some_arr = NULL;
6381                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
6382                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6383                         for (size_t m = 0; m < some_var.datalen; m++) {
6384                                 int64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
6385                                 some_arr_ptr[m] = some_conv_12_ref;
6386                         }
6387                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6388                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
6389                 }
6390                 case LDKCOption_CVec_NetAddressZZ_None: {
6391                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
6392                 }
6393                 default: abort();
6394         }
6395 }
6396 static jclass LDKCOption_PaymentPreimageZ_Some_class = NULL;
6397 static jmethodID LDKCOption_PaymentPreimageZ_Some_meth = NULL;
6398 static jclass LDKCOption_PaymentPreimageZ_None_class = NULL;
6399 static jmethodID LDKCOption_PaymentPreimageZ_None_meth = NULL;
6400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentPreimageZ_init (JNIEnv *env, jclass clz) {
6401         LDKCOption_PaymentPreimageZ_Some_class =
6402                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentPreimageZ$Some"));
6403         CHECK(LDKCOption_PaymentPreimageZ_Some_class != NULL);
6404         LDKCOption_PaymentPreimageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentPreimageZ_Some_class, "<init>", "([B)V");
6405         CHECK(LDKCOption_PaymentPreimageZ_Some_meth != NULL);
6406         LDKCOption_PaymentPreimageZ_None_class =
6407                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentPreimageZ$None"));
6408         CHECK(LDKCOption_PaymentPreimageZ_None_class != NULL);
6409         LDKCOption_PaymentPreimageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentPreimageZ_None_class, "<init>", "()V");
6410         CHECK(LDKCOption_PaymentPreimageZ_None_meth != NULL);
6411 }
6412 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentPreimageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6413         LDKCOption_PaymentPreimageZ *obj = (LDKCOption_PaymentPreimageZ*)untag_ptr(ptr);
6414         switch(obj->tag) {
6415                 case LDKCOption_PaymentPreimageZ_Some: {
6416                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
6417                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
6418                         return (*env)->NewObject(env, LDKCOption_PaymentPreimageZ_Some_class, LDKCOption_PaymentPreimageZ_Some_meth, some_arr);
6419                 }
6420                 case LDKCOption_PaymentPreimageZ_None: {
6421                         return (*env)->NewObject(env, LDKCOption_PaymentPreimageZ_None_class, LDKCOption_PaymentPreimageZ_None_meth);
6422                 }
6423                 default: abort();
6424         }
6425 }
6426 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
6427         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
6428         for (size_t i = 0; i < ret.datalen; i++) {
6429                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
6430         }
6431         return ret;
6432 }
6433 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
6434         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
6435         for (size_t i = 0; i < ret.datalen; i++) {
6436                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
6437         }
6438         return ret;
6439 }
6440 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
6441         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
6442         for (size_t i = 0; i < ret.datalen; i++) {
6443                 ret.data[i] = Utxo_clone(&orig->data[i]);
6444         }
6445         return ret;
6446 }
6447 static jclass LDKCOption_TxOutZ_Some_class = NULL;
6448 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
6449 static jclass LDKCOption_TxOutZ_None_class = NULL;
6450 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
6451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
6452         LDKCOption_TxOutZ_Some_class =
6453                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
6454         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
6455         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
6456         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
6457         LDKCOption_TxOutZ_None_class =
6458                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
6459         CHECK(LDKCOption_TxOutZ_None_class != NULL);
6460         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
6461         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
6462 }
6463 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6464         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
6465         switch(obj->tag) {
6466                 case LDKCOption_TxOutZ_Some: {
6467                         LDKTxOut* some_ref = &obj->some;
6468                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
6469                 }
6470                 case LDKCOption_TxOutZ_None: {
6471                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
6472                 }
6473                 default: abort();
6474         }
6475 }
6476 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
6477         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
6478         for (size_t i = 0; i < ret.datalen; i++) {
6479                 ret.data[i] = Input_clone(&orig->data[i]);
6480         }
6481         return ret;
6482 }
6483 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6484         LDKCoinSelection ret = *owner->contents.result;
6485         ret.is_owned = false;
6486         return ret;
6487 }
6488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6489         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6490         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
6491         int64_t ret_ref = 0;
6492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6494         return ret_ref;
6495 }
6496
6497 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6498 CHECK(!owner->result_ok);
6499         return *owner->contents.err;
6500 }
6501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6502         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6503         CResult_CoinSelectionNoneZ_get_err(owner_conv);
6504 }
6505
6506 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6507 CHECK(owner->result_ok);
6508         return CVec_UtxoZ_clone(&*owner->contents.result);
6509 }
6510 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6511         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6512         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
6513         int64_tArray ret_arr = NULL;
6514         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6515         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6516         for (size_t g = 0; g < ret_var.datalen; g++) {
6517                 LDKUtxo ret_conv_6_var = ret_var.data[g];
6518                 int64_t ret_conv_6_ref = 0;
6519                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
6520                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
6521                 ret_arr_ptr[g] = ret_conv_6_ref;
6522         }
6523         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6524         FREE(ret_var.data);
6525         return ret_arr;
6526 }
6527
6528 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6529 CHECK(!owner->result_ok);
6530         return *owner->contents.err;
6531 }
6532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6533         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6534         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
6535 }
6536
6537 static jclass LDKCOption_u16Z_Some_class = NULL;
6538 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
6539 static jclass LDKCOption_u16Z_None_class = NULL;
6540 static jmethodID LDKCOption_u16Z_None_meth = NULL;
6541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
6542         LDKCOption_u16Z_Some_class =
6543                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
6544         CHECK(LDKCOption_u16Z_Some_class != NULL);
6545         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
6546         CHECK(LDKCOption_u16Z_Some_meth != NULL);
6547         LDKCOption_u16Z_None_class =
6548                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
6549         CHECK(LDKCOption_u16Z_None_class != NULL);
6550         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
6551         CHECK(LDKCOption_u16Z_None_meth != NULL);
6552 }
6553 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6554         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
6555         switch(obj->tag) {
6556                 case LDKCOption_u16Z_Some: {
6557                         int16_t some_conv = obj->some;
6558                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
6559                 }
6560                 case LDKCOption_u16Z_None: {
6561                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
6562                 }
6563                 default: abort();
6564         }
6565 }
6566 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
6567 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
6568 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
6569 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
6570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
6571         LDKCOption_ChannelShutdownStateZ_Some_class =
6572                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
6573         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
6574         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
6575         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
6576         LDKCOption_ChannelShutdownStateZ_None_class =
6577                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
6578         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
6579         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
6580         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
6581 }
6582 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6583         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
6584         switch(obj->tag) {
6585                 case LDKCOption_ChannelShutdownStateZ_Some: {
6586                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
6587                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
6588                 }
6589                 case LDKCOption_ChannelShutdownStateZ_None: {
6590                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
6591                 }
6592                 default: abort();
6593         }
6594 }
6595 static jclass LDKCOption_PaymentHashZ_Some_class = NULL;
6596 static jmethodID LDKCOption_PaymentHashZ_Some_meth = NULL;
6597 static jclass LDKCOption_PaymentHashZ_None_class = NULL;
6598 static jmethodID LDKCOption_PaymentHashZ_None_meth = NULL;
6599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentHashZ_init (JNIEnv *env, jclass clz) {
6600         LDKCOption_PaymentHashZ_Some_class =
6601                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentHashZ$Some"));
6602         CHECK(LDKCOption_PaymentHashZ_Some_class != NULL);
6603         LDKCOption_PaymentHashZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentHashZ_Some_class, "<init>", "([B)V");
6604         CHECK(LDKCOption_PaymentHashZ_Some_meth != NULL);
6605         LDKCOption_PaymentHashZ_None_class =
6606                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentHashZ$None"));
6607         CHECK(LDKCOption_PaymentHashZ_None_class != NULL);
6608         LDKCOption_PaymentHashZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentHashZ_None_class, "<init>", "()V");
6609         CHECK(LDKCOption_PaymentHashZ_None_meth != NULL);
6610 }
6611 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentHashZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6612         LDKCOption_PaymentHashZ *obj = (LDKCOption_PaymentHashZ*)untag_ptr(ptr);
6613         switch(obj->tag) {
6614                 case LDKCOption_PaymentHashZ_Some: {
6615                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
6616                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
6617                         return (*env)->NewObject(env, LDKCOption_PaymentHashZ_Some_class, LDKCOption_PaymentHashZ_Some_meth, some_arr);
6618                 }
6619                 case LDKCOption_PaymentHashZ_None: {
6620                         return (*env)->NewObject(env, LDKCOption_PaymentHashZ_None_class, LDKCOption_PaymentHashZ_None_meth);
6621                 }
6622                 default: abort();
6623         }
6624 }
6625 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6626 CHECK(owner->result_ok);
6627         return ThirtyTwoBytes_clone(&*owner->contents.result);
6628 }
6629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6630         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
6631         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6632         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
6633         return ret_arr;
6634 }
6635
6636 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6637 CHECK(!owner->result_ok);
6638         return APIError_clone(&*owner->contents.err);
6639 }
6640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6641         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
6642         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6643         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
6644         int64_t ret_ref = tag_ptr(ret_copy, true);
6645         return ret_ref;
6646 }
6647
6648 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
6649 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
6650 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
6651 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
6652 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
6653 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
6654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
6655         LDKRecentPaymentDetails_Pending_class =
6656                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
6657         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
6658         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([BJ)V");
6659         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
6660         LDKRecentPaymentDetails_Fulfilled_class =
6661                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
6662         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
6663         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "(J)V");
6664         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
6665         LDKRecentPaymentDetails_Abandoned_class =
6666                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
6667         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
6668         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B)V");
6669         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
6670 }
6671 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6672         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6673         switch(obj->tag) {
6674                 case LDKRecentPaymentDetails_Pending: {
6675                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
6676                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
6677                         int64_t total_msat_conv = obj->pending.total_msat;
6678                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_hash_arr, total_msat_conv);
6679                 }
6680                 case LDKRecentPaymentDetails_Fulfilled: {
6681                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
6682                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_hash_ref);
6683                 }
6684                 case LDKRecentPaymentDetails_Abandoned: {
6685                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
6686                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
6687                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_hash_arr);
6688                 }
6689                 default: abort();
6690         }
6691 }
6692 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
6693         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
6694         for (size_t i = 0; i < ret.datalen; i++) {
6695                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
6696         }
6697         return ret;
6698 }
6699 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
6700 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
6701 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
6702 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
6703 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
6704 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
6705 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
6706 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
6707 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
6708 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
6709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
6710         LDKPaymentSendFailure_ParameterError_class =
6711                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
6712         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
6713         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
6714         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
6715         LDKPaymentSendFailure_PathParameterError_class =
6716                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
6717         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
6718         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
6719         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
6720         LDKPaymentSendFailure_AllFailedResendSafe_class =
6721                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
6722         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
6723         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
6724         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
6725         LDKPaymentSendFailure_DuplicatePayment_class =
6726                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
6727         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
6728         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
6729         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
6730         LDKPaymentSendFailure_PartialFailure_class =
6731                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
6732         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
6733         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
6734         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
6735 }
6736 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6737         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6738         switch(obj->tag) {
6739                 case LDKPaymentSendFailure_ParameterError: {
6740                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
6741                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
6742                 }
6743                 case LDKPaymentSendFailure_PathParameterError: {
6744                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6745                         int64_tArray path_parameter_error_arr = NULL;
6746                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
6747                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
6748                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6749                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6750                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6751                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6752                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
6753                         }
6754                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
6755                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
6756                 }
6757                 case LDKPaymentSendFailure_AllFailedResendSafe: {
6758                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
6759                         int64_tArray all_failed_resend_safe_arr = NULL;
6760                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
6761                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
6762                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
6763                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
6764                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
6765                         }
6766                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
6767                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
6768                 }
6769                 case LDKPaymentSendFailure_DuplicatePayment: {
6770                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
6771                 }
6772                 case LDKPaymentSendFailure_PartialFailure: {
6773                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6774                         int64_tArray results_arr = NULL;
6775                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
6776                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
6777                         for (size_t w = 0; w < results_var.datalen; w++) {
6778                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6779                                 *results_conv_22_conv = results_var.data[w];
6780                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6781                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
6782                         }
6783                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
6784                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6785                         int64_t failed_paths_retry_ref = 0;
6786                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6787                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
6788                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
6789                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
6790                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
6791                 }
6792                 default: abort();
6793         }
6794 }
6795 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6796 CHECK(owner->result_ok);
6797         return *owner->contents.result;
6798 }
6799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6800         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6801         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6802 }
6803
6804 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6805 CHECK(!owner->result_ok);
6806         return PaymentSendFailure_clone(&*owner->contents.err);
6807 }
6808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6809         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6810         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6811         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6812         int64_t ret_ref = tag_ptr(ret_copy, true);
6813         return ret_ref;
6814 }
6815
6816 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6817 CHECK(owner->result_ok);
6818         return *owner->contents.result;
6819 }
6820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6821         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6822         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
6823 }
6824
6825 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6826 CHECK(!owner->result_ok);
6827         return RetryableSendFailure_clone(&*owner->contents.err);
6828 }
6829 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6830         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6831         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
6832         return ret_conv;
6833 }
6834
6835 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
6836 CHECK(owner->result_ok);
6837         return ThirtyTwoBytes_clone(&*owner->contents.result);
6838 }
6839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6840         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
6841         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6842         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data);
6843         return ret_arr;
6844 }
6845
6846 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
6847 CHECK(!owner->result_ok);
6848         return PaymentSendFailure_clone(&*owner->contents.err);
6849 }
6850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6851         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
6852         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6853         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
6854         int64_t ret_ref = tag_ptr(ret_copy, true);
6855         return ret_ref;
6856 }
6857
6858 static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
6859 CHECK(owner->result_ok);
6860         return ThirtyTwoBytes_clone(&*owner->contents.result);
6861 }
6862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6863         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
6864         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6865         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data);
6866         return ret_arr;
6867 }
6868
6869 static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
6870 CHECK(!owner->result_ok);
6871         return RetryableSendFailure_clone(&*owner->contents.err);
6872 }
6873 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6874         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
6875         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv));
6876         return ret_conv;
6877 }
6878
6879 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6880         return ThirtyTwoBytes_clone(&owner->a);
6881 }
6882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6883         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6884         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6885         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
6886         return ret_arr;
6887 }
6888
6889 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6890         return ThirtyTwoBytes_clone(&owner->b);
6891 }
6892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6893         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6894         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6895         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
6896         return ret_arr;
6897 }
6898
6899 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6900 CHECK(owner->result_ok);
6901         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
6902 }
6903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6904         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6905         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
6906         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
6907         return tag_ptr(ret_conv, true);
6908 }
6909
6910 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6911 CHECK(!owner->result_ok);
6912         return PaymentSendFailure_clone(&*owner->contents.err);
6913 }
6914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6915         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6916         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6917         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
6918         int64_t ret_ref = tag_ptr(ret_copy, true);
6919         return ret_ref;
6920 }
6921
6922 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
6923         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
6924         for (size_t i = 0; i < ret.datalen; i++) {
6925                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
6926         }
6927         return ret;
6928 }
6929 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6930         return ThirtyTwoBytes_clone(&owner->a);
6931 }
6932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6933         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6934         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6935         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
6936         return ret_arr;
6937 }
6938
6939 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6940         return ThirtyTwoBytes_clone(&owner->b);
6941 }
6942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6943         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6944         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6945         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
6946         return ret_arr;
6947 }
6948
6949 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6950 CHECK(owner->result_ok);
6951         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6952 }
6953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6954         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6955         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6956         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6957         return tag_ptr(ret_conv, true);
6958 }
6959
6960 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6961 CHECK(!owner->result_ok);
6962         return *owner->contents.err;
6963 }
6964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6965         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6966         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6967 }
6968
6969 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6970 CHECK(owner->result_ok);
6971         return ThirtyTwoBytes_clone(&*owner->contents.result);
6972 }
6973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6974         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6975         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6976         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
6977         return ret_arr;
6978 }
6979
6980 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6981 CHECK(!owner->result_ok);
6982         return *owner->contents.err;
6983 }
6984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6985         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6986         CResult_PaymentSecretNoneZ_get_err(owner_conv);
6987 }
6988
6989 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6990 CHECK(owner->result_ok);
6991         return ThirtyTwoBytes_clone(&*owner->contents.result);
6992 }
6993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6994         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
6995         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6996         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
6997         return ret_arr;
6998 }
6999
7000 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
7001 CHECK(!owner->result_ok);
7002         return APIError_clone(&*owner->contents.err);
7003 }
7004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7005         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
7006         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7007         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
7008         int64_t ret_ref = tag_ptr(ret_copy, true);
7009         return ret_ref;
7010 }
7011
7012 static jclass LDKCOption_CVec_ChainHashZZ_Some_class = NULL;
7013 static jmethodID LDKCOption_CVec_ChainHashZZ_Some_meth = NULL;
7014 static jclass LDKCOption_CVec_ChainHashZZ_None_class = NULL;
7015 static jmethodID LDKCOption_CVec_ChainHashZZ_None_meth = NULL;
7016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ChainHashZZ_init (JNIEnv *env, jclass clz) {
7017         LDKCOption_CVec_ChainHashZZ_Some_class =
7018                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ChainHashZZ$Some"));
7019         CHECK(LDKCOption_CVec_ChainHashZZ_Some_class != NULL);
7020         LDKCOption_CVec_ChainHashZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ChainHashZZ_Some_class, "<init>", "([[B)V");
7021         CHECK(LDKCOption_CVec_ChainHashZZ_Some_meth != NULL);
7022         LDKCOption_CVec_ChainHashZZ_None_class =
7023                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ChainHashZZ$None"));
7024         CHECK(LDKCOption_CVec_ChainHashZZ_None_class != NULL);
7025         LDKCOption_CVec_ChainHashZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ChainHashZZ_None_class, "<init>", "()V");
7026         CHECK(LDKCOption_CVec_ChainHashZZ_None_meth != NULL);
7027 }
7028 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ChainHashZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7029         LDKCOption_CVec_ChainHashZZ *obj = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(ptr);
7030         switch(obj->tag) {
7031                 case LDKCOption_CVec_ChainHashZZ_Some: {
7032                         LDKCVec_ChainHashZ some_var = obj->some;
7033                         jobjectArray some_arr = NULL;
7034                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
7035                         ;
7036                         for (size_t i = 0; i < some_var.datalen; i++) {
7037                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
7038                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
7039                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
7040                         }
7041                         
7042                         return (*env)->NewObject(env, LDKCOption_CVec_ChainHashZZ_Some_class, LDKCOption_CVec_ChainHashZZ_Some_meth, some_arr);
7043                 }
7044                 case LDKCOption_CVec_ChainHashZZ_None: {
7045                         return (*env)->NewObject(env, LDKCOption_CVec_ChainHashZZ_None_class, LDKCOption_CVec_ChainHashZZ_None_meth);
7046                 }
7047                 default: abort();
7048         }
7049 }
7050 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7051         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
7052         ret.is_owned = false;
7053         return ret;
7054 }
7055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7056         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7057         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
7058         int64_t ret_ref = 0;
7059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7061         return ret_ref;
7062 }
7063
7064 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7065 CHECK(!owner->result_ok);
7066         return DecodeError_clone(&*owner->contents.err);
7067 }
7068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7069         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7070         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7071         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
7072         int64_t ret_ref = tag_ptr(ret_copy, true);
7073         return ret_ref;
7074 }
7075
7076 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7077         LDKChannelCounterparty ret = *owner->contents.result;
7078         ret.is_owned = false;
7079         return ret;
7080 }
7081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7082         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7083         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
7084         int64_t ret_ref = 0;
7085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7087         return ret_ref;
7088 }
7089
7090 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7091 CHECK(!owner->result_ok);
7092         return DecodeError_clone(&*owner->contents.err);
7093 }
7094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7095         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7096         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7097         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
7098         int64_t ret_ref = tag_ptr(ret_copy, true);
7099         return ret_ref;
7100 }
7101
7102 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7103         LDKChannelDetails ret = *owner->contents.result;
7104         ret.is_owned = false;
7105         return ret;
7106 }
7107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7108         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7109         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
7110         int64_t ret_ref = 0;
7111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7113         return ret_ref;
7114 }
7115
7116 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7117 CHECK(!owner->result_ok);
7118         return DecodeError_clone(&*owner->contents.err);
7119 }
7120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7121         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7122         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7123         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
7124         int64_t ret_ref = tag_ptr(ret_copy, true);
7125         return ret_ref;
7126 }
7127
7128 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7129         LDKPhantomRouteHints ret = *owner->contents.result;
7130         ret.is_owned = false;
7131         return ret;
7132 }
7133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7134         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7135         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
7136         int64_t ret_ref = 0;
7137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7139         return ret_ref;
7140 }
7141
7142 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7143 CHECK(!owner->result_ok);
7144         return DecodeError_clone(&*owner->contents.err);
7145 }
7146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7147         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7148         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7149         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
7150         int64_t ret_ref = tag_ptr(ret_copy, true);
7151         return ret_ref;
7152 }
7153
7154 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7155 CHECK(owner->result_ok);
7156         return ChannelShutdownState_clone(&*owner->contents.result);
7157 }
7158 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7159         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7160         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
7161         return ret_conv;
7162 }
7163
7164 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7165 CHECK(!owner->result_ok);
7166         return DecodeError_clone(&*owner->contents.err);
7167 }
7168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7169         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7170         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7171         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
7172         int64_t ret_ref = tag_ptr(ret_copy, true);
7173         return ret_ref;
7174 }
7175
7176 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
7177         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
7178         for (size_t i = 0; i < ret.datalen; i++) {
7179                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
7180         }
7181         return ret;
7182 }
7183 typedef struct LDKWatch_JCalls {
7184         atomic_size_t refcnt;
7185         JavaVM *vm;
7186         jweak o;
7187         jmethodID watch_channel_meth;
7188         jmethodID update_channel_meth;
7189         jmethodID release_pending_monitor_events_meth;
7190 } LDKWatch_JCalls;
7191 static void LDKWatch_JCalls_free(void* this_arg) {
7192         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7193         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7194                 JNIEnv *env;
7195                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7196                 if (get_jenv_res == JNI_EDETACHED) {
7197                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7198                 } else {
7199                         DO_ASSERT(get_jenv_res == JNI_OK);
7200                 }
7201                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7202                 if (get_jenv_res == JNI_EDETACHED) {
7203                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7204                 }
7205                 FREE(j_calls);
7206         }
7207 }
7208 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
7209         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7210         JNIEnv *env;
7211         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7212         if (get_jenv_res == JNI_EDETACHED) {
7213                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7214         } else {
7215                 DO_ASSERT(get_jenv_res == JNI_OK);
7216         }
7217         LDKOutPoint funding_txo_var = funding_txo;
7218         int64_t funding_txo_ref = 0;
7219         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7220         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7221         LDKChannelMonitor monitor_var = monitor;
7222         int64_t monitor_ref = 0;
7223         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
7224         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
7225         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7226         CHECK(obj != NULL);
7227         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
7228         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7229                 (*env)->ExceptionDescribe(env);
7230                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
7231         }
7232         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7233         if (get_jenv_res == JNI_EDETACHED) {
7234                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7235         }
7236         return ret_conv;
7237 }
7238 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
7239         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7240         JNIEnv *env;
7241         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7242         if (get_jenv_res == JNI_EDETACHED) {
7243                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7244         } else {
7245                 DO_ASSERT(get_jenv_res == JNI_OK);
7246         }
7247         LDKOutPoint funding_txo_var = funding_txo;
7248         int64_t funding_txo_ref = 0;
7249         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7250         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7251         LDKChannelMonitorUpdate update_var = *update;
7252         int64_t update_ref = 0;
7253         update_var = ChannelMonitorUpdate_clone(&update_var);
7254         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
7255         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
7256         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7257         CHECK(obj != NULL);
7258         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
7259         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7260                 (*env)->ExceptionDescribe(env);
7261                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
7262         }
7263         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7264         if (get_jenv_res == JNI_EDETACHED) {
7265                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7266         }
7267         return ret_conv;
7268 }
7269 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
7270         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7271         JNIEnv *env;
7272         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7273         if (get_jenv_res == JNI_EDETACHED) {
7274                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7275         } else {
7276                 DO_ASSERT(get_jenv_res == JNI_OK);
7277         }
7278         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7279         CHECK(obj != NULL);
7280         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
7281         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7282                 (*env)->ExceptionDescribe(env);
7283                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
7284         }
7285         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
7286         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7287         if (ret_constr.datalen > 0)
7288                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
7289         else
7290                 ret_constr.data = NULL;
7291         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7292         for (size_t x = 0; x < ret_constr.datalen; x++) {
7293                 int64_t ret_conv_49 = ret_vals[x];
7294                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
7295                 CHECK_ACCESS(ret_conv_49_ptr);
7296                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
7297                 FREE(untag_ptr(ret_conv_49));
7298                 ret_constr.data[x] = ret_conv_49_conv;
7299         }
7300         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7301         if (get_jenv_res == JNI_EDETACHED) {
7302                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7303         }
7304         return ret_constr;
7305 }
7306 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
7307         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
7308         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7309 }
7310 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
7311         jclass c = (*env)->GetObjectClass(env, o);
7312         CHECK(c != NULL);
7313         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
7314         atomic_init(&calls->refcnt, 1);
7315         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7316         calls->o = (*env)->NewWeakGlobalRef(env, o);
7317         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7318         CHECK(calls->watch_channel_meth != NULL);
7319         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7320         CHECK(calls->update_channel_meth != NULL);
7321         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
7322         CHECK(calls->release_pending_monitor_events_meth != NULL);
7323
7324         LDKWatch ret = {
7325                 .this_arg = (void*) calls,
7326                 .watch_channel = watch_channel_LDKWatch_jcall,
7327                 .update_channel = update_channel_LDKWatch_jcall,
7328                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
7329                 .free = LDKWatch_JCalls_free,
7330         };
7331         return ret;
7332 }
7333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
7334         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
7335         *res_ptr = LDKWatch_init(env, clz, o);
7336         return tag_ptr(res_ptr, true);
7337 }
7338 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t monitor) {
7339         void* this_arg_ptr = untag_ptr(this_arg);
7340         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7341         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7342         LDKOutPoint funding_txo_conv;
7343         funding_txo_conv.inner = untag_ptr(funding_txo);
7344         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7345         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7346         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7347         LDKChannelMonitor monitor_conv;
7348         monitor_conv.inner = untag_ptr(monitor);
7349         monitor_conv.is_owned = ptr_is_owned(monitor);
7350         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
7351         monitor_conv = ChannelMonitor_clone(&monitor_conv);
7352         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
7353         return ret_conv;
7354 }
7355
7356 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t update) {
7357         void* this_arg_ptr = untag_ptr(this_arg);
7358         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7359         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7360         LDKOutPoint funding_txo_conv;
7361         funding_txo_conv.inner = untag_ptr(funding_txo);
7362         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7363         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7364         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7365         LDKChannelMonitorUpdate update_conv;
7366         update_conv.inner = untag_ptr(update);
7367         update_conv.is_owned = ptr_is_owned(update);
7368         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7369         update_conv.is_owned = false;
7370         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
7371         return ret_conv;
7372 }
7373
7374 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7375         void* this_arg_ptr = untag_ptr(this_arg);
7376         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7377         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7378         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
7379         int64_tArray ret_arr = NULL;
7380         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7381         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7382         for (size_t x = 0; x < ret_var.datalen; x++) {
7383                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
7384                 *ret_conv_49_conv = ret_var.data[x];
7385                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
7386         }
7387         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7388         FREE(ret_var.data);
7389         return ret_arr;
7390 }
7391
7392 typedef struct LDKBroadcasterInterface_JCalls {
7393         atomic_size_t refcnt;
7394         JavaVM *vm;
7395         jweak o;
7396         jmethodID broadcast_transactions_meth;
7397 } LDKBroadcasterInterface_JCalls;
7398 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
7399         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7400         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7401                 JNIEnv *env;
7402                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7403                 if (get_jenv_res == JNI_EDETACHED) {
7404                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7405                 } else {
7406                         DO_ASSERT(get_jenv_res == JNI_OK);
7407                 }
7408                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7409                 if (get_jenv_res == JNI_EDETACHED) {
7410                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7411                 }
7412                 FREE(j_calls);
7413         }
7414 }
7415 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
7416         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7417         JNIEnv *env;
7418         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7419         if (get_jenv_res == JNI_EDETACHED) {
7420                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7421         } else {
7422                 DO_ASSERT(get_jenv_res == JNI_OK);
7423         }
7424         LDKCVec_TransactionZ txs_var = txs;
7425         jobjectArray txs_arr = NULL;
7426         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
7427         ;
7428         for (size_t i = 0; i < txs_var.datalen; i++) {
7429                 LDKTransaction txs_conv_8_var = txs_var.data[i];
7430                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
7431                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
7432                 Transaction_free(txs_conv_8_var);
7433                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
7434         }
7435         
7436         FREE(txs_var.data);
7437         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7438         CHECK(obj != NULL);
7439         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
7440         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7441                 (*env)->ExceptionDescribe(env);
7442                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
7443         }
7444         if (get_jenv_res == JNI_EDETACHED) {
7445                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7446         }
7447 }
7448 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
7449         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
7450         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7451 }
7452 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
7453         jclass c = (*env)->GetObjectClass(env, o);
7454         CHECK(c != NULL);
7455         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
7456         atomic_init(&calls->refcnt, 1);
7457         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7458         calls->o = (*env)->NewWeakGlobalRef(env, o);
7459         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
7460         CHECK(calls->broadcast_transactions_meth != NULL);
7461
7462         LDKBroadcasterInterface ret = {
7463                 .this_arg = (void*) calls,
7464                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
7465                 .free = LDKBroadcasterInterface_JCalls_free,
7466         };
7467         return ret;
7468 }
7469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
7470         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
7471         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
7472         return tag_ptr(res_ptr, true);
7473 }
7474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
7475         void* this_arg_ptr = untag_ptr(this_arg);
7476         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7477         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
7478         LDKCVec_TransactionZ txs_constr;
7479         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
7480         if (txs_constr.datalen > 0)
7481                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7482         else
7483                 txs_constr.data = NULL;
7484         for (size_t i = 0; i < txs_constr.datalen; i++) {
7485                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
7486                 LDKTransaction txs_conv_8_ref;
7487                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
7488                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
7489                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
7490                 txs_conv_8_ref.data_is_owned = true;
7491                 txs_constr.data[i] = txs_conv_8_ref;
7492         }
7493         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
7494 }
7495
7496 typedef struct LDKEntropySource_JCalls {
7497         atomic_size_t refcnt;
7498         JavaVM *vm;
7499         jweak o;
7500         jmethodID get_secure_random_bytes_meth;
7501 } LDKEntropySource_JCalls;
7502 static void LDKEntropySource_JCalls_free(void* this_arg) {
7503         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7504         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7505                 JNIEnv *env;
7506                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7507                 if (get_jenv_res == JNI_EDETACHED) {
7508                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7509                 } else {
7510                         DO_ASSERT(get_jenv_res == JNI_OK);
7511                 }
7512                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7513                 if (get_jenv_res == JNI_EDETACHED) {
7514                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7515                 }
7516                 FREE(j_calls);
7517         }
7518 }
7519 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
7520         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7521         JNIEnv *env;
7522         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7523         if (get_jenv_res == JNI_EDETACHED) {
7524                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7525         } else {
7526                 DO_ASSERT(get_jenv_res == JNI_OK);
7527         }
7528         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7529         CHECK(obj != NULL);
7530         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
7531         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7532                 (*env)->ExceptionDescribe(env);
7533                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
7534         }
7535         LDKThirtyTwoBytes ret_ref;
7536         CHECK((*env)->GetArrayLength(env, ret) == 32);
7537         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7538         if (get_jenv_res == JNI_EDETACHED) {
7539                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7540         }
7541         return ret_ref;
7542 }
7543 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
7544         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
7545         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7546 }
7547 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
7548         jclass c = (*env)->GetObjectClass(env, o);
7549         CHECK(c != NULL);
7550         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
7551         atomic_init(&calls->refcnt, 1);
7552         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7553         calls->o = (*env)->NewWeakGlobalRef(env, o);
7554         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
7555         CHECK(calls->get_secure_random_bytes_meth != NULL);
7556
7557         LDKEntropySource ret = {
7558                 .this_arg = (void*) calls,
7559                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
7560                 .free = LDKEntropySource_JCalls_free,
7561         };
7562         return ret;
7563 }
7564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
7565         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
7566         *res_ptr = LDKEntropySource_init(env, clz, o);
7567         return tag_ptr(res_ptr, true);
7568 }
7569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
7570         void* this_arg_ptr = untag_ptr(this_arg);
7571         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7572         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
7573         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7574         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
7575         return ret_arr;
7576 }
7577
7578 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
7579 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
7580 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
7581 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
7582 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
7583 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
7584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
7585         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
7586                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
7587         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
7588         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
7589         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
7590         LDKUnsignedGossipMessage_ChannelUpdate_class =
7591                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
7592         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
7593         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
7594         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
7595         LDKUnsignedGossipMessage_NodeAnnouncement_class =
7596                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
7597         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
7598         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
7599         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
7600 }
7601 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7602         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7603         switch(obj->tag) {
7604                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
7605                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
7606                         int64_t channel_announcement_ref = 0;
7607                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
7608                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
7609                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
7610                 }
7611                 case LDKUnsignedGossipMessage_ChannelUpdate: {
7612                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
7613                         int64_t channel_update_ref = 0;
7614                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
7615                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
7616                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
7617                 }
7618                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
7619                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
7620                         int64_t node_announcement_ref = 0;
7621                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
7622                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
7623                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
7624                 }
7625                 default: abort();
7626         }
7627 }
7628 typedef struct LDKNodeSigner_JCalls {
7629         atomic_size_t refcnt;
7630         JavaVM *vm;
7631         jweak o;
7632         jmethodID get_inbound_payment_key_material_meth;
7633         jmethodID get_node_id_meth;
7634         jmethodID ecdh_meth;
7635         jmethodID sign_invoice_meth;
7636         jmethodID sign_gossip_message_meth;
7637 } LDKNodeSigner_JCalls;
7638 static void LDKNodeSigner_JCalls_free(void* this_arg) {
7639         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7640         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7641                 JNIEnv *env;
7642                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7643                 if (get_jenv_res == JNI_EDETACHED) {
7644                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7645                 } else {
7646                         DO_ASSERT(get_jenv_res == JNI_OK);
7647                 }
7648                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7649                 if (get_jenv_res == JNI_EDETACHED) {
7650                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7651                 }
7652                 FREE(j_calls);
7653         }
7654 }
7655 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
7656         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7657         JNIEnv *env;
7658         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7659         if (get_jenv_res == JNI_EDETACHED) {
7660                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7661         } else {
7662                 DO_ASSERT(get_jenv_res == JNI_OK);
7663         }
7664         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7665         CHECK(obj != NULL);
7666         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
7667         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7668                 (*env)->ExceptionDescribe(env);
7669                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
7670         }
7671         LDKThirtyTwoBytes ret_ref;
7672         CHECK((*env)->GetArrayLength(env, ret) == 32);
7673         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7674         if (get_jenv_res == JNI_EDETACHED) {
7675                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7676         }
7677         return ret_ref;
7678 }
7679 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
7680         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7681         JNIEnv *env;
7682         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7683         if (get_jenv_res == JNI_EDETACHED) {
7684                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7685         } else {
7686                 DO_ASSERT(get_jenv_res == JNI_OK);
7687         }
7688         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7689         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7690         CHECK(obj != NULL);
7691         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
7692         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7693                 (*env)->ExceptionDescribe(env);
7694                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
7695         }
7696         void* ret_ptr = untag_ptr(ret);
7697         CHECK_ACCESS(ret_ptr);
7698         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
7699         FREE(untag_ptr(ret));
7700         if (get_jenv_res == JNI_EDETACHED) {
7701                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7702         }
7703         return ret_conv;
7704 }
7705 LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
7706         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7707         JNIEnv *env;
7708         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7709         if (get_jenv_res == JNI_EDETACHED) {
7710                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7711         } else {
7712                 DO_ASSERT(get_jenv_res == JNI_OK);
7713         }
7714         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7715         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
7716         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
7717         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
7718         *tweak_copy = tweak;
7719         int64_t tweak_ref = tag_ptr(tweak_copy, true);
7720         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7721         CHECK(obj != NULL);
7722         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
7723         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7724                 (*env)->ExceptionDescribe(env);
7725                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
7726         }
7727         void* ret_ptr = untag_ptr(ret);
7728         CHECK_ACCESS(ret_ptr);
7729         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
7730         FREE(untag_ptr(ret));
7731         if (get_jenv_res == JNI_EDETACHED) {
7732                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7733         }
7734         return ret_conv;
7735 }
7736 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
7737         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7738         JNIEnv *env;
7739         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7740         if (get_jenv_res == JNI_EDETACHED) {
7741                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7742         } else {
7743                 DO_ASSERT(get_jenv_res == JNI_OK);
7744         }
7745         LDKu8slice hrp_bytes_var = hrp_bytes;
7746         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
7747         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
7748         LDKCVec_U5Z invoice_data_var = invoice_data;
7749         jobjectArray invoice_data_arr = NULL;
7750         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
7751         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
7752         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
7753                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
7754                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
7755         }
7756         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
7757         FREE(invoice_data_var.data);
7758         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7759         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7760         CHECK(obj != NULL);
7761         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
7762         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7763                 (*env)->ExceptionDescribe(env);
7764                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
7765         }
7766         void* ret_ptr = untag_ptr(ret);
7767         CHECK_ACCESS(ret_ptr);
7768         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
7769         FREE(untag_ptr(ret));
7770         if (get_jenv_res == JNI_EDETACHED) {
7771                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7772         }
7773         return ret_conv;
7774 }
7775 LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
7776         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7777         JNIEnv *env;
7778         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7779         if (get_jenv_res == JNI_EDETACHED) {
7780                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7781         } else {
7782                 DO_ASSERT(get_jenv_res == JNI_OK);
7783         }
7784         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
7785         *msg_copy = msg;
7786         int64_t msg_ref = tag_ptr(msg_copy, true);
7787         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7788         CHECK(obj != NULL);
7789         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
7790         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7791                 (*env)->ExceptionDescribe(env);
7792                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
7793         }
7794         void* ret_ptr = untag_ptr(ret);
7795         CHECK_ACCESS(ret_ptr);
7796         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
7797         FREE(untag_ptr(ret));
7798         if (get_jenv_res == JNI_EDETACHED) {
7799                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7800         }
7801         return ret_conv;
7802 }
7803 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
7804         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
7805         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7806 }
7807 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
7808         jclass c = (*env)->GetObjectClass(env, o);
7809         CHECK(c != NULL);
7810         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
7811         atomic_init(&calls->refcnt, 1);
7812         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7813         calls->o = (*env)->NewWeakGlobalRef(env, o);
7814         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
7815         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
7816         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
7817         CHECK(calls->get_node_id_meth != NULL);
7818         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
7819         CHECK(calls->ecdh_meth != NULL);
7820         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
7821         CHECK(calls->sign_invoice_meth != NULL);
7822         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
7823         CHECK(calls->sign_gossip_message_meth != NULL);
7824
7825         LDKNodeSigner ret = {
7826                 .this_arg = (void*) calls,
7827                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
7828                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
7829                 .ecdh = ecdh_LDKNodeSigner_jcall,
7830                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
7831                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
7832                 .free = LDKNodeSigner_JCalls_free,
7833         };
7834         return ret;
7835 }
7836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
7837         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
7838         *res_ptr = LDKNodeSigner_init(env, clz, o);
7839         return tag_ptr(res_ptr, true);
7840 }
7841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
7842         void* this_arg_ptr = untag_ptr(this_arg);
7843         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7844         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7845         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7846         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
7847         return ret_arr;
7848 }
7849
7850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
7851         void* this_arg_ptr = untag_ptr(this_arg);
7852         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7853         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7854         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7855         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
7856         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
7857         return tag_ptr(ret_conv, true);
7858 }
7859
7860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1ecdh(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient, int8_tArray other_key, int64_t tweak) {
7861         void* this_arg_ptr = untag_ptr(this_arg);
7862         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7863         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7864         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7865         LDKPublicKey other_key_ref;
7866         CHECK((*env)->GetArrayLength(env, other_key) == 33);
7867         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
7868         void* tweak_ptr = untag_ptr(tweak);
7869         CHECK_ACCESS(tweak_ptr);
7870         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
7871         tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak));
7872         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
7873         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
7874         return tag_ptr(ret_conv, true);
7875 }
7876
7877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass recipient) {
7878         void* this_arg_ptr = untag_ptr(this_arg);
7879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7880         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7881         LDKu8slice hrp_bytes_ref;
7882         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
7883         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
7884         LDKCVec_U5Z invoice_data_constr;
7885         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
7886         if (invoice_data_constr.datalen > 0)
7887                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
7888         else
7889                 invoice_data_constr.data = NULL;
7890         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
7891         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
7892                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
7893                 
7894                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
7895         }
7896         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
7897         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7898         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7899         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
7900         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
7901         return tag_ptr(ret_conv, true);
7902 }
7903
7904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
7905         void* this_arg_ptr = untag_ptr(this_arg);
7906         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7907         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7908         void* msg_ptr = untag_ptr(msg);
7909         CHECK_ACCESS(msg_ptr);
7910         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
7911         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
7912         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7913         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
7914         return tag_ptr(ret_conv, true);
7915 }
7916
7917 typedef struct LDKSignerProvider_JCalls {
7918         atomic_size_t refcnt;
7919         JavaVM *vm;
7920         jweak o;
7921         jmethodID generate_channel_keys_id_meth;
7922         jmethodID derive_channel_signer_meth;
7923         jmethodID read_chan_signer_meth;
7924         jmethodID get_destination_script_meth;
7925         jmethodID get_shutdown_scriptpubkey_meth;
7926 } LDKSignerProvider_JCalls;
7927 static void LDKSignerProvider_JCalls_free(void* this_arg) {
7928         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7929         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7930                 JNIEnv *env;
7931                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7932                 if (get_jenv_res == JNI_EDETACHED) {
7933                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7934                 } else {
7935                         DO_ASSERT(get_jenv_res == JNI_OK);
7936                 }
7937                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7938                 if (get_jenv_res == JNI_EDETACHED) {
7939                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7940                 }
7941                 FREE(j_calls);
7942         }
7943 }
7944 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
7945         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7946         JNIEnv *env;
7947         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7948         if (get_jenv_res == JNI_EDETACHED) {
7949                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7950         } else {
7951                 DO_ASSERT(get_jenv_res == JNI_OK);
7952         }
7953         jboolean inbound_conv = inbound;
7954         int64_t channel_value_satoshis_conv = channel_value_satoshis;
7955         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
7956         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
7957         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7958         CHECK(obj != NULL);
7959         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
7960         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7961                 (*env)->ExceptionDescribe(env);
7962                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
7963         }
7964         LDKThirtyTwoBytes ret_ref;
7965         CHECK((*env)->GetArrayLength(env, ret) == 32);
7966         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7967         if (get_jenv_res == JNI_EDETACHED) {
7968                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7969         }
7970         return ret_ref;
7971 }
7972 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
7973         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7974         JNIEnv *env;
7975         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7976         if (get_jenv_res == JNI_EDETACHED) {
7977                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7978         } else {
7979                 DO_ASSERT(get_jenv_res == JNI_OK);
7980         }
7981         int64_t channel_value_satoshis_conv = channel_value_satoshis;
7982         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
7983         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
7984         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7985         CHECK(obj != NULL);
7986         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
7987         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7988                 (*env)->ExceptionDescribe(env);
7989                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
7990         }
7991         void* ret_ptr = untag_ptr(ret);
7992         CHECK_ACCESS(ret_ptr);
7993         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
7994         FREE(untag_ptr(ret));
7995         if (get_jenv_res == JNI_EDETACHED) {
7996                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7997         }
7998         return ret_conv;
7999 }
8000 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
8001         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8002         JNIEnv *env;
8003         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8004         if (get_jenv_res == JNI_EDETACHED) {
8005                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8006         } else {
8007                 DO_ASSERT(get_jenv_res == JNI_OK);
8008         }
8009         LDKu8slice reader_var = reader;
8010         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
8011         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
8012         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8013         CHECK(obj != NULL);
8014         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
8015         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8016                 (*env)->ExceptionDescribe(env);
8017                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
8018         }
8019         void* ret_ptr = untag_ptr(ret);
8020         CHECK_ACCESS(ret_ptr);
8021         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
8022         FREE(untag_ptr(ret));
8023         if (get_jenv_res == JNI_EDETACHED) {
8024                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8025         }
8026         return ret_conv;
8027 }
8028 LDKCResult_ScriptNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
8029         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8030         JNIEnv *env;
8031         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8032         if (get_jenv_res == JNI_EDETACHED) {
8033                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8034         } else {
8035                 DO_ASSERT(get_jenv_res == JNI_OK);
8036         }
8037         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8038         CHECK(obj != NULL);
8039         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
8040         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8041                 (*env)->ExceptionDescribe(env);
8042                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
8043         }
8044         void* ret_ptr = untag_ptr(ret);
8045         CHECK_ACCESS(ret_ptr);
8046         LDKCResult_ScriptNoneZ ret_conv = *(LDKCResult_ScriptNoneZ*)(ret_ptr);
8047         FREE(untag_ptr(ret));
8048         if (get_jenv_res == JNI_EDETACHED) {
8049                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8050         }
8051         return ret_conv;
8052 }
8053 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
8054         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8055         JNIEnv *env;
8056         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8057         if (get_jenv_res == JNI_EDETACHED) {
8058                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8059         } else {
8060                 DO_ASSERT(get_jenv_res == JNI_OK);
8061         }
8062         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8063         CHECK(obj != NULL);
8064         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
8065         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8066                 (*env)->ExceptionDescribe(env);
8067                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
8068         }
8069         void* ret_ptr = untag_ptr(ret);
8070         CHECK_ACCESS(ret_ptr);
8071         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
8072         FREE(untag_ptr(ret));
8073         if (get_jenv_res == JNI_EDETACHED) {
8074                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8075         }
8076         return ret_conv;
8077 }
8078 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
8079         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
8080         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8081 }
8082 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
8083         jclass c = (*env)->GetObjectClass(env, o);
8084         CHECK(c != NULL);
8085         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
8086         atomic_init(&calls->refcnt, 1);
8087         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8088         calls->o = (*env)->NewWeakGlobalRef(env, o);
8089         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
8090         CHECK(calls->generate_channel_keys_id_meth != NULL);
8091         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
8092         CHECK(calls->derive_channel_signer_meth != NULL);
8093         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
8094         CHECK(calls->read_chan_signer_meth != NULL);
8095         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
8096         CHECK(calls->get_destination_script_meth != NULL);
8097         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
8098         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
8099
8100         LDKSignerProvider ret = {
8101                 .this_arg = (void*) calls,
8102                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
8103                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
8104                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
8105                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
8106                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
8107                 .free = LDKSignerProvider_JCalls_free,
8108         };
8109         return ret;
8110 }
8111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
8112         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
8113         *res_ptr = LDKSignerProvider_init(env, clz, o);
8114         return tag_ptr(res_ptr, true);
8115 }
8116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignerProvider_1generate_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) {
8117         void* this_arg_ptr = untag_ptr(this_arg);
8118         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8119         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8120         LDKU128 user_channel_id_ref;
8121         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
8122         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
8123         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8124         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->generate_channel_keys_id)(this_arg_conv->this_arg, inbound, channel_value_satoshis, user_channel_id_ref).data);
8125         return ret_arr;
8126 }
8127
8128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) {
8129         void* this_arg_ptr = untag_ptr(this_arg);
8130         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8131         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8132         LDKThirtyTwoBytes channel_keys_id_ref;
8133         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
8134         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
8135         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
8136         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
8137         return tag_ptr(ret_ret, true);
8138 }
8139
8140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
8141         void* this_arg_ptr = untag_ptr(this_arg);
8142         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8143         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8144         LDKu8slice reader_ref;
8145         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
8146         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
8147         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
8148         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
8149         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
8150         return tag_ptr(ret_conv, true);
8151 }
8152
8153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
8154         void* this_arg_ptr = untag_ptr(this_arg);
8155         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8156         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8157         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
8158         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
8159         return tag_ptr(ret_conv, true);
8160 }
8161
8162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
8163         void* this_arg_ptr = untag_ptr(this_arg);
8164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8165         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8166         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
8167         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
8168         return tag_ptr(ret_conv, true);
8169 }
8170
8171 typedef struct LDKFeeEstimator_JCalls {
8172         atomic_size_t refcnt;
8173         JavaVM *vm;
8174         jweak o;
8175         jmethodID get_est_sat_per_1000_weight_meth;
8176 } LDKFeeEstimator_JCalls;
8177 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
8178         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8179         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8180                 JNIEnv *env;
8181                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8182                 if (get_jenv_res == JNI_EDETACHED) {
8183                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8184                 } else {
8185                         DO_ASSERT(get_jenv_res == JNI_OK);
8186                 }
8187                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8188                 if (get_jenv_res == JNI_EDETACHED) {
8189                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8190                 }
8191                 FREE(j_calls);
8192         }
8193 }
8194 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
8195         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8196         JNIEnv *env;
8197         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8198         if (get_jenv_res == JNI_EDETACHED) {
8199                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8200         } else {
8201                 DO_ASSERT(get_jenv_res == JNI_OK);
8202         }
8203         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
8204         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8205         CHECK(obj != NULL);
8206         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
8207         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8208                 (*env)->ExceptionDescribe(env);
8209                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
8210         }
8211         if (get_jenv_res == JNI_EDETACHED) {
8212                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8213         }
8214         return ret;
8215 }
8216 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
8217         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
8218         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8219 }
8220 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
8221         jclass c = (*env)->GetObjectClass(env, o);
8222         CHECK(c != NULL);
8223         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
8224         atomic_init(&calls->refcnt, 1);
8225         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8226         calls->o = (*env)->NewWeakGlobalRef(env, o);
8227         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
8228         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
8229
8230         LDKFeeEstimator ret = {
8231                 .this_arg = (void*) calls,
8232                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
8233                 .free = LDKFeeEstimator_JCalls_free,
8234         };
8235         return ret;
8236 }
8237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
8238         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
8239         *res_ptr = LDKFeeEstimator_init(env, clz, o);
8240         return tag_ptr(res_ptr, true);
8241 }
8242 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) {
8243         void* this_arg_ptr = untag_ptr(this_arg);
8244         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8245         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
8246         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
8247         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
8248         return ret_conv;
8249 }
8250
8251 typedef struct LDKRouter_JCalls {
8252         atomic_size_t refcnt;
8253         JavaVM *vm;
8254         jweak o;
8255         jmethodID find_route_meth;
8256         jmethodID find_route_with_id_meth;
8257 } LDKRouter_JCalls;
8258 static void LDKRouter_JCalls_free(void* this_arg) {
8259         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8260         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8261                 JNIEnv *env;
8262                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8263                 if (get_jenv_res == JNI_EDETACHED) {
8264                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8265                 } else {
8266                         DO_ASSERT(get_jenv_res == JNI_OK);
8267                 }
8268                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8269                 if (get_jenv_res == JNI_EDETACHED) {
8270                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8271                 }
8272                 FREE(j_calls);
8273         }
8274 }
8275 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
8276         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8277         JNIEnv *env;
8278         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8279         if (get_jenv_res == JNI_EDETACHED) {
8280                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8281         } else {
8282                 DO_ASSERT(get_jenv_res == JNI_OK);
8283         }
8284         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8285         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8286         LDKRouteParameters route_params_var = *route_params;
8287         int64_t route_params_ref = 0;
8288         route_params_var = RouteParameters_clone(&route_params_var);
8289         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8290         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8291         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8292         int64_tArray first_hops_arr = NULL;
8293         if (first_hops != NULL) {
8294                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8295                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8296                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8297                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8298                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8299                         int64_t first_hops_conv_16_ref = 0;
8300                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8301                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8302                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8303                 }
8304                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8305         }
8306         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8307         int64_t inflight_htlcs_ref = 0;
8308         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8309         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8310         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8311         CHECK(obj != NULL);
8312         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
8313         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8314                 (*env)->ExceptionDescribe(env);
8315                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
8316         }
8317         void* ret_ptr = untag_ptr(ret);
8318         CHECK_ACCESS(ret_ptr);
8319         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8320         FREE(untag_ptr(ret));
8321         if (get_jenv_res == JNI_EDETACHED) {
8322                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8323         }
8324         return ret_conv;
8325 }
8326 LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) {
8327         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8328         JNIEnv *env;
8329         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8330         if (get_jenv_res == JNI_EDETACHED) {
8331                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8332         } else {
8333                 DO_ASSERT(get_jenv_res == JNI_OK);
8334         }
8335         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8336         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8337         LDKRouteParameters route_params_var = *route_params;
8338         int64_t route_params_ref = 0;
8339         route_params_var = RouteParameters_clone(&route_params_var);
8340         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8341         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8342         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8343         int64_tArray first_hops_arr = NULL;
8344         if (first_hops != NULL) {
8345                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8346                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8347                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8348                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8349                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8350                         int64_t first_hops_conv_16_ref = 0;
8351                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8352                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8353                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8354                 }
8355                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8356         }
8357         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8358         int64_t inflight_htlcs_ref = 0;
8359         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8360         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8361         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
8362         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
8363         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
8364         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
8365         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8366         CHECK(obj != NULL);
8367         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_with_id_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref, _payment_hash_arr, _payment_id_arr);
8368         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8369                 (*env)->ExceptionDescribe(env);
8370                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
8371         }
8372         void* ret_ptr = untag_ptr(ret);
8373         CHECK_ACCESS(ret_ptr);
8374         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8375         FREE(untag_ptr(ret));
8376         if (get_jenv_res == JNI_EDETACHED) {
8377                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8378         }
8379         return ret_conv;
8380 }
8381 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
8382         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
8383         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8384 }
8385 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
8386         jclass c = (*env)->GetObjectClass(env, o);
8387         CHECK(c != NULL);
8388         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
8389         atomic_init(&calls->refcnt, 1);
8390         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8391         calls->o = (*env)->NewWeakGlobalRef(env, o);
8392         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
8393         CHECK(calls->find_route_meth != NULL);
8394         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
8395         CHECK(calls->find_route_with_id_meth != NULL);
8396
8397         LDKRouter ret = {
8398                 .this_arg = (void*) calls,
8399                 .find_route = find_route_LDKRouter_jcall,
8400                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
8401                 .free = LDKRouter_JCalls_free,
8402         };
8403         return ret;
8404 }
8405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
8406         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
8407         *res_ptr = LDKRouter_init(env, clz, o);
8408         return tag_ptr(res_ptr, true);
8409 }
8410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs) {
8411         void* this_arg_ptr = untag_ptr(this_arg);
8412         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8413         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8414         LDKPublicKey payer_ref;
8415         CHECK((*env)->GetArrayLength(env, payer) == 33);
8416         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8417         LDKRouteParameters route_params_conv;
8418         route_params_conv.inner = untag_ptr(route_params);
8419         route_params_conv.is_owned = ptr_is_owned(route_params);
8420         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8421         route_params_conv.is_owned = false;
8422         LDKCVec_ChannelDetailsZ first_hops_constr;
8423         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8424         if (first_hops != NULL) {
8425                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8426                 if (first_hops_constr.datalen > 0)
8427                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8428                 else
8429                         first_hops_constr.data = NULL;
8430                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8431                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8432                         int64_t first_hops_conv_16 = first_hops_vals[q];
8433                         LDKChannelDetails first_hops_conv_16_conv;
8434                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8435                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8436                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8437                         first_hops_conv_16_conv.is_owned = false;
8438                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8439                 }
8440                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8441                 first_hops_ptr = &first_hops_constr;
8442         }
8443         LDKInFlightHtlcs inflight_htlcs_conv;
8444         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8445         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8446         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8447         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
8448         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8449         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
8450         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8451         return tag_ptr(ret_conv, true);
8452 }
8453
8454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route_1with_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t route_params, int64_tArray first_hops, int64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) {
8455         void* this_arg_ptr = untag_ptr(this_arg);
8456         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8457         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8458         LDKPublicKey payer_ref;
8459         CHECK((*env)->GetArrayLength(env, payer) == 33);
8460         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8461         LDKRouteParameters route_params_conv;
8462         route_params_conv.inner = untag_ptr(route_params);
8463         route_params_conv.is_owned = ptr_is_owned(route_params);
8464         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8465         route_params_conv.is_owned = false;
8466         LDKCVec_ChannelDetailsZ first_hops_constr;
8467         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8468         if (first_hops != NULL) {
8469                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8470                 if (first_hops_constr.datalen > 0)
8471                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8472                 else
8473                         first_hops_constr.data = NULL;
8474                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8475                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8476                         int64_t first_hops_conv_16 = first_hops_vals[q];
8477                         LDKChannelDetails first_hops_conv_16_conv;
8478                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8479                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8480                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8481                         first_hops_conv_16_conv.is_owned = false;
8482                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8483                 }
8484                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8485                 first_hops_ptr = &first_hops_constr;
8486         }
8487         LDKInFlightHtlcs inflight_htlcs_conv;
8488         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8489         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8490         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8491         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
8492         LDKThirtyTwoBytes _payment_hash_ref;
8493         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
8494         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
8495         LDKThirtyTwoBytes _payment_id_ref;
8496         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
8497         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
8498         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8499         *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref);
8500         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8501         return tag_ptr(ret_conv, true);
8502 }
8503
8504 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
8505         return ThirtyTwoBytes_clone(&owner->a);
8506 }
8507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8508         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
8509         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8510         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
8511         return ret_arr;
8512 }
8513
8514 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
8515         LDKChannelManager ret = owner->b;
8516         ret.is_owned = false;
8517         return ret;
8518 }
8519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8520         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
8521         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
8522         int64_t ret_ref = 0;
8523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8525         return ret_ref;
8526 }
8527
8528 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8529 CHECK(owner->result_ok);
8530         return &*owner->contents.result;
8531 }
8532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8533         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8534         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
8535         return ret_ret;
8536 }
8537
8538 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8539 CHECK(!owner->result_ok);
8540         return DecodeError_clone(&*owner->contents.err);
8541 }
8542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8543         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8544         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8545         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
8546         int64_t ret_ref = tag_ptr(ret_copy, true);
8547         return ret_ref;
8548 }
8549
8550 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
8551 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
8552 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
8553 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
8554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
8555         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
8556                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
8557         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
8558         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
8559         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
8560         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
8561                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
8562         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
8563         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
8564         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
8565 }
8566 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8567         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8568         switch(obj->tag) {
8569                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
8570                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
8571                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
8572                 }
8573                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
8574                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
8575                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
8576                 }
8577                 default: abort();
8578         }
8579 }
8580 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8581 CHECK(owner->result_ok);
8582         return MaxDustHTLCExposure_clone(&*owner->contents.result);
8583 }
8584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8585         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
8586         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
8587         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
8588         int64_t ret_ref = tag_ptr(ret_copy, true);
8589         return ret_ref;
8590 }
8591
8592 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8593 CHECK(!owner->result_ok);
8594         return DecodeError_clone(&*owner->contents.err);
8595 }
8596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8597         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
8598         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8599         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
8600         int64_t ret_ref = tag_ptr(ret_copy, true);
8601         return ret_ref;
8602 }
8603
8604 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8605         LDKChannelConfig ret = *owner->contents.result;
8606         ret.is_owned = false;
8607         return ret;
8608 }
8609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8610         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8611         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
8612         int64_t ret_ref = 0;
8613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8615         return ret_ref;
8616 }
8617
8618 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8619 CHECK(!owner->result_ok);
8620         return DecodeError_clone(&*owner->contents.err);
8621 }
8622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8623         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8624         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8625         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
8626         int64_t ret_ref = tag_ptr(ret_copy, true);
8627         return ret_ref;
8628 }
8629
8630 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
8631 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
8632 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
8633 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
8634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
8635         LDKCOption_MaxDustHTLCExposureZ_Some_class =
8636                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
8637         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
8638         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
8639         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
8640         LDKCOption_MaxDustHTLCExposureZ_None_class =
8641                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
8642         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
8643         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
8644         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
8645 }
8646 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8647         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
8648         switch(obj->tag) {
8649                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
8650                         int64_t some_ref = tag_ptr(&obj->some, false);
8651                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
8652                 }
8653                 case LDKCOption_MaxDustHTLCExposureZ_None: {
8654                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
8655                 }
8656                 default: abort();
8657         }
8658 }
8659 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
8660 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
8661 static jclass LDKCOption_APIErrorZ_None_class = NULL;
8662 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
8663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
8664         LDKCOption_APIErrorZ_Some_class =
8665                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
8666         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
8667         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
8668         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
8669         LDKCOption_APIErrorZ_None_class =
8670                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
8671         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
8672         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
8673         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
8674 }
8675 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8676         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
8677         switch(obj->tag) {
8678                 case LDKCOption_APIErrorZ_Some: {
8679                         int64_t some_ref = tag_ptr(&obj->some, false);
8680                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
8681                 }
8682                 case LDKCOption_APIErrorZ_None: {
8683                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
8684                 }
8685                 default: abort();
8686         }
8687 }
8688 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8689 CHECK(owner->result_ok);
8690         return COption_APIErrorZ_clone(&*owner->contents.result);
8691 }
8692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8693         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8694         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
8695         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
8696         int64_t ret_ref = tag_ptr(ret_copy, true);
8697         return ret_ref;
8698 }
8699
8700 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8701 CHECK(!owner->result_ok);
8702         return DecodeError_clone(&*owner->contents.err);
8703 }
8704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8705         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8706         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8707         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
8708         int64_t ret_ref = tag_ptr(ret_copy, true);
8709         return ret_ref;
8710 }
8711
8712 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8713         LDKChannelMonitorUpdate ret = *owner->contents.result;
8714         ret.is_owned = false;
8715         return ret;
8716 }
8717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8718         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8719         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
8720         int64_t ret_ref = 0;
8721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8723         return ret_ref;
8724 }
8725
8726 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8727 CHECK(!owner->result_ok);
8728         return DecodeError_clone(&*owner->contents.err);
8729 }
8730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8731         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8732         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8733         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
8734         int64_t ret_ref = tag_ptr(ret_copy, true);
8735         return ret_ref;
8736 }
8737
8738 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
8739 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
8740 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
8741 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
8742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
8743         LDKCOption_MonitorEventZ_Some_class =
8744                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
8745         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
8746         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
8747         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
8748         LDKCOption_MonitorEventZ_None_class =
8749                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
8750         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
8751         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
8752         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
8753 }
8754 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8755         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
8756         switch(obj->tag) {
8757                 case LDKCOption_MonitorEventZ_Some: {
8758                         int64_t some_ref = tag_ptr(&obj->some, false);
8759                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
8760                 }
8761                 case LDKCOption_MonitorEventZ_None: {
8762                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
8763                 }
8764                 default: abort();
8765         }
8766 }
8767 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8768 CHECK(owner->result_ok);
8769         return COption_MonitorEventZ_clone(&*owner->contents.result);
8770 }
8771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8772         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8773         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
8774         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
8775         int64_t ret_ref = tag_ptr(ret_copy, true);
8776         return ret_ref;
8777 }
8778
8779 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8780 CHECK(!owner->result_ok);
8781         return DecodeError_clone(&*owner->contents.err);
8782 }
8783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8784         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8785         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8786         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
8787         int64_t ret_ref = tag_ptr(ret_copy, true);
8788         return ret_ref;
8789 }
8790
8791 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8792         LDKHTLCUpdate ret = *owner->contents.result;
8793         ret.is_owned = false;
8794         return ret;
8795 }
8796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8797         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8798         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
8799         int64_t ret_ref = 0;
8800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8802         return ret_ref;
8803 }
8804
8805 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8806 CHECK(!owner->result_ok);
8807         return DecodeError_clone(&*owner->contents.err);
8808 }
8809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8810         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8811         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8812         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
8813         int64_t ret_ref = tag_ptr(ret_copy, true);
8814         return ret_ref;
8815 }
8816
8817 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8818         LDKOutPoint ret = owner->a;
8819         ret.is_owned = false;
8820         return ret;
8821 }
8822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8823         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
8824         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
8825         int64_t ret_ref = 0;
8826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8828         return ret_ref;
8829 }
8830
8831 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8832         return CVec_u8Z_clone(&owner->b);
8833 }
8834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8835         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
8836         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
8837         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8838         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8839         CVec_u8Z_free(ret_var);
8840         return ret_arr;
8841 }
8842
8843 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8844         return owner->a;
8845 }
8846 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8847         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
8848         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
8849         return ret_conv;
8850 }
8851
8852 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8853         return CVec_u8Z_clone(&owner->b);
8854 }
8855 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8856         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
8857         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
8858         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8859         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8860         CVec_u8Z_free(ret_var);
8861         return ret_arr;
8862 }
8863
8864 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
8865         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
8866         for (size_t i = 0; i < ret.datalen; i++) {
8867                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
8868         }
8869         return ret;
8870 }
8871 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8872         return ThirtyTwoBytes_clone(&owner->a);
8873 }
8874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8875         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
8876         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8877         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
8878         return ret_arr;
8879 }
8880
8881 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8882         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
8883 }
8884 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8885         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
8886         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
8887         int64_tArray ret_arr = NULL;
8888         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8889         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8890         for (size_t v = 0; v < ret_var.datalen; v++) {
8891                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8892                 *ret_conv_21_conv = ret_var.data[v];
8893                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
8894         }
8895         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8896         FREE(ret_var.data);
8897         return ret_arr;
8898 }
8899
8900 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
8901         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ clone bytes"), .datalen = orig->datalen };
8902         for (size_t i = 0; i < ret.datalen; i++) {
8903                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
8904         }
8905         return ret;
8906 }
8907 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8908         return owner->a;
8909 }
8910 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8911         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8912         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8913         return ret_conv;
8914 }
8915
8916 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8917         return TxOut_clone(&owner->b);
8918 }
8919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8920         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8921         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8922         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8923         return tag_ptr(ret_ref, true);
8924 }
8925
8926 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8927         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8928         for (size_t i = 0; i < ret.datalen; i++) {
8929                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8930         }
8931         return ret;
8932 }
8933 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8934         return ThirtyTwoBytes_clone(&owner->a);
8935 }
8936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8937         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8938         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8939         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
8940         return ret_arr;
8941 }
8942
8943 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8944         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8945 }
8946 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8947         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8948         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8949         int64_tArray ret_arr = NULL;
8950         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8951         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8952         for (size_t u = 0; u < ret_var.datalen; u++) {
8953                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8954                 *ret_conv_20_conv = ret_var.data[u];
8955                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
8956         }
8957         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8958         FREE(ret_var.data);
8959         return ret_arr;
8960 }
8961
8962 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
8963         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
8964         for (size_t i = 0; i < ret.datalen; i++) {
8965                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8966         }
8967         return ret;
8968 }
8969 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
8970 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
8971 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
8972 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
8973 static jclass LDKBalance_ContentiousClaimable_class = NULL;
8974 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
8975 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
8976 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
8977 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
8978 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
8979 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
8980 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
8981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
8982         LDKBalance_ClaimableOnChannelClose_class =
8983                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
8984         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
8985         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
8986         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
8987         LDKBalance_ClaimableAwaitingConfirmations_class =
8988                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
8989         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
8990         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
8991         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
8992         LDKBalance_ContentiousClaimable_class =
8993                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
8994         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
8995         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
8996         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
8997         LDKBalance_MaybeTimeoutClaimableHTLC_class =
8998                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
8999         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
9000         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
9001         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
9002         LDKBalance_MaybePreimageClaimableHTLC_class =
9003                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
9004         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
9005         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
9006         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
9007         LDKBalance_CounterpartyRevokedOutputClaimable_class =
9008                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
9009         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
9010         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
9011         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
9012 }
9013 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9014         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
9015         switch(obj->tag) {
9016                 case LDKBalance_ClaimableOnChannelClose: {
9017                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
9018                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
9019                 }
9020                 case LDKBalance_ClaimableAwaitingConfirmations: {
9021                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
9022                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
9023                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
9024                 }
9025                 case LDKBalance_ContentiousClaimable: {
9026                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
9027                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
9028                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9029                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
9030                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
9031                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
9032                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
9033                 }
9034                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
9035                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
9036                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
9037                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9038                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
9039                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
9040                 }
9041                 case LDKBalance_MaybePreimageClaimableHTLC: {
9042                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
9043                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
9044                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9045                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
9046                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
9047                 }
9048                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
9049                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
9050                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
9051                 }
9052                 default: abort();
9053         }
9054 }
9055 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
9056         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
9057         for (size_t i = 0; i < ret.datalen; i++) {
9058                 ret.data[i] = Balance_clone(&orig->data[i]);
9059         }
9060         return ret;
9061 }
9062 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
9063         return ThirtyTwoBytes_clone(&owner->a);
9064 }
9065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9066         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
9067         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9068         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
9069         return ret_arr;
9070 }
9071
9072 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
9073         LDKChannelMonitor ret = owner->b;
9074         ret.is_owned = false;
9075         return ret;
9076 }
9077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9078         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
9079         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
9080         int64_t ret_ref = 0;
9081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9083         return ret_ref;
9084 }
9085
9086 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9087 CHECK(owner->result_ok);
9088         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
9089 }
9090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9091         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9092         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
9093         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
9094         return tag_ptr(ret_conv, true);
9095 }
9096
9097 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9098 CHECK(!owner->result_ok);
9099         return DecodeError_clone(&*owner->contents.err);
9100 }
9101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9102         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9103         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9104         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
9105         int64_t ret_ref = tag_ptr(ret_copy, true);
9106         return ret_ref;
9107 }
9108
9109 typedef struct LDKType_JCalls {
9110         atomic_size_t refcnt;
9111         JavaVM *vm;
9112         jweak o;
9113         jmethodID type_id_meth;
9114         jmethodID debug_str_meth;
9115         jmethodID write_meth;
9116 } LDKType_JCalls;
9117 static void LDKType_JCalls_free(void* this_arg) {
9118         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9119         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9120                 JNIEnv *env;
9121                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9122                 if (get_jenv_res == JNI_EDETACHED) {
9123                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9124                 } else {
9125                         DO_ASSERT(get_jenv_res == JNI_OK);
9126                 }
9127                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9128                 if (get_jenv_res == JNI_EDETACHED) {
9129                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9130                 }
9131                 FREE(j_calls);
9132         }
9133 }
9134 uint16_t type_id_LDKType_jcall(const void* this_arg) {
9135         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9136         JNIEnv *env;
9137         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9138         if (get_jenv_res == JNI_EDETACHED) {
9139                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9140         } else {
9141                 DO_ASSERT(get_jenv_res == JNI_OK);
9142         }
9143         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9144         CHECK(obj != NULL);
9145         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
9146         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9147                 (*env)->ExceptionDescribe(env);
9148                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
9149         }
9150         if (get_jenv_res == JNI_EDETACHED) {
9151                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9152         }
9153         return ret;
9154 }
9155 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
9156         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9157         JNIEnv *env;
9158         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9159         if (get_jenv_res == JNI_EDETACHED) {
9160                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9161         } else {
9162                 DO_ASSERT(get_jenv_res == JNI_OK);
9163         }
9164         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9165         CHECK(obj != NULL);
9166         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
9167         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9168                 (*env)->ExceptionDescribe(env);
9169                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
9170         }
9171         LDKStr ret_conv = java_to_owned_str(env, ret);
9172         if (get_jenv_res == JNI_EDETACHED) {
9173                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9174         }
9175         return ret_conv;
9176 }
9177 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
9178         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9179         JNIEnv *env;
9180         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9181         if (get_jenv_res == JNI_EDETACHED) {
9182                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9183         } else {
9184                 DO_ASSERT(get_jenv_res == JNI_OK);
9185         }
9186         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9187         CHECK(obj != NULL);
9188         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9189         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9190                 (*env)->ExceptionDescribe(env);
9191                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
9192         }
9193         LDKCVec_u8Z ret_ref;
9194         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9195         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9196         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9197         if (get_jenv_res == JNI_EDETACHED) {
9198                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9199         }
9200         return ret_ref;
9201 }
9202 static void LDKType_JCalls_cloned(LDKType* new_obj) {
9203         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
9204         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9205 }
9206 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
9207         jclass c = (*env)->GetObjectClass(env, o);
9208         CHECK(c != NULL);
9209         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
9210         atomic_init(&calls->refcnt, 1);
9211         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9212         calls->o = (*env)->NewWeakGlobalRef(env, o);
9213         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
9214         CHECK(calls->type_id_meth != NULL);
9215         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
9216         CHECK(calls->debug_str_meth != NULL);
9217         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9218         CHECK(calls->write_meth != NULL);
9219
9220         LDKType ret = {
9221                 .this_arg = (void*) calls,
9222                 .type_id = type_id_LDKType_jcall,
9223                 .debug_str = debug_str_LDKType_jcall,
9224                 .write = write_LDKType_jcall,
9225                 .cloned = LDKType_JCalls_cloned,
9226                 .free = LDKType_JCalls_free,
9227         };
9228         return ret;
9229 }
9230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
9231         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
9232         *res_ptr = LDKType_init(env, clz, o);
9233         return tag_ptr(res_ptr, true);
9234 }
9235 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9236         void* this_arg_ptr = untag_ptr(this_arg);
9237         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9238         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9239         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
9240         return ret_conv;
9241 }
9242
9243 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
9244         void* this_arg_ptr = untag_ptr(this_arg);
9245         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9246         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9247         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
9248         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9249         Str_free(ret_str);
9250         return ret_conv;
9251 }
9252
9253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9254         void* this_arg_ptr = untag_ptr(this_arg);
9255         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9256         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9257         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9258         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9259         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9260         CVec_u8Z_free(ret_var);
9261         return ret_arr;
9262 }
9263
9264 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9265         return owner->a;
9266 }
9267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9268         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9269         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9270         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
9271         return ret_arr;
9272 }
9273
9274 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9275         return Type_clone(&owner->b);
9276 }
9277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9278         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9279         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
9280         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
9281         return tag_ptr(ret_ret, true);
9282 }
9283
9284 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
9285         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
9286         for (size_t i = 0; i < ret.datalen; i++) {
9287                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
9288         }
9289         return ret;
9290 }
9291 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
9292 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
9293 static jclass LDKOffersMessage_Invoice_class = NULL;
9294 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
9295 static jclass LDKOffersMessage_InvoiceError_class = NULL;
9296 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
9297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
9298         LDKOffersMessage_InvoiceRequest_class =
9299                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
9300         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
9301         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
9302         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
9303         LDKOffersMessage_Invoice_class =
9304                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
9305         CHECK(LDKOffersMessage_Invoice_class != NULL);
9306         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
9307         CHECK(LDKOffersMessage_Invoice_meth != NULL);
9308         LDKOffersMessage_InvoiceError_class =
9309                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
9310         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
9311         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
9312         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
9313 }
9314 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9315         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
9316         switch(obj->tag) {
9317                 case LDKOffersMessage_InvoiceRequest: {
9318                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
9319                         int64_t invoice_request_ref = 0;
9320                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
9321                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
9322                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
9323                 }
9324                 case LDKOffersMessage_Invoice: {
9325                         LDKBolt12Invoice invoice_var = obj->invoice;
9326                         int64_t invoice_ref = 0;
9327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
9328                         invoice_ref = tag_ptr(invoice_var.inner, false);
9329                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
9330                 }
9331                 case LDKOffersMessage_InvoiceError: {
9332                         LDKInvoiceError invoice_error_var = obj->invoice_error;
9333                         int64_t invoice_error_ref = 0;
9334                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
9335                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
9336                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
9337                 }
9338                 default: abort();
9339         }
9340 }
9341 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
9342 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
9343 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
9344 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
9345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
9346         LDKCOption_OffersMessageZ_Some_class =
9347                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
9348         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
9349         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
9350         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
9351         LDKCOption_OffersMessageZ_None_class =
9352                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
9353         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
9354         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
9355         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
9356 }
9357 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9358         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
9359         switch(obj->tag) {
9360                 case LDKCOption_OffersMessageZ_Some: {
9361                         int64_t some_ref = tag_ptr(&obj->some, false);
9362                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
9363                 }
9364                 case LDKCOption_OffersMessageZ_None: {
9365                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
9366                 }
9367                 default: abort();
9368         }
9369 }
9370 typedef struct LDKCustomOnionMessageContents_JCalls {
9371         atomic_size_t refcnt;
9372         JavaVM *vm;
9373         jweak o;
9374         jmethodID tlv_type_meth;
9375         jmethodID write_meth;
9376 } LDKCustomOnionMessageContents_JCalls;
9377 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
9378         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9379         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9380                 JNIEnv *env;
9381                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9382                 if (get_jenv_res == JNI_EDETACHED) {
9383                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9384                 } else {
9385                         DO_ASSERT(get_jenv_res == JNI_OK);
9386                 }
9387                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9388                 if (get_jenv_res == JNI_EDETACHED) {
9389                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9390                 }
9391                 FREE(j_calls);
9392         }
9393 }
9394 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9395         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9396         JNIEnv *env;
9397         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9398         if (get_jenv_res == JNI_EDETACHED) {
9399                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9400         } else {
9401                 DO_ASSERT(get_jenv_res == JNI_OK);
9402         }
9403         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9404         CHECK(obj != NULL);
9405         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
9406         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9407                 (*env)->ExceptionDescribe(env);
9408                 (*env)->FatalError(env, "A call to tlv_type in LDKCustomOnionMessageContents from rust threw an exception.");
9409         }
9410         if (get_jenv_res == JNI_EDETACHED) {
9411                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9412         }
9413         return ret;
9414 }
9415 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9416         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9417         JNIEnv *env;
9418         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9419         if (get_jenv_res == JNI_EDETACHED) {
9420                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9421         } else {
9422                 DO_ASSERT(get_jenv_res == JNI_OK);
9423         }
9424         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9425         CHECK(obj != NULL);
9426         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9427         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9428                 (*env)->ExceptionDescribe(env);
9429                 (*env)->FatalError(env, "A call to write in LDKCustomOnionMessageContents from rust threw an exception.");
9430         }
9431         LDKCVec_u8Z ret_ref;
9432         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9433         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9434         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9435         if (get_jenv_res == JNI_EDETACHED) {
9436                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9437         }
9438         return ret_ref;
9439 }
9440 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
9441         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
9442         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9443 }
9444 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
9445         jclass c = (*env)->GetObjectClass(env, o);
9446         CHECK(c != NULL);
9447         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
9448         atomic_init(&calls->refcnt, 1);
9449         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9450         calls->o = (*env)->NewWeakGlobalRef(env, o);
9451         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
9452         CHECK(calls->tlv_type_meth != NULL);
9453         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9454         CHECK(calls->write_meth != NULL);
9455
9456         LDKCustomOnionMessageContents ret = {
9457                 .this_arg = (void*) calls,
9458                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
9459                 .write = write_LDKCustomOnionMessageContents_jcall,
9460                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
9461                 .free = LDKCustomOnionMessageContents_JCalls_free,
9462         };
9463         return ret;
9464 }
9465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
9466         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9467         *res_ptr = LDKCustomOnionMessageContents_init(env, clz, o);
9468         return tag_ptr(res_ptr, true);
9469 }
9470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
9471         void* this_arg_ptr = untag_ptr(this_arg);
9472         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9473         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9474         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
9475         return ret_conv;
9476 }
9477
9478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9479         void* this_arg_ptr = untag_ptr(this_arg);
9480         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9481         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9482         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9483         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9484         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9485         CVec_u8Z_free(ret_var);
9486         return ret_arr;
9487 }
9488
9489 static jclass LDKCOption_CustomOnionMessageContentsZ_Some_class = NULL;
9490 static jmethodID LDKCOption_CustomOnionMessageContentsZ_Some_meth = NULL;
9491 static jclass LDKCOption_CustomOnionMessageContentsZ_None_class = NULL;
9492 static jmethodID LDKCOption_CustomOnionMessageContentsZ_None_meth = NULL;
9493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CustomOnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
9494         LDKCOption_CustomOnionMessageContentsZ_Some_class =
9495                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$Some"));
9496         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_class != NULL);
9497         LDKCOption_CustomOnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, "<init>", "(J)V");
9498         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_meth != NULL);
9499         LDKCOption_CustomOnionMessageContentsZ_None_class =
9500                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$None"));
9501         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_class != NULL);
9502         LDKCOption_CustomOnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_None_class, "<init>", "()V");
9503         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_meth != NULL);
9504 }
9505 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CustomOnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9506         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
9507         switch(obj->tag) {
9508                 case LDKCOption_CustomOnionMessageContentsZ_Some: {
9509                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9510                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
9511                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, LDKCOption_CustomOnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
9512                 }
9513                 case LDKCOption_CustomOnionMessageContentsZ_None: {
9514                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_None_class, LDKCOption_CustomOnionMessageContentsZ_None_meth);
9515                 }
9516                 default: abort();
9517         }
9518 }
9519 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9520 CHECK(owner->result_ok);
9521         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
9522 }
9523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9524         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9525         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
9526         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
9527         int64_t ret_ref = tag_ptr(ret_copy, true);
9528         return ret_ref;
9529 }
9530
9531 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9532 CHECK(!owner->result_ok);
9533         return DecodeError_clone(&*owner->contents.err);
9534 }
9535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9536         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9537         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9538         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
9539         int64_t ret_ref = tag_ptr(ret_copy, true);
9540         return ret_ref;
9541 }
9542
9543 static jclass LDKCOption_TypeZ_Some_class = NULL;
9544 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
9545 static jclass LDKCOption_TypeZ_None_class = NULL;
9546 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
9547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
9548         LDKCOption_TypeZ_Some_class =
9549                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
9550         CHECK(LDKCOption_TypeZ_Some_class != NULL);
9551         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
9552         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
9553         LDKCOption_TypeZ_None_class =
9554                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
9555         CHECK(LDKCOption_TypeZ_None_class != NULL);
9556         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
9557         CHECK(LDKCOption_TypeZ_None_meth != NULL);
9558 }
9559 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9560         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
9561         switch(obj->tag) {
9562                 case LDKCOption_TypeZ_Some: {
9563                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
9564                         *some_ret = Type_clone(&obj->some);
9565                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
9566                 }
9567                 case LDKCOption_TypeZ_None: {
9568                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
9569                 }
9570                 default: abort();
9571         }
9572 }
9573 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
9574 CHECK(owner->result_ok);
9575         return COption_TypeZ_clone(&*owner->contents.result);
9576 }
9577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9578         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
9579         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9580         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
9581         int64_t ret_ref = tag_ptr(ret_copy, true);
9582         return ret_ref;
9583 }
9584
9585 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
9586 CHECK(!owner->result_ok);
9587         return DecodeError_clone(&*owner->contents.err);
9588 }
9589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9590         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
9591         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9592         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
9593         int64_t ret_ref = tag_ptr(ret_copy, true);
9594         return ret_ref;
9595 }
9596
9597 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
9598 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
9599 static jclass LDKCOption_NetAddressZ_None_class = NULL;
9600 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
9601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
9602         LDKCOption_NetAddressZ_Some_class =
9603                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
9604         CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
9605         LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
9606         CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
9607         LDKCOption_NetAddressZ_None_class =
9608                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
9609         CHECK(LDKCOption_NetAddressZ_None_class != NULL);
9610         LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
9611         CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
9612 }
9613 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9614         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
9615         switch(obj->tag) {
9616                 case LDKCOption_NetAddressZ_Some: {
9617                         int64_t some_ref = tag_ptr(&obj->some, false);
9618                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
9619                 }
9620                 case LDKCOption_NetAddressZ_None: {
9621                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
9622                 }
9623                 default: abort();
9624         }
9625 }
9626 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
9627         return owner->a;
9628 }
9629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9630         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
9631         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9632         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form);
9633         return ret_arr;
9634 }
9635
9636 static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
9637         return COption_NetAddressZ_clone(&owner->b);
9638 }
9639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9640         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
9641         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
9642         *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv);
9643         int64_t ret_ref = tag_ptr(ret_copy, true);
9644         return ret_ref;
9645 }
9646
9647 static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) {
9648         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen };
9649         for (size_t i = 0; i < ret.datalen; i++) {
9650                 ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]);
9651         }
9652         return ret;
9653 }
9654 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
9655 CHECK(owner->result_ok);
9656         return CVec_u8Z_clone(&*owner->contents.result);
9657 }
9658 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9659         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
9660         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
9661         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9662         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9663         CVec_u8Z_free(ret_var);
9664         return ret_arr;
9665 }
9666
9667 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
9668         LDKPeerHandleError ret = *owner->contents.err;
9669         ret.is_owned = false;
9670         return ret;
9671 }
9672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9673         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
9674         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
9675         int64_t ret_ref = 0;
9676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9678         return ret_ref;
9679 }
9680
9681 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
9682 CHECK(owner->result_ok);
9683         return *owner->contents.result;
9684 }
9685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9686         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
9687         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
9688 }
9689
9690 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
9691         LDKPeerHandleError ret = *owner->contents.err;
9692         ret.is_owned = false;
9693         return ret;
9694 }
9695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9696         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
9697         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
9698         int64_t ret_ref = 0;
9699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9701         return ret_ref;
9702 }
9703
9704 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9705 CHECK(owner->result_ok);
9706         return *owner->contents.result;
9707 }
9708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9709         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9710         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
9711         return ret_conv;
9712 }
9713
9714 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9715         LDKPeerHandleError ret = *owner->contents.err;
9716         ret.is_owned = false;
9717         return ret;
9718 }
9719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9720         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9721         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
9722         int64_t ret_ref = 0;
9723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9725         return ret_ref;
9726 }
9727
9728 static jclass LDKGraphSyncError_DecodeError_class = NULL;
9729 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
9730 static jclass LDKGraphSyncError_LightningError_class = NULL;
9731 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
9732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
9733         LDKGraphSyncError_DecodeError_class =
9734                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
9735         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
9736         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
9737         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
9738         LDKGraphSyncError_LightningError_class =
9739                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
9740         CHECK(LDKGraphSyncError_LightningError_class != NULL);
9741         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
9742         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
9743 }
9744 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9745         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
9746         switch(obj->tag) {
9747                 case LDKGraphSyncError_DecodeError: {
9748                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
9749                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
9750                 }
9751                 case LDKGraphSyncError_LightningError: {
9752                         LDKLightningError lightning_error_var = obj->lightning_error;
9753                         int64_t lightning_error_ref = 0;
9754                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
9755                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
9756                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
9757                 }
9758                 default: abort();
9759         }
9760 }
9761 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
9762 CHECK(owner->result_ok);
9763         return *owner->contents.result;
9764 }
9765 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9766         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
9767         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
9768         return ret_conv;
9769 }
9770
9771 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
9772 CHECK(!owner->result_ok);
9773         return GraphSyncError_clone(&*owner->contents.err);
9774 }
9775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9776         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
9777         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
9778         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
9779         int64_t ret_ref = tag_ptr(ret_copy, true);
9780         return ret_ref;
9781 }
9782
9783 static jclass LDKCOption_KeyPairZ_Some_class = NULL;
9784 static jmethodID LDKCOption_KeyPairZ_Some_meth = NULL;
9785 static jclass LDKCOption_KeyPairZ_None_class = NULL;
9786 static jmethodID LDKCOption_KeyPairZ_None_meth = NULL;
9787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1KeyPairZ_init (JNIEnv *env, jclass clz) {
9788         LDKCOption_KeyPairZ_Some_class =
9789                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_KeyPairZ$Some"));
9790         CHECK(LDKCOption_KeyPairZ_Some_class != NULL);
9791         LDKCOption_KeyPairZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_KeyPairZ_Some_class, "<init>", "([B)V");
9792         CHECK(LDKCOption_KeyPairZ_Some_meth != NULL);
9793         LDKCOption_KeyPairZ_None_class =
9794                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_KeyPairZ$None"));
9795         CHECK(LDKCOption_KeyPairZ_None_class != NULL);
9796         LDKCOption_KeyPairZ_None_meth = (*env)->GetMethodID(env, LDKCOption_KeyPairZ_None_class, "<init>", "()V");
9797         CHECK(LDKCOption_KeyPairZ_None_meth != NULL);
9798 }
9799 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1KeyPairZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9800         LDKCOption_KeyPairZ *obj = (LDKCOption_KeyPairZ*)untag_ptr(ptr);
9801         switch(obj->tag) {
9802                 case LDKCOption_KeyPairZ_Some: {
9803                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
9804                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
9805                         return (*env)->NewObject(env, LDKCOption_KeyPairZ_Some_class, LDKCOption_KeyPairZ_Some_meth, some_arr);
9806                 }
9807                 case LDKCOption_KeyPairZ_None: {
9808                         return (*env)->NewObject(env, LDKCOption_KeyPairZ_None_class, LDKCOption_KeyPairZ_None_meth);
9809                 }
9810                 default: abort();
9811         }
9812 }
9813 static inline struct LDKCOption_KeyPairZ CResult_COption_KeyPairZNoneZ_get_ok(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR owner){
9814 CHECK(owner->result_ok);
9815         return COption_KeyPairZ_clone(&*owner->contents.result);
9816 }
9817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9818         LDKCResult_COption_KeyPairZNoneZ* owner_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(owner);
9819         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
9820         *ret_copy = CResult_COption_KeyPairZNoneZ_get_ok(owner_conv);
9821         int64_t ret_ref = tag_ptr(ret_copy, true);
9822         return ret_ref;
9823 }
9824
9825 static inline void CResult_COption_KeyPairZNoneZ_get_err(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR owner){
9826 CHECK(!owner->result_ok);
9827         return *owner->contents.err;
9828 }
9829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9830         LDKCResult_COption_KeyPairZNoneZ* owner_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(owner);
9831         CResult_COption_KeyPairZNoneZ_get_err(owner_conv);
9832 }
9833
9834 static jclass LDKCOption_ScriptZ_Some_class = NULL;
9835 static jmethodID LDKCOption_ScriptZ_Some_meth = NULL;
9836 static jclass LDKCOption_ScriptZ_None_class = NULL;
9837 static jmethodID LDKCOption_ScriptZ_None_meth = NULL;
9838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ScriptZ_init (JNIEnv *env, jclass clz) {
9839         LDKCOption_ScriptZ_Some_class =
9840                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScriptZ$Some"));
9841         CHECK(LDKCOption_ScriptZ_Some_class != NULL);
9842         LDKCOption_ScriptZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ScriptZ_Some_class, "<init>", "([B)V");
9843         CHECK(LDKCOption_ScriptZ_Some_meth != NULL);
9844         LDKCOption_ScriptZ_None_class =
9845                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScriptZ$None"));
9846         CHECK(LDKCOption_ScriptZ_None_class != NULL);
9847         LDKCOption_ScriptZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ScriptZ_None_class, "<init>", "()V");
9848         CHECK(LDKCOption_ScriptZ_None_meth != NULL);
9849 }
9850 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ScriptZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9851         LDKCOption_ScriptZ *obj = (LDKCOption_ScriptZ*)untag_ptr(ptr);
9852         switch(obj->tag) {
9853                 case LDKCOption_ScriptZ_Some: {
9854                         LDKCVec_u8Z some_var = obj->some;
9855                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
9856                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
9857                         return (*env)->NewObject(env, LDKCOption_ScriptZ_Some_class, LDKCOption_ScriptZ_Some_meth, some_arr);
9858                 }
9859                 case LDKCOption_ScriptZ_None: {
9860                         return (*env)->NewObject(env, LDKCOption_ScriptZ_None_class, LDKCOption_ScriptZ_None_meth);
9861                 }
9862                 default: abort();
9863         }
9864 }
9865 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
9866         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
9867         for (size_t i = 0; i < ret.datalen; i++) {
9868                 ret.data[i] = Witness_clone(&orig->data[i]);
9869         }
9870         return ret;
9871 }
9872 static jclass LDKCOption_i64Z_Some_class = NULL;
9873 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
9874 static jclass LDKCOption_i64Z_None_class = NULL;
9875 static jmethodID LDKCOption_i64Z_None_meth = NULL;
9876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
9877         LDKCOption_i64Z_Some_class =
9878                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
9879         CHECK(LDKCOption_i64Z_Some_class != NULL);
9880         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
9881         CHECK(LDKCOption_i64Z_Some_meth != NULL);
9882         LDKCOption_i64Z_None_class =
9883                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
9884         CHECK(LDKCOption_i64Z_None_class != NULL);
9885         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
9886         CHECK(LDKCOption_i64Z_None_meth != NULL);
9887 }
9888 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9889         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
9890         switch(obj->tag) {
9891                 case LDKCOption_i64Z_Some: {
9892                         int64_t some_conv = obj->some;
9893                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
9894                 }
9895                 case LDKCOption_i64Z_None: {
9896                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
9897                 }
9898                 default: abort();
9899         }
9900 }
9901 static jclass LDKCOption_TxidZ_Some_class = NULL;
9902 static jmethodID LDKCOption_TxidZ_Some_meth = NULL;
9903 static jclass LDKCOption_TxidZ_None_class = NULL;
9904 static jmethodID LDKCOption_TxidZ_None_meth = NULL;
9905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxidZ_init (JNIEnv *env, jclass clz) {
9906         LDKCOption_TxidZ_Some_class =
9907                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxidZ$Some"));
9908         CHECK(LDKCOption_TxidZ_Some_class != NULL);
9909         LDKCOption_TxidZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxidZ_Some_class, "<init>", "([B)V");
9910         CHECK(LDKCOption_TxidZ_Some_meth != NULL);
9911         LDKCOption_TxidZ_None_class =
9912                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxidZ$None"));
9913         CHECK(LDKCOption_TxidZ_None_class != NULL);
9914         LDKCOption_TxidZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxidZ_None_class, "<init>", "()V");
9915         CHECK(LDKCOption_TxidZ_None_meth != NULL);
9916 }
9917 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxidZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9918         LDKCOption_TxidZ *obj = (LDKCOption_TxidZ*)untag_ptr(ptr);
9919         switch(obj->tag) {
9920                 case LDKCOption_TxidZ_Some: {
9921                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
9922                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
9923                         return (*env)->NewObject(env, LDKCOption_TxidZ_Some_class, LDKCOption_TxidZ_Some_meth, some_arr);
9924                 }
9925                 case LDKCOption_TxidZ_None: {
9926                         return (*env)->NewObject(env, LDKCOption_TxidZ_None_class, LDKCOption_TxidZ_None_meth);
9927                 }
9928                 default: abort();
9929         }
9930 }
9931 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
9932 CHECK(owner->result_ok);
9933         return NetAddress_clone(&*owner->contents.result);
9934 }
9935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9936         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
9937         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9938         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
9939         int64_t ret_ref = tag_ptr(ret_copy, true);
9940         return ret_ref;
9941 }
9942
9943 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
9944 CHECK(!owner->result_ok);
9945         return DecodeError_clone(&*owner->contents.err);
9946 }
9947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9948         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
9949         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9950         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
9951         int64_t ret_ref = tag_ptr(ret_copy, true);
9952         return ret_ref;
9953 }
9954
9955 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
9956         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
9957         for (size_t i = 0; i < ret.datalen; i++) {
9958                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
9959         }
9960         return ret;
9961 }
9962 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
9963         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
9964         for (size_t i = 0; i < ret.datalen; i++) {
9965                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
9966         }
9967         return ret;
9968 }
9969 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
9970         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
9971         for (size_t i = 0; i < ret.datalen; i++) {
9972                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
9973         }
9974         return ret;
9975 }
9976 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
9977         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
9978         for (size_t i = 0; i < ret.datalen; i++) {
9979                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
9980         }
9981         return ret;
9982 }
9983 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9984         LDKAcceptChannel ret = *owner->contents.result;
9985         ret.is_owned = false;
9986         return ret;
9987 }
9988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9989         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
9990         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
9991         int64_t ret_ref = 0;
9992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9994         return ret_ref;
9995 }
9996
9997 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9998 CHECK(!owner->result_ok);
9999         return DecodeError_clone(&*owner->contents.err);
10000 }
10001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10002         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10003         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10004         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
10005         int64_t ret_ref = tag_ptr(ret_copy, true);
10006         return ret_ref;
10007 }
10008
10009 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10010         LDKAcceptChannelV2 ret = *owner->contents.result;
10011         ret.is_owned = false;
10012         return ret;
10013 }
10014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10015         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10016         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
10017         int64_t ret_ref = 0;
10018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10020         return ret_ref;
10021 }
10022
10023 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10024 CHECK(!owner->result_ok);
10025         return DecodeError_clone(&*owner->contents.err);
10026 }
10027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10028         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10029         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10030         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
10031         int64_t ret_ref = tag_ptr(ret_copy, true);
10032         return ret_ref;
10033 }
10034
10035 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10036         LDKTxAddInput ret = *owner->contents.result;
10037         ret.is_owned = false;
10038         return ret;
10039 }
10040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10041         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10042         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
10043         int64_t ret_ref = 0;
10044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10046         return ret_ref;
10047 }
10048
10049 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10050 CHECK(!owner->result_ok);
10051         return DecodeError_clone(&*owner->contents.err);
10052 }
10053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10054         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10055         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10056         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
10057         int64_t ret_ref = tag_ptr(ret_copy, true);
10058         return ret_ref;
10059 }
10060
10061 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10062         LDKTxAddOutput ret = *owner->contents.result;
10063         ret.is_owned = false;
10064         return ret;
10065 }
10066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10067         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10068         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
10069         int64_t ret_ref = 0;
10070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10072         return ret_ref;
10073 }
10074
10075 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10076 CHECK(!owner->result_ok);
10077         return DecodeError_clone(&*owner->contents.err);
10078 }
10079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10080         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10081         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10082         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
10083         int64_t ret_ref = tag_ptr(ret_copy, true);
10084         return ret_ref;
10085 }
10086
10087 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10088         LDKTxRemoveInput ret = *owner->contents.result;
10089         ret.is_owned = false;
10090         return ret;
10091 }
10092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10093         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10094         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
10095         int64_t ret_ref = 0;
10096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10098         return ret_ref;
10099 }
10100
10101 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10102 CHECK(!owner->result_ok);
10103         return DecodeError_clone(&*owner->contents.err);
10104 }
10105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10106         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10107         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10108         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
10109         int64_t ret_ref = tag_ptr(ret_copy, true);
10110         return ret_ref;
10111 }
10112
10113 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10114         LDKTxRemoveOutput ret = *owner->contents.result;
10115         ret.is_owned = false;
10116         return ret;
10117 }
10118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10119         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10120         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
10121         int64_t ret_ref = 0;
10122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10124         return ret_ref;
10125 }
10126
10127 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10128 CHECK(!owner->result_ok);
10129         return DecodeError_clone(&*owner->contents.err);
10130 }
10131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10132         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10133         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10134         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
10135         int64_t ret_ref = tag_ptr(ret_copy, true);
10136         return ret_ref;
10137 }
10138
10139 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10140         LDKTxComplete ret = *owner->contents.result;
10141         ret.is_owned = false;
10142         return ret;
10143 }
10144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10145         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10146         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
10147         int64_t ret_ref = 0;
10148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10150         return ret_ref;
10151 }
10152
10153 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10154 CHECK(!owner->result_ok);
10155         return DecodeError_clone(&*owner->contents.err);
10156 }
10157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10158         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10159         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10160         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
10161         int64_t ret_ref = tag_ptr(ret_copy, true);
10162         return ret_ref;
10163 }
10164
10165 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10166         LDKTxSignatures ret = *owner->contents.result;
10167         ret.is_owned = false;
10168         return ret;
10169 }
10170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10171         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10172         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
10173         int64_t ret_ref = 0;
10174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10176         return ret_ref;
10177 }
10178
10179 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10180 CHECK(!owner->result_ok);
10181         return DecodeError_clone(&*owner->contents.err);
10182 }
10183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10184         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10185         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10186         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
10187         int64_t ret_ref = tag_ptr(ret_copy, true);
10188         return ret_ref;
10189 }
10190
10191 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10192         LDKTxInitRbf ret = *owner->contents.result;
10193         ret.is_owned = false;
10194         return ret;
10195 }
10196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10197         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10198         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
10199         int64_t ret_ref = 0;
10200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10202         return ret_ref;
10203 }
10204
10205 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10206 CHECK(!owner->result_ok);
10207         return DecodeError_clone(&*owner->contents.err);
10208 }
10209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10210         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10211         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10212         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
10213         int64_t ret_ref = tag_ptr(ret_copy, true);
10214         return ret_ref;
10215 }
10216
10217 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10218         LDKTxAckRbf ret = *owner->contents.result;
10219         ret.is_owned = false;
10220         return ret;
10221 }
10222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10223         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10224         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
10225         int64_t ret_ref = 0;
10226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10228         return ret_ref;
10229 }
10230
10231 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10232 CHECK(!owner->result_ok);
10233         return DecodeError_clone(&*owner->contents.err);
10234 }
10235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10236         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10237         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10238         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
10239         int64_t ret_ref = tag_ptr(ret_copy, true);
10240         return ret_ref;
10241 }
10242
10243 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10244         LDKTxAbort ret = *owner->contents.result;
10245         ret.is_owned = false;
10246         return ret;
10247 }
10248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10249         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10250         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
10251         int64_t ret_ref = 0;
10252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10254         return ret_ref;
10255 }
10256
10257 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10258 CHECK(!owner->result_ok);
10259         return DecodeError_clone(&*owner->contents.err);
10260 }
10261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10262         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10263         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10264         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
10265         int64_t ret_ref = tag_ptr(ret_copy, true);
10266         return ret_ref;
10267 }
10268
10269 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10270         LDKAnnouncementSignatures ret = *owner->contents.result;
10271         ret.is_owned = false;
10272         return ret;
10273 }
10274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10275         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10276         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
10277         int64_t ret_ref = 0;
10278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10280         return ret_ref;
10281 }
10282
10283 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10284 CHECK(!owner->result_ok);
10285         return DecodeError_clone(&*owner->contents.err);
10286 }
10287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10288         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10289         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10290         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
10291         int64_t ret_ref = tag_ptr(ret_copy, true);
10292         return ret_ref;
10293 }
10294
10295 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10296         LDKChannelReestablish ret = *owner->contents.result;
10297         ret.is_owned = false;
10298         return ret;
10299 }
10300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10301         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10302         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
10303         int64_t ret_ref = 0;
10304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10306         return ret_ref;
10307 }
10308
10309 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10310 CHECK(!owner->result_ok);
10311         return DecodeError_clone(&*owner->contents.err);
10312 }
10313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10314         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10315         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10316         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
10317         int64_t ret_ref = tag_ptr(ret_copy, true);
10318         return ret_ref;
10319 }
10320
10321 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10322         LDKClosingSigned ret = *owner->contents.result;
10323         ret.is_owned = false;
10324         return ret;
10325 }
10326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10327         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10328         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
10329         int64_t ret_ref = 0;
10330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10332         return ret_ref;
10333 }
10334
10335 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10336 CHECK(!owner->result_ok);
10337         return DecodeError_clone(&*owner->contents.err);
10338 }
10339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10340         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10341         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10342         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
10343         int64_t ret_ref = tag_ptr(ret_copy, true);
10344         return ret_ref;
10345 }
10346
10347 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10348         LDKClosingSignedFeeRange ret = *owner->contents.result;
10349         ret.is_owned = false;
10350         return ret;
10351 }
10352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10353         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10354         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
10355         int64_t ret_ref = 0;
10356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10358         return ret_ref;
10359 }
10360
10361 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10362 CHECK(!owner->result_ok);
10363         return DecodeError_clone(&*owner->contents.err);
10364 }
10365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10366         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10367         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10368         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
10369         int64_t ret_ref = tag_ptr(ret_copy, true);
10370         return ret_ref;
10371 }
10372
10373 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10374         LDKCommitmentSigned ret = *owner->contents.result;
10375         ret.is_owned = false;
10376         return ret;
10377 }
10378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10379         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10380         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
10381         int64_t ret_ref = 0;
10382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10384         return ret_ref;
10385 }
10386
10387 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10388 CHECK(!owner->result_ok);
10389         return DecodeError_clone(&*owner->contents.err);
10390 }
10391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10392         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10393         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10394         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
10395         int64_t ret_ref = tag_ptr(ret_copy, true);
10396         return ret_ref;
10397 }
10398
10399 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10400         LDKFundingCreated ret = *owner->contents.result;
10401         ret.is_owned = false;
10402         return ret;
10403 }
10404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10405         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10406         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
10407         int64_t ret_ref = 0;
10408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10410         return ret_ref;
10411 }
10412
10413 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10414 CHECK(!owner->result_ok);
10415         return DecodeError_clone(&*owner->contents.err);
10416 }
10417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10418         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10419         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10420         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
10421         int64_t ret_ref = tag_ptr(ret_copy, true);
10422         return ret_ref;
10423 }
10424
10425 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10426         LDKFundingSigned ret = *owner->contents.result;
10427         ret.is_owned = false;
10428         return ret;
10429 }
10430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10431         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10432         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
10433         int64_t ret_ref = 0;
10434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10436         return ret_ref;
10437 }
10438
10439 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10440 CHECK(!owner->result_ok);
10441         return DecodeError_clone(&*owner->contents.err);
10442 }
10443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10444         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10445         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10446         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
10447         int64_t ret_ref = tag_ptr(ret_copy, true);
10448         return ret_ref;
10449 }
10450
10451 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10452         LDKChannelReady ret = *owner->contents.result;
10453         ret.is_owned = false;
10454         return ret;
10455 }
10456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10457         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10458         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
10459         int64_t ret_ref = 0;
10460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10462         return ret_ref;
10463 }
10464
10465 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10466 CHECK(!owner->result_ok);
10467         return DecodeError_clone(&*owner->contents.err);
10468 }
10469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10470         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10471         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10472         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
10473         int64_t ret_ref = tag_ptr(ret_copy, true);
10474         return ret_ref;
10475 }
10476
10477 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10478         LDKInit ret = *owner->contents.result;
10479         ret.is_owned = false;
10480         return ret;
10481 }
10482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10483         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10484         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
10485         int64_t ret_ref = 0;
10486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10488         return ret_ref;
10489 }
10490
10491 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10492 CHECK(!owner->result_ok);
10493         return DecodeError_clone(&*owner->contents.err);
10494 }
10495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10496         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10497         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10498         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
10499         int64_t ret_ref = tag_ptr(ret_copy, true);
10500         return ret_ref;
10501 }
10502
10503 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10504         LDKOpenChannel ret = *owner->contents.result;
10505         ret.is_owned = false;
10506         return ret;
10507 }
10508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10509         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10510         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
10511         int64_t ret_ref = 0;
10512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10514         return ret_ref;
10515 }
10516
10517 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10518 CHECK(!owner->result_ok);
10519         return DecodeError_clone(&*owner->contents.err);
10520 }
10521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10522         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10523         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10524         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
10525         int64_t ret_ref = tag_ptr(ret_copy, true);
10526         return ret_ref;
10527 }
10528
10529 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
10530         LDKOpenChannelV2 ret = *owner->contents.result;
10531         ret.is_owned = false;
10532         return ret;
10533 }
10534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10535         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
10536         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
10537         int64_t ret_ref = 0;
10538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10540         return ret_ref;
10541 }
10542
10543 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
10544 CHECK(!owner->result_ok);
10545         return DecodeError_clone(&*owner->contents.err);
10546 }
10547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10548         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
10549         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10550         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
10551         int64_t ret_ref = tag_ptr(ret_copy, true);
10552         return ret_ref;
10553 }
10554
10555 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10556         LDKRevokeAndACK ret = *owner->contents.result;
10557         ret.is_owned = false;
10558         return ret;
10559 }
10560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10561         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10562         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
10563         int64_t ret_ref = 0;
10564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10566         return ret_ref;
10567 }
10568
10569 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10570 CHECK(!owner->result_ok);
10571         return DecodeError_clone(&*owner->contents.err);
10572 }
10573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10574         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10575         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10576         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
10577         int64_t ret_ref = tag_ptr(ret_copy, true);
10578         return ret_ref;
10579 }
10580
10581 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10582         LDKShutdown ret = *owner->contents.result;
10583         ret.is_owned = false;
10584         return ret;
10585 }
10586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10587         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10588         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
10589         int64_t ret_ref = 0;
10590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10592         return ret_ref;
10593 }
10594
10595 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10596 CHECK(!owner->result_ok);
10597         return DecodeError_clone(&*owner->contents.err);
10598 }
10599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10600         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10601         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10602         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
10603         int64_t ret_ref = tag_ptr(ret_copy, true);
10604         return ret_ref;
10605 }
10606
10607 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10608         LDKUpdateFailHTLC ret = *owner->contents.result;
10609         ret.is_owned = false;
10610         return ret;
10611 }
10612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10613         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10614         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
10615         int64_t ret_ref = 0;
10616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10618         return ret_ref;
10619 }
10620
10621 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10622 CHECK(!owner->result_ok);
10623         return DecodeError_clone(&*owner->contents.err);
10624 }
10625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10626         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10627         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10628         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
10629         int64_t ret_ref = tag_ptr(ret_copy, true);
10630         return ret_ref;
10631 }
10632
10633 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10634         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
10635         ret.is_owned = false;
10636         return ret;
10637 }
10638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10639         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10640         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
10641         int64_t ret_ref = 0;
10642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10644         return ret_ref;
10645 }
10646
10647 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10648 CHECK(!owner->result_ok);
10649         return DecodeError_clone(&*owner->contents.err);
10650 }
10651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10652         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10653         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10654         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
10655         int64_t ret_ref = tag_ptr(ret_copy, true);
10656         return ret_ref;
10657 }
10658
10659 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10660         LDKUpdateFee ret = *owner->contents.result;
10661         ret.is_owned = false;
10662         return ret;
10663 }
10664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10665         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10666         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
10667         int64_t ret_ref = 0;
10668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10670         return ret_ref;
10671 }
10672
10673 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10674 CHECK(!owner->result_ok);
10675         return DecodeError_clone(&*owner->contents.err);
10676 }
10677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10678         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10679         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10680         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
10681         int64_t ret_ref = tag_ptr(ret_copy, true);
10682         return ret_ref;
10683 }
10684
10685 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10686         LDKUpdateFulfillHTLC ret = *owner->contents.result;
10687         ret.is_owned = false;
10688         return ret;
10689 }
10690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10691         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10692         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
10693         int64_t ret_ref = 0;
10694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10696         return ret_ref;
10697 }
10698
10699 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10700 CHECK(!owner->result_ok);
10701         return DecodeError_clone(&*owner->contents.err);
10702 }
10703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10704         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10705         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10706         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
10707         int64_t ret_ref = tag_ptr(ret_copy, true);
10708         return ret_ref;
10709 }
10710
10711 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10712         LDKUpdateAddHTLC ret = *owner->contents.result;
10713         ret.is_owned = false;
10714         return ret;
10715 }
10716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10717         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10718         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
10719         int64_t ret_ref = 0;
10720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10722         return ret_ref;
10723 }
10724
10725 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10726 CHECK(!owner->result_ok);
10727         return DecodeError_clone(&*owner->contents.err);
10728 }
10729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10730         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10731         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10732         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
10733         int64_t ret_ref = tag_ptr(ret_copy, true);
10734         return ret_ref;
10735 }
10736
10737 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10738         LDKOnionMessage ret = *owner->contents.result;
10739         ret.is_owned = false;
10740         return ret;
10741 }
10742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10743         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10744         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
10745         int64_t ret_ref = 0;
10746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10748         return ret_ref;
10749 }
10750
10751 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10752 CHECK(!owner->result_ok);
10753         return DecodeError_clone(&*owner->contents.err);
10754 }
10755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10756         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10757         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10758         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
10759         int64_t ret_ref = tag_ptr(ret_copy, true);
10760         return ret_ref;
10761 }
10762
10763 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
10764         LDKPing ret = *owner->contents.result;
10765         ret.is_owned = false;
10766         return ret;
10767 }
10768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10769         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
10770         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
10771         int64_t ret_ref = 0;
10772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10774         return ret_ref;
10775 }
10776
10777 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
10778 CHECK(!owner->result_ok);
10779         return DecodeError_clone(&*owner->contents.err);
10780 }
10781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10782         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
10783         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10784         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
10785         int64_t ret_ref = tag_ptr(ret_copy, true);
10786         return ret_ref;
10787 }
10788
10789 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
10790         LDKPong ret = *owner->contents.result;
10791         ret.is_owned = false;
10792         return ret;
10793 }
10794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10795         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
10796         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
10797         int64_t ret_ref = 0;
10798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10800         return ret_ref;
10801 }
10802
10803 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
10804 CHECK(!owner->result_ok);
10805         return DecodeError_clone(&*owner->contents.err);
10806 }
10807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10808         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
10809         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10810         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
10811         int64_t ret_ref = tag_ptr(ret_copy, true);
10812         return ret_ref;
10813 }
10814
10815 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10816         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
10817         ret.is_owned = false;
10818         return ret;
10819 }
10820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10821         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10822         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
10823         int64_t ret_ref = 0;
10824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10826         return ret_ref;
10827 }
10828
10829 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10830 CHECK(!owner->result_ok);
10831         return DecodeError_clone(&*owner->contents.err);
10832 }
10833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10834         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10835         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10836         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
10837         int64_t ret_ref = tag_ptr(ret_copy, true);
10838         return ret_ref;
10839 }
10840
10841 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10842         LDKChannelAnnouncement ret = *owner->contents.result;
10843         ret.is_owned = false;
10844         return ret;
10845 }
10846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10847         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10848         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
10849         int64_t ret_ref = 0;
10850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10852         return ret_ref;
10853 }
10854
10855 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10856 CHECK(!owner->result_ok);
10857         return DecodeError_clone(&*owner->contents.err);
10858 }
10859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10860         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10861         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10862         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
10863         int64_t ret_ref = tag_ptr(ret_copy, true);
10864         return ret_ref;
10865 }
10866
10867 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10868         LDKUnsignedChannelUpdate ret = *owner->contents.result;
10869         ret.is_owned = false;
10870         return ret;
10871 }
10872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10873         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10874         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
10875         int64_t ret_ref = 0;
10876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10878         return ret_ref;
10879 }
10880
10881 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10882 CHECK(!owner->result_ok);
10883         return DecodeError_clone(&*owner->contents.err);
10884 }
10885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10886         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10887         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10888         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
10889         int64_t ret_ref = tag_ptr(ret_copy, true);
10890         return ret_ref;
10891 }
10892
10893 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10894         LDKChannelUpdate ret = *owner->contents.result;
10895         ret.is_owned = false;
10896         return ret;
10897 }
10898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10899         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10900         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
10901         int64_t ret_ref = 0;
10902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10904         return ret_ref;
10905 }
10906
10907 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10908 CHECK(!owner->result_ok);
10909         return DecodeError_clone(&*owner->contents.err);
10910 }
10911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10912         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10913         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10914         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
10915         int64_t ret_ref = tag_ptr(ret_copy, true);
10916         return ret_ref;
10917 }
10918
10919 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
10920         LDKErrorMessage ret = *owner->contents.result;
10921         ret.is_owned = false;
10922         return ret;
10923 }
10924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10925         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
10926         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
10927         int64_t ret_ref = 0;
10928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10930         return ret_ref;
10931 }
10932
10933 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
10934 CHECK(!owner->result_ok);
10935         return DecodeError_clone(&*owner->contents.err);
10936 }
10937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10938         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
10939         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10940         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
10941         int64_t ret_ref = tag_ptr(ret_copy, true);
10942         return ret_ref;
10943 }
10944
10945 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
10946         LDKWarningMessage ret = *owner->contents.result;
10947         ret.is_owned = false;
10948         return ret;
10949 }
10950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10951         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
10952         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
10953         int64_t ret_ref = 0;
10954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10956         return ret_ref;
10957 }
10958
10959 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
10960 CHECK(!owner->result_ok);
10961         return DecodeError_clone(&*owner->contents.err);
10962 }
10963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10964         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
10965         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10966         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
10967         int64_t ret_ref = tag_ptr(ret_copy, true);
10968         return ret_ref;
10969 }
10970
10971 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10972         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
10973         ret.is_owned = false;
10974         return ret;
10975 }
10976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10977         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10978         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
10979         int64_t ret_ref = 0;
10980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10982         return ret_ref;
10983 }
10984
10985 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10986 CHECK(!owner->result_ok);
10987         return DecodeError_clone(&*owner->contents.err);
10988 }
10989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10990         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10991         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10992         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10993         int64_t ret_ref = tag_ptr(ret_copy, true);
10994         return ret_ref;
10995 }
10996
10997 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10998         LDKNodeAnnouncement ret = *owner->contents.result;
10999         ret.is_owned = false;
11000         return ret;
11001 }
11002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11003         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11004         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11005         int64_t ret_ref = 0;
11006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11008         return ret_ref;
11009 }
11010
11011 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11012 CHECK(!owner->result_ok);
11013         return DecodeError_clone(&*owner->contents.err);
11014 }
11015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11016         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11017         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11018         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11019         int64_t ret_ref = tag_ptr(ret_copy, true);
11020         return ret_ref;
11021 }
11022
11023 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11024         LDKQueryShortChannelIds ret = *owner->contents.result;
11025         ret.is_owned = false;
11026         return ret;
11027 }
11028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11029         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11030         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
11031         int64_t ret_ref = 0;
11032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11034         return ret_ref;
11035 }
11036
11037 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11038 CHECK(!owner->result_ok);
11039         return DecodeError_clone(&*owner->contents.err);
11040 }
11041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11042         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11043         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11044         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
11045         int64_t ret_ref = tag_ptr(ret_copy, true);
11046         return ret_ref;
11047 }
11048
11049 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11050         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
11051         ret.is_owned = false;
11052         return ret;
11053 }
11054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11055         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11056         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
11057         int64_t ret_ref = 0;
11058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11060         return ret_ref;
11061 }
11062
11063 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11064 CHECK(!owner->result_ok);
11065         return DecodeError_clone(&*owner->contents.err);
11066 }
11067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11068         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11069         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11070         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
11071         int64_t ret_ref = tag_ptr(ret_copy, true);
11072         return ret_ref;
11073 }
11074
11075 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11076         LDKQueryChannelRange ret = *owner->contents.result;
11077         ret.is_owned = false;
11078         return ret;
11079 }
11080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11081         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11082         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
11083         int64_t ret_ref = 0;
11084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11086         return ret_ref;
11087 }
11088
11089 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11090 CHECK(!owner->result_ok);
11091         return DecodeError_clone(&*owner->contents.err);
11092 }
11093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11094         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11095         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11096         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
11097         int64_t ret_ref = tag_ptr(ret_copy, true);
11098         return ret_ref;
11099 }
11100
11101 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11102         LDKReplyChannelRange ret = *owner->contents.result;
11103         ret.is_owned = false;
11104         return ret;
11105 }
11106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11107         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11108         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
11109         int64_t ret_ref = 0;
11110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11112         return ret_ref;
11113 }
11114
11115 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11116 CHECK(!owner->result_ok);
11117         return DecodeError_clone(&*owner->contents.err);
11118 }
11119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11120         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11121         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11122         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
11123         int64_t ret_ref = tag_ptr(ret_copy, true);
11124         return ret_ref;
11125 }
11126
11127 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11128         LDKGossipTimestampFilter ret = *owner->contents.result;
11129         ret.is_owned = false;
11130         return ret;
11131 }
11132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11133         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11134         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
11135         int64_t ret_ref = 0;
11136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11138         return ret_ref;
11139 }
11140
11141 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11142 CHECK(!owner->result_ok);
11143         return DecodeError_clone(&*owner->contents.err);
11144 }
11145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11146         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11147         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11148         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
11149         int64_t ret_ref = tag_ptr(ret_copy, true);
11150         return ret_ref;
11151 }
11152
11153 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
11154         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
11155         for (size_t i = 0; i < ret.datalen; i++) {
11156                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
11157         }
11158         return ret;
11159 }
11160 static jclass LDKSignOrCreationError_SignError_class = NULL;
11161 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
11162 static jclass LDKSignOrCreationError_CreationError_class = NULL;
11163 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
11164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
11165         LDKSignOrCreationError_SignError_class =
11166                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
11167         CHECK(LDKSignOrCreationError_SignError_class != NULL);
11168         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
11169         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
11170         LDKSignOrCreationError_CreationError_class =
11171                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
11172         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
11173         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
11174         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
11175 }
11176 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11177         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
11178         switch(obj->tag) {
11179                 case LDKSignOrCreationError_SignError: {
11180                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
11181                 }
11182                 case LDKSignOrCreationError_CreationError: {
11183                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
11184                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
11185                 }
11186                 default: abort();
11187         }
11188 }
11189 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11190         LDKBolt11Invoice ret = *owner->contents.result;
11191         ret.is_owned = false;
11192         return ret;
11193 }
11194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11195         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11196         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
11197         int64_t ret_ref = 0;
11198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11200         return ret_ref;
11201 }
11202
11203 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11204 CHECK(!owner->result_ok);
11205         return SignOrCreationError_clone(&*owner->contents.err);
11206 }
11207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11208         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11209         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
11210         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
11211         int64_t ret_ref = tag_ptr(ret_copy, true);
11212         return ret_ref;
11213 }
11214
11215 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
11216         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
11217         for (size_t i = 0; i < ret.datalen; i++) {
11218                 ret.data[i] = Future_clone(&orig->data[i]);
11219         }
11220         return ret;
11221 }
11222 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11223 CHECK(owner->result_ok);
11224         return OffersMessage_clone(&*owner->contents.result);
11225 }
11226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11227         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11228         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
11229         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
11230         int64_t ret_ref = tag_ptr(ret_copy, true);
11231         return ret_ref;
11232 }
11233
11234 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11235 CHECK(!owner->result_ok);
11236         return DecodeError_clone(&*owner->contents.err);
11237 }
11238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11239         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11240         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11241         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
11242         int64_t ret_ref = tag_ptr(ret_copy, true);
11243         return ret_ref;
11244 }
11245
11246 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
11247 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
11248 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
11249 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
11250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
11251         LDKCOption_HTLCClaimZ_Some_class =
11252                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
11253         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
11254         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
11255         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
11256         LDKCOption_HTLCClaimZ_None_class =
11257                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
11258         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
11259         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
11260         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
11261 }
11262 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11263         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
11264         switch(obj->tag) {
11265                 case LDKCOption_HTLCClaimZ_Some: {
11266                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
11267                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
11268                 }
11269                 case LDKCOption_HTLCClaimZ_None: {
11270                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
11271                 }
11272                 default: abort();
11273         }
11274 }
11275 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11276         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
11277         ret.is_owned = false;
11278         return ret;
11279 }
11280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11281         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11282         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
11283         int64_t ret_ref = 0;
11284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11286         return ret_ref;
11287 }
11288
11289 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11290 CHECK(!owner->result_ok);
11291         return DecodeError_clone(&*owner->contents.err);
11292 }
11293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11294         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11295         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11296         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
11297         int64_t ret_ref = tag_ptr(ret_copy, true);
11298         return ret_ref;
11299 }
11300
11301 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11302         LDKTxCreationKeys ret = *owner->contents.result;
11303         ret.is_owned = false;
11304         return ret;
11305 }
11306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11307         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11308         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
11309         int64_t ret_ref = 0;
11310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11312         return ret_ref;
11313 }
11314
11315 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11316 CHECK(!owner->result_ok);
11317         return DecodeError_clone(&*owner->contents.err);
11318 }
11319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11320         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11321         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11322         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
11323         int64_t ret_ref = tag_ptr(ret_copy, true);
11324         return ret_ref;
11325 }
11326
11327 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11328         LDKChannelPublicKeys ret = *owner->contents.result;
11329         ret.is_owned = false;
11330         return ret;
11331 }
11332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11333         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11334         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
11335         int64_t ret_ref = 0;
11336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11338         return ret_ref;
11339 }
11340
11341 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11342 CHECK(!owner->result_ok);
11343         return DecodeError_clone(&*owner->contents.err);
11344 }
11345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11346         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11347         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11348         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
11349         int64_t ret_ref = tag_ptr(ret_copy, true);
11350         return ret_ref;
11351 }
11352
11353 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11354         LDKHTLCOutputInCommitment ret = *owner->contents.result;
11355         ret.is_owned = false;
11356         return ret;
11357 }
11358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11359         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11360         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
11361         int64_t ret_ref = 0;
11362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11364         return ret_ref;
11365 }
11366
11367 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11368 CHECK(!owner->result_ok);
11369         return DecodeError_clone(&*owner->contents.err);
11370 }
11371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11372         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11373         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11374         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
11375         int64_t ret_ref = tag_ptr(ret_copy, true);
11376         return ret_ref;
11377 }
11378
11379 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11380         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
11381         ret.is_owned = false;
11382         return ret;
11383 }
11384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11385         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11386         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11387         int64_t ret_ref = 0;
11388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11390         return ret_ref;
11391 }
11392
11393 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11394 CHECK(!owner->result_ok);
11395         return DecodeError_clone(&*owner->contents.err);
11396 }
11397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11398         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11400         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11401         int64_t ret_ref = tag_ptr(ret_copy, true);
11402         return ret_ref;
11403 }
11404
11405 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11406         LDKChannelTransactionParameters ret = *owner->contents.result;
11407         ret.is_owned = false;
11408         return ret;
11409 }
11410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11411         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11412         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11413         int64_t ret_ref = 0;
11414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11416         return ret_ref;
11417 }
11418
11419 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11420 CHECK(!owner->result_ok);
11421         return DecodeError_clone(&*owner->contents.err);
11422 }
11423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11424         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11426         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11427         int64_t ret_ref = tag_ptr(ret_copy, true);
11428         return ret_ref;
11429 }
11430
11431 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11432         LDKHolderCommitmentTransaction ret = *owner->contents.result;
11433         ret.is_owned = false;
11434         return ret;
11435 }
11436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11437         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11438         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11439         int64_t ret_ref = 0;
11440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11442         return ret_ref;
11443 }
11444
11445 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11446 CHECK(!owner->result_ok);
11447         return DecodeError_clone(&*owner->contents.err);
11448 }
11449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11450         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11451         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11452         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11453         int64_t ret_ref = tag_ptr(ret_copy, true);
11454         return ret_ref;
11455 }
11456
11457 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11458         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
11459         ret.is_owned = false;
11460         return ret;
11461 }
11462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11463         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11464         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11465         int64_t ret_ref = 0;
11466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11468         return ret_ref;
11469 }
11470
11471 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11472 CHECK(!owner->result_ok);
11473         return DecodeError_clone(&*owner->contents.err);
11474 }
11475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11476         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11478         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11479         int64_t ret_ref = tag_ptr(ret_copy, true);
11480         return ret_ref;
11481 }
11482
11483 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11484         LDKTrustedClosingTransaction ret = *owner->contents.result;
11485         ret.is_owned = false;
11486         return ret;
11487 }
11488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11489         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11490         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
11491         int64_t ret_ref = 0;
11492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11494         return ret_ref;
11495 }
11496
11497 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11498 CHECK(!owner->result_ok);
11499         return *owner->contents.err;
11500 }
11501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11502         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11503         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
11504 }
11505
11506 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11507         LDKCommitmentTransaction ret = *owner->contents.result;
11508         ret.is_owned = false;
11509         return ret;
11510 }
11511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11512         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11513         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11514         int64_t ret_ref = 0;
11515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11517         return ret_ref;
11518 }
11519
11520 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11521 CHECK(!owner->result_ok);
11522         return DecodeError_clone(&*owner->contents.err);
11523 }
11524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11525         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11526         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11527         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11528         int64_t ret_ref = tag_ptr(ret_copy, true);
11529         return ret_ref;
11530 }
11531
11532 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
11533         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
11534         ret.is_owned = false;
11535         return ret;
11536 }
11537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11538         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
11539         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
11540         int64_t ret_ref = 0;
11541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11543         return ret_ref;
11544 }
11545
11546 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
11547 CHECK(!owner->result_ok);
11548         return *owner->contents.err;
11549 }
11550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11551         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
11552         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
11553 }
11554
11555 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
11556 CHECK(owner->result_ok);
11557         return *owner->contents.result;
11558 }
11559 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11560         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
11561         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
11562         jobjectArray ret_arr = NULL;
11563         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
11564         ;
11565         for (size_t i = 0; i < ret_var.datalen; i++) {
11566                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
11567                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
11568                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
11569         }
11570         
11571         return ret_arr;
11572 }
11573
11574 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
11575 CHECK(!owner->result_ok);
11576         return *owner->contents.err;
11577 }
11578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11579         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
11580         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
11581 }
11582
11583 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
11584         LDKShutdownScript ret = *owner->contents.result;
11585         ret.is_owned = false;
11586         return ret;
11587 }
11588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11589         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
11590         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
11591         int64_t ret_ref = 0;
11592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11594         return ret_ref;
11595 }
11596
11597 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
11598 CHECK(!owner->result_ok);
11599         return DecodeError_clone(&*owner->contents.err);
11600 }
11601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11602         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
11603         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11604         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
11605         int64_t ret_ref = tag_ptr(ret_copy, true);
11606         return ret_ref;
11607 }
11608
11609 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
11610         LDKShutdownScript ret = *owner->contents.result;
11611         ret.is_owned = false;
11612         return ret;
11613 }
11614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11615         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
11616         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
11617         int64_t ret_ref = 0;
11618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11620         return ret_ref;
11621 }
11622
11623 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
11624         LDKInvalidShutdownScript ret = *owner->contents.err;
11625         ret.is_owned = false;
11626         return ret;
11627 }
11628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11629         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
11630         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
11631         int64_t ret_ref = 0;
11632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11634         return ret_ref;
11635 }
11636
11637 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
11638 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
11639 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
11640 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
11641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
11642         LDKPaymentPurpose_InvoicePayment_class =
11643                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
11644         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
11645         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "(J[B)V");
11646         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
11647         LDKPaymentPurpose_SpontaneousPayment_class =
11648                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
11649         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
11650         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
11651         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
11652 }
11653 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11654         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11655         switch(obj->tag) {
11656                 case LDKPaymentPurpose_InvoicePayment: {
11657                         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
11658                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
11659                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
11660                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
11661                 }
11662                 case LDKPaymentPurpose_SpontaneousPayment: {
11663                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
11664                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
11665                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
11666                 }
11667                 default: abort();
11668         }
11669 }
11670 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
11671 CHECK(owner->result_ok);
11672         return PaymentPurpose_clone(&*owner->contents.result);
11673 }
11674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11675         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
11676         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11677         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
11678         int64_t ret_ref = tag_ptr(ret_copy, true);
11679         return ret_ref;
11680 }
11681
11682 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
11683 CHECK(!owner->result_ok);
11684         return DecodeError_clone(&*owner->contents.err);
11685 }
11686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11687         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
11688         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11689         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
11690         int64_t ret_ref = tag_ptr(ret_copy, true);
11691         return ret_ref;
11692 }
11693
11694 static jclass LDKPathFailure_InitialSend_class = NULL;
11695 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
11696 static jclass LDKPathFailure_OnPath_class = NULL;
11697 static jmethodID LDKPathFailure_OnPath_meth = NULL;
11698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
11699         LDKPathFailure_InitialSend_class =
11700                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
11701         CHECK(LDKPathFailure_InitialSend_class != NULL);
11702         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
11703         CHECK(LDKPathFailure_InitialSend_meth != NULL);
11704         LDKPathFailure_OnPath_class =
11705                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
11706         CHECK(LDKPathFailure_OnPath_class != NULL);
11707         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
11708         CHECK(LDKPathFailure_OnPath_meth != NULL);
11709 }
11710 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11711         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
11712         switch(obj->tag) {
11713                 case LDKPathFailure_InitialSend: {
11714                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
11715                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
11716                 }
11717                 case LDKPathFailure_OnPath: {
11718                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
11719                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
11720                 }
11721                 default: abort();
11722         }
11723 }
11724 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
11725 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
11726 static jclass LDKCOption_PathFailureZ_None_class = NULL;
11727 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
11728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
11729         LDKCOption_PathFailureZ_Some_class =
11730                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
11731         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
11732         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
11733         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
11734         LDKCOption_PathFailureZ_None_class =
11735                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
11736         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
11737         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
11738         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
11739 }
11740 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11741         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
11742         switch(obj->tag) {
11743                 case LDKCOption_PathFailureZ_Some: {
11744                         int64_t some_ref = tag_ptr(&obj->some, false);
11745                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
11746                 }
11747                 case LDKCOption_PathFailureZ_None: {
11748                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
11749                 }
11750                 default: abort();
11751         }
11752 }
11753 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
11754 CHECK(owner->result_ok);
11755         return COption_PathFailureZ_clone(&*owner->contents.result);
11756 }
11757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11758         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
11759         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
11760         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
11761         int64_t ret_ref = tag_ptr(ret_copy, true);
11762         return ret_ref;
11763 }
11764
11765 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
11766 CHECK(!owner->result_ok);
11767         return DecodeError_clone(&*owner->contents.err);
11768 }
11769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11770         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
11771         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11772         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
11773         int64_t ret_ref = tag_ptr(ret_copy, true);
11774         return ret_ref;
11775 }
11776
11777 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
11778 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
11779 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
11780 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
11781 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
11782 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
11783 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
11784 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
11785 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
11786 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
11787 static jclass LDKClosureReason_ProcessingError_class = NULL;
11788 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
11789 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
11790 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
11791 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
11792 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
11793 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
11794 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
11795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
11796         LDKClosureReason_CounterpartyForceClosed_class =
11797                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
11798         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
11799         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
11800         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
11801         LDKClosureReason_HolderForceClosed_class =
11802                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
11803         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
11804         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
11805         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
11806         LDKClosureReason_CooperativeClosure_class =
11807                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
11808         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
11809         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
11810         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
11811         LDKClosureReason_CommitmentTxConfirmed_class =
11812                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
11813         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
11814         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
11815         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
11816         LDKClosureReason_FundingTimedOut_class =
11817                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
11818         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
11819         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
11820         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
11821         LDKClosureReason_ProcessingError_class =
11822                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
11823         CHECK(LDKClosureReason_ProcessingError_class != NULL);
11824         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
11825         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
11826         LDKClosureReason_DisconnectedPeer_class =
11827                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
11828         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
11829         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
11830         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
11831         LDKClosureReason_OutdatedChannelManager_class =
11832                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
11833         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
11834         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
11835         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
11836         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
11837                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
11838         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
11839         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
11840         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
11841 }
11842 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11843         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
11844         switch(obj->tag) {
11845                 case LDKClosureReason_CounterpartyForceClosed: {
11846                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
11847                         int64_t peer_msg_ref = 0;
11848                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
11849                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
11850                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
11851                 }
11852                 case LDKClosureReason_HolderForceClosed: {
11853                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
11854                 }
11855                 case LDKClosureReason_CooperativeClosure: {
11856                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
11857                 }
11858                 case LDKClosureReason_CommitmentTxConfirmed: {
11859                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
11860                 }
11861                 case LDKClosureReason_FundingTimedOut: {
11862                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
11863                 }
11864                 case LDKClosureReason_ProcessingError: {
11865                         LDKStr err_str = obj->processing_error.err;
11866                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
11867                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
11868                 }
11869                 case LDKClosureReason_DisconnectedPeer: {
11870                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
11871                 }
11872                 case LDKClosureReason_OutdatedChannelManager: {
11873                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
11874                 }
11875                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
11876                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
11877                 }
11878                 default: abort();
11879         }
11880 }
11881 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
11882 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
11883 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
11884 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
11885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
11886         LDKCOption_ClosureReasonZ_Some_class =
11887                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
11888         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
11889         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
11890         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
11891         LDKCOption_ClosureReasonZ_None_class =
11892                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
11893         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
11894         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
11895         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
11896 }
11897 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11898         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
11899         switch(obj->tag) {
11900                 case LDKCOption_ClosureReasonZ_Some: {
11901                         int64_t some_ref = tag_ptr(&obj->some, false);
11902                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
11903                 }
11904                 case LDKCOption_ClosureReasonZ_None: {
11905                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
11906                 }
11907                 default: abort();
11908         }
11909 }
11910 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11911 CHECK(owner->result_ok);
11912         return COption_ClosureReasonZ_clone(&*owner->contents.result);
11913 }
11914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11915         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11916         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11917         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
11918         int64_t ret_ref = tag_ptr(ret_copy, true);
11919         return ret_ref;
11920 }
11921
11922 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11923 CHECK(!owner->result_ok);
11924         return DecodeError_clone(&*owner->contents.err);
11925 }
11926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11927         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11928         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11929         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
11930         int64_t ret_ref = tag_ptr(ret_copy, true);
11931         return ret_ref;
11932 }
11933
11934 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
11935 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
11936 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
11937 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
11938 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
11939 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
11940 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
11941 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
11942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
11943         LDKHTLCDestination_NextHopChannel_class =
11944                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
11945         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
11946         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
11947         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
11948         LDKHTLCDestination_UnknownNextHop_class =
11949                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
11950         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
11951         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
11952         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
11953         LDKHTLCDestination_InvalidForward_class =
11954                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
11955         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
11956         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
11957         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
11958         LDKHTLCDestination_FailedPayment_class =
11959                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
11960         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
11961         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
11962         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
11963 }
11964 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11965         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11966         switch(obj->tag) {
11967                 case LDKHTLCDestination_NextHopChannel: {
11968                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
11969                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
11970                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
11971                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
11972                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
11973                 }
11974                 case LDKHTLCDestination_UnknownNextHop: {
11975                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
11976                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
11977                 }
11978                 case LDKHTLCDestination_InvalidForward: {
11979                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
11980                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
11981                 }
11982                 case LDKHTLCDestination_FailedPayment: {
11983                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11984                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
11985                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
11986                 }
11987                 default: abort();
11988         }
11989 }
11990 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
11991 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
11992 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
11993 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
11994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
11995         LDKCOption_HTLCDestinationZ_Some_class =
11996                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
11997         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
11998         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
11999         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
12000         LDKCOption_HTLCDestinationZ_None_class =
12001                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
12002         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
12003         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
12004         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
12005 }
12006 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12007         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
12008         switch(obj->tag) {
12009                 case LDKCOption_HTLCDestinationZ_Some: {
12010                         int64_t some_ref = tag_ptr(&obj->some, false);
12011                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
12012                 }
12013                 case LDKCOption_HTLCDestinationZ_None: {
12014                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
12015                 }
12016                 default: abort();
12017         }
12018 }
12019 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12020 CHECK(owner->result_ok);
12021         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
12022 }
12023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12024         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12025         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12026         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
12027         int64_t ret_ref = tag_ptr(ret_copy, true);
12028         return ret_ref;
12029 }
12030
12031 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12032 CHECK(!owner->result_ok);
12033         return DecodeError_clone(&*owner->contents.err);
12034 }
12035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12036         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12037         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12038         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
12039         int64_t ret_ref = tag_ptr(ret_copy, true);
12040         return ret_ref;
12041 }
12042
12043 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12044 CHECK(owner->result_ok);
12045         return PaymentFailureReason_clone(&*owner->contents.result);
12046 }
12047 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12048         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12049         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
12050         return ret_conv;
12051 }
12052
12053 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12054 CHECK(!owner->result_ok);
12055         return DecodeError_clone(&*owner->contents.err);
12056 }
12057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12058         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12059         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12060         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
12061         int64_t ret_ref = tag_ptr(ret_copy, true);
12062         return ret_ref;
12063 }
12064
12065 static jclass LDKCOption_u128Z_Some_class = NULL;
12066 static jmethodID LDKCOption_u128Z_Some_meth = NULL;
12067 static jclass LDKCOption_u128Z_None_class = NULL;
12068 static jmethodID LDKCOption_u128Z_None_meth = NULL;
12069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u128Z_init (JNIEnv *env, jclass clz) {
12070         LDKCOption_u128Z_Some_class =
12071                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u128Z$Some"));
12072         CHECK(LDKCOption_u128Z_Some_class != NULL);
12073         LDKCOption_u128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u128Z_Some_class, "<init>", "([B)V");
12074         CHECK(LDKCOption_u128Z_Some_meth != NULL);
12075         LDKCOption_u128Z_None_class =
12076                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u128Z$None"));
12077         CHECK(LDKCOption_u128Z_None_class != NULL);
12078         LDKCOption_u128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u128Z_None_class, "<init>", "()V");
12079         CHECK(LDKCOption_u128Z_None_meth != NULL);
12080 }
12081 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12082         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
12083         switch(obj->tag) {
12084                 case LDKCOption_u128Z_Some: {
12085                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
12086                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
12087                         return (*env)->NewObject(env, LDKCOption_u128Z_Some_class, LDKCOption_u128Z_Some_meth, some_arr);
12088                 }
12089                 case LDKCOption_u128Z_None: {
12090                         return (*env)->NewObject(env, LDKCOption_u128Z_None_class, LDKCOption_u128Z_None_meth);
12091                 }
12092                 default: abort();
12093         }
12094 }
12095 static jclass LDKCOption_PaymentIdZ_Some_class = NULL;
12096 static jmethodID LDKCOption_PaymentIdZ_Some_meth = NULL;
12097 static jclass LDKCOption_PaymentIdZ_None_class = NULL;
12098 static jmethodID LDKCOption_PaymentIdZ_None_meth = NULL;
12099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentIdZ_init (JNIEnv *env, jclass clz) {
12100         LDKCOption_PaymentIdZ_Some_class =
12101                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentIdZ$Some"));
12102         CHECK(LDKCOption_PaymentIdZ_Some_class != NULL);
12103         LDKCOption_PaymentIdZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentIdZ_Some_class, "<init>", "([B)V");
12104         CHECK(LDKCOption_PaymentIdZ_Some_meth != NULL);
12105         LDKCOption_PaymentIdZ_None_class =
12106                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentIdZ$None"));
12107         CHECK(LDKCOption_PaymentIdZ_None_class != NULL);
12108         LDKCOption_PaymentIdZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentIdZ_None_class, "<init>", "()V");
12109         CHECK(LDKCOption_PaymentIdZ_None_meth != NULL);
12110 }
12111 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentIdZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12112         LDKCOption_PaymentIdZ *obj = (LDKCOption_PaymentIdZ*)untag_ptr(ptr);
12113         switch(obj->tag) {
12114                 case LDKCOption_PaymentIdZ_Some: {
12115                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
12116                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
12117                         return (*env)->NewObject(env, LDKCOption_PaymentIdZ_Some_class, LDKCOption_PaymentIdZ_Some_meth, some_arr);
12118                 }
12119                 case LDKCOption_PaymentIdZ_None: {
12120                         return (*env)->NewObject(env, LDKCOption_PaymentIdZ_None_class, LDKCOption_PaymentIdZ_None_meth);
12121                 }
12122                 default: abort();
12123         }
12124 }
12125 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
12126 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
12127 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
12128 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
12129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
12130         LDKCOption_PaymentFailureReasonZ_Some_class =
12131                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
12132         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
12133         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
12134         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
12135         LDKCOption_PaymentFailureReasonZ_None_class =
12136                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
12137         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
12138         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
12139         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
12140 }
12141 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12142         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
12143         switch(obj->tag) {
12144                 case LDKCOption_PaymentFailureReasonZ_Some: {
12145                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
12146                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
12147                 }
12148                 case LDKCOption_PaymentFailureReasonZ_None: {
12149                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
12150                 }
12151                 default: abort();
12152         }
12153 }
12154 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
12155 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
12156 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
12157 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
12158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
12159         LDKBumpTransactionEvent_ChannelClose_class =
12160                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
12161         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
12162         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "([BI[BJJ[J)V");
12163         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
12164         LDKBumpTransactionEvent_HTLCResolution_class =
12165                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
12166         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
12167         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "([BI[JI)V");
12168         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
12169 }
12170 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12171         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
12172         switch(obj->tag) {
12173                 case LDKBumpTransactionEvent_ChannelClose: {
12174                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12175                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
12176                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
12177                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
12178                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
12179                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
12180                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
12181                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
12182                         int64_t anchor_descriptor_ref = 0;
12183                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
12184                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
12185                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
12186                         int64_tArray pending_htlcs_arr = NULL;
12187                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
12188                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
12189                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
12190                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
12191                                 int64_t pending_htlcs_conv_24_ref = 0;
12192                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
12193                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
12194                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
12195                         }
12196                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
12197                         return (*env)->NewObject(env, LDKBumpTransactionEvent_ChannelClose_class, LDKBumpTransactionEvent_ChannelClose_meth, claim_id_arr, package_target_feerate_sat_per_1000_weight_conv, commitment_tx_arr, commitment_tx_fee_satoshis_conv, anchor_descriptor_ref, pending_htlcs_arr);
12198                 }
12199                 case LDKBumpTransactionEvent_HTLCResolution: {
12200                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12201                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
12202                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
12203                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
12204                         int64_tArray htlc_descriptors_arr = NULL;
12205                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
12206                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
12207                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
12208                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
12209                                 int64_t htlc_descriptors_conv_16_ref = 0;
12210                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
12211                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
12212                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
12213                         }
12214                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
12215                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
12216                         return (*env)->NewObject(env, LDKBumpTransactionEvent_HTLCResolution_class, LDKBumpTransactionEvent_HTLCResolution_meth, claim_id_arr, target_feerate_sat_per_1000_weight_conv, htlc_descriptors_arr, tx_lock_time_conv);
12217                 }
12218                 default: abort();
12219         }
12220 }
12221 static jclass LDKEvent_FundingGenerationReady_class = NULL;
12222 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
12223 static jclass LDKEvent_PaymentClaimable_class = NULL;
12224 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
12225 static jclass LDKEvent_PaymentClaimed_class = NULL;
12226 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
12227 static jclass LDKEvent_PaymentSent_class = NULL;
12228 static jmethodID LDKEvent_PaymentSent_meth = NULL;
12229 static jclass LDKEvent_PaymentFailed_class = NULL;
12230 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
12231 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
12232 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
12233 static jclass LDKEvent_PaymentPathFailed_class = NULL;
12234 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
12235 static jclass LDKEvent_ProbeSuccessful_class = NULL;
12236 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
12237 static jclass LDKEvent_ProbeFailed_class = NULL;
12238 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
12239 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
12240 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
12241 static jclass LDKEvent_HTLCIntercepted_class = NULL;
12242 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
12243 static jclass LDKEvent_SpendableOutputs_class = NULL;
12244 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
12245 static jclass LDKEvent_PaymentForwarded_class = NULL;
12246 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
12247 static jclass LDKEvent_ChannelPending_class = NULL;
12248 static jmethodID LDKEvent_ChannelPending_meth = NULL;
12249 static jclass LDKEvent_ChannelReady_class = NULL;
12250 static jmethodID LDKEvent_ChannelReady_meth = NULL;
12251 static jclass LDKEvent_ChannelClosed_class = NULL;
12252 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
12253 static jclass LDKEvent_DiscardFunding_class = NULL;
12254 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
12255 static jclass LDKEvent_OpenChannelRequest_class = NULL;
12256 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
12257 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
12258 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
12259 static jclass LDKEvent_BumpTransaction_class = NULL;
12260 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
12261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
12262         LDKEvent_FundingGenerationReady_class =
12263                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
12264         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
12265         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[B[B)V");
12266         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
12267         LDKEvent_PaymentClaimable_class =
12268                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
12269         CHECK(LDKEvent_PaymentClaimable_class != NULL);
12270         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJ[BJJ)V");
12271         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
12272         LDKEvent_PaymentClaimed_class =
12273                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
12274         CHECK(LDKEvent_PaymentClaimed_class != NULL);
12275         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ)V");
12276         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
12277         LDKEvent_PaymentSent_class =
12278                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
12279         CHECK(LDKEvent_PaymentSent_class != NULL);
12280         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
12281         CHECK(LDKEvent_PaymentSent_meth != NULL);
12282         LDKEvent_PaymentFailed_class =
12283                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
12284         CHECK(LDKEvent_PaymentFailed_class != NULL);
12285         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
12286         CHECK(LDKEvent_PaymentFailed_meth != NULL);
12287         LDKEvent_PaymentPathSuccessful_class =
12288                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
12289         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
12290         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
12291         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
12292         LDKEvent_PaymentPathFailed_class =
12293                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
12294         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
12295         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
12296         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
12297         LDKEvent_ProbeSuccessful_class =
12298                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
12299         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
12300         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
12301         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
12302         LDKEvent_ProbeFailed_class =
12303                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
12304         CHECK(LDKEvent_ProbeFailed_class != NULL);
12305         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
12306         CHECK(LDKEvent_ProbeFailed_meth != NULL);
12307         LDKEvent_PendingHTLCsForwardable_class =
12308                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
12309         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
12310         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
12311         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
12312         LDKEvent_HTLCIntercepted_class =
12313                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
12314         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
12315         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
12316         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
12317         LDKEvent_SpendableOutputs_class =
12318                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
12319         CHECK(LDKEvent_SpendableOutputs_class != NULL);
12320         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
12321         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
12322         LDKEvent_PaymentForwarded_class =
12323                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
12324         CHECK(LDKEvent_PaymentForwarded_class != NULL);
12325         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZJ)V");
12326         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
12327         LDKEvent_ChannelPending_class =
12328                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
12329         CHECK(LDKEvent_ChannelPending_class != NULL);
12330         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "([B[B[B[BJ)V");
12331         CHECK(LDKEvent_ChannelPending_meth != NULL);
12332         LDKEvent_ChannelReady_class =
12333                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
12334         CHECK(LDKEvent_ChannelReady_class != NULL);
12335         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "([B[B[BJ)V");
12336         CHECK(LDKEvent_ChannelReady_meth != NULL);
12337         LDKEvent_ChannelClosed_class =
12338                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
12339         CHECK(LDKEvent_ChannelClosed_class != NULL);
12340         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([B[BJ)V");
12341         CHECK(LDKEvent_ChannelClosed_meth != NULL);
12342         LDKEvent_DiscardFunding_class =
12343                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
12344         CHECK(LDKEvent_DiscardFunding_class != NULL);
12345         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
12346         CHECK(LDKEvent_DiscardFunding_meth != NULL);
12347         LDKEvent_OpenChannelRequest_class =
12348                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
12349         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
12350         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
12351         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
12352         LDKEvent_HTLCHandlingFailed_class =
12353                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
12354         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
12355         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
12356         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
12357         LDKEvent_BumpTransaction_class =
12358                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
12359         CHECK(LDKEvent_BumpTransaction_class != NULL);
12360         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
12361         CHECK(LDKEvent_BumpTransaction_meth != NULL);
12362 }
12363 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12364         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12365         switch(obj->tag) {
12366                 case LDKEvent_FundingGenerationReady: {
12367                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
12368                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
12369                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12370                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
12371                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
12372                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
12373                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
12374                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
12375                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12376                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
12377                         return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, counterparty_node_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_arr);
12378                 }
12379                 case LDKEvent_PaymentClaimable: {
12380                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
12381                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
12382                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12383                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
12384                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
12385                         int64_t onion_fields_ref = 0;
12386                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
12387                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
12388                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
12389                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
12390                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
12391                         int8_tArray via_channel_id_arr = (*env)->NewByteArray(env, 32);
12392                         (*env)->SetByteArrayRegion(env, via_channel_id_arr, 0, 32, obj->payment_claimable.via_channel_id.data);
12393                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
12394                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
12395                         return (*env)->NewObject(env, LDKEvent_PaymentClaimable_class, LDKEvent_PaymentClaimable_meth, receiver_node_id_arr, payment_hash_arr, onion_fields_ref, amount_msat_conv, counterparty_skimmed_fee_msat_conv, purpose_ref, via_channel_id_arr, via_user_channel_id_ref, claim_deadline_ref);
12396                 }
12397                 case LDKEvent_PaymentClaimed: {
12398                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
12399                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
12400                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12401                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
12402                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
12403                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
12404                         return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, receiver_node_id_arr, payment_hash_arr, amount_msat_conv, purpose_ref);
12405                 }
12406                 case LDKEvent_PaymentSent: {
12407                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
12408                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
12409                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
12410                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12411                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
12412                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
12413                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
12414                 }
12415                 case LDKEvent_PaymentFailed: {
12416                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12417                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
12418                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12419                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
12420                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
12421                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
12422                 }
12423                 case LDKEvent_PaymentPathSuccessful: {
12424                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12425                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
12426                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
12427                         LDKPath path_var = obj->payment_path_successful.path;
12428                         int64_t path_ref = 0;
12429                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12430                         path_ref = tag_ptr(path_var.inner, false);
12431                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
12432                 }
12433                 case LDKEvent_PaymentPathFailed: {
12434                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
12435                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12436                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
12437                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
12438                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
12439                         LDKPath path_var = obj->payment_path_failed.path;
12440                         int64_t path_ref = 0;
12441                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12442                         path_ref = tag_ptr(path_var.inner, false);
12443                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
12444                         return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_ref, payment_hash_arr, payment_failed_permanently_conv, failure_ref, path_ref, short_channel_id_ref);
12445                 }
12446                 case LDKEvent_ProbeSuccessful: {
12447                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12448                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
12449                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12450                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
12451                         LDKPath path_var = obj->probe_successful.path;
12452                         int64_t path_ref = 0;
12453                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12454                         path_ref = tag_ptr(path_var.inner, false);
12455                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
12456                 }
12457                 case LDKEvent_ProbeFailed: {
12458                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12459                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
12460                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12461                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
12462                         LDKPath path_var = obj->probe_failed.path;
12463                         int64_t path_ref = 0;
12464                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12465                         path_ref = tag_ptr(path_var.inner, false);
12466                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
12467                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
12468                 }
12469                 case LDKEvent_PendingHTLCsForwardable: {
12470                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
12471                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
12472                 }
12473                 case LDKEvent_HTLCIntercepted: {
12474                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
12475                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
12476                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
12477                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12478                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
12479                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
12480                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
12481                         return (*env)->NewObject(env, LDKEvent_HTLCIntercepted_class, LDKEvent_HTLCIntercepted_meth, intercept_id_arr, requested_next_hop_scid_conv, payment_hash_arr, inbound_amount_msat_conv, expected_outbound_amount_msat_conv);
12482                 }
12483                 case LDKEvent_SpendableOutputs: {
12484                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
12485                         int64_tArray outputs_arr = NULL;
12486                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
12487                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
12488                         for (size_t b = 0; b < outputs_var.datalen; b++) {
12489                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
12490                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
12491                         }
12492                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
12493                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
12494                 }
12495                 case LDKEvent_PaymentForwarded: {
12496                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
12497                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
12498                         int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
12499                         (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
12500                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
12501                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
12502                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
12503                         return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_arr, next_channel_id_arr, fee_earned_msat_ref, claim_from_onchain_tx_conv, outbound_amount_forwarded_msat_ref);
12504                 }
12505                 case LDKEvent_ChannelPending: {
12506                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12507                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_pending.channel_id.data);
12508                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12509                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
12510                         int8_tArray former_temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
12511                         (*env)->SetByteArrayRegion(env, former_temporary_channel_id_arr, 0, 32, obj->channel_pending.former_temporary_channel_id.data);
12512                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12513                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
12514                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
12515                         int64_t funding_txo_ref = 0;
12516                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
12517                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
12518                         return (*env)->NewObject(env, LDKEvent_ChannelPending_class, LDKEvent_ChannelPending_meth, channel_id_arr, user_channel_id_arr, former_temporary_channel_id_arr, counterparty_node_id_arr, funding_txo_ref);
12519                 }
12520                 case LDKEvent_ChannelReady: {
12521                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12522                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_ready.channel_id.data);
12523                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12524                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
12525                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12526                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
12527                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
12528                         int64_t channel_type_ref = 0;
12529                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12530                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12531                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_arr, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
12532                 }
12533                 case LDKEvent_ChannelClosed: {
12534                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12535                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
12536                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12537                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
12538                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
12539                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_arr, reason_ref);
12540                 }
12541                 case LDKEvent_DiscardFunding: {
12542                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12543                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
12544                         LDKTransaction transaction_var = obj->discard_funding.transaction;
12545                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
12546                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
12547                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
12548                 }
12549                 case LDKEvent_OpenChannelRequest: {
12550                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
12551                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
12552                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12553                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
12554                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
12555                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
12556                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
12557                         int64_t channel_type_ref = 0;
12558                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12559                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12560                         return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
12561                 }
12562                 case LDKEvent_HTLCHandlingFailed: {
12563                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
12564                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
12565                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
12566                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
12567                 }
12568                 case LDKEvent_BumpTransaction: {
12569                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
12570                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
12571                 }
12572                 default: abort();
12573         }
12574 }
12575 static jclass LDKCOption_EventZ_Some_class = NULL;
12576 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
12577 static jclass LDKCOption_EventZ_None_class = NULL;
12578 static jmethodID LDKCOption_EventZ_None_meth = NULL;
12579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
12580         LDKCOption_EventZ_Some_class =
12581                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
12582         CHECK(LDKCOption_EventZ_Some_class != NULL);
12583         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
12584         CHECK(LDKCOption_EventZ_Some_meth != NULL);
12585         LDKCOption_EventZ_None_class =
12586                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
12587         CHECK(LDKCOption_EventZ_None_class != NULL);
12588         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
12589         CHECK(LDKCOption_EventZ_None_meth != NULL);
12590 }
12591 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12592         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
12593         switch(obj->tag) {
12594                 case LDKCOption_EventZ_Some: {
12595                         int64_t some_ref = tag_ptr(&obj->some, false);
12596                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
12597                 }
12598                 case LDKCOption_EventZ_None: {
12599                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
12600                 }
12601                 default: abort();
12602         }
12603 }
12604 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
12605 CHECK(owner->result_ok);
12606         return COption_EventZ_clone(&*owner->contents.result);
12607 }
12608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12609         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
12610         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12611         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
12612         int64_t ret_ref = tag_ptr(ret_copy, true);
12613         return ret_ref;
12614 }
12615
12616 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
12617 CHECK(!owner->result_ok);
12618         return DecodeError_clone(&*owner->contents.err);
12619 }
12620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12621         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
12622         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12623         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
12624         int64_t ret_ref = tag_ptr(ret_copy, true);
12625         return ret_ref;
12626 }
12627
12628 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
12629         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
12630         for (size_t i = 0; i < ret.datalen; i++) {
12631                 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
12632         }
12633         return ret;
12634 }
12635 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
12636 CHECK(owner->result_ok);
12637         return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
12638 }
12639 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12640         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
12641         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
12642         int64_tArray ret_arr = NULL;
12643         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12644         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12645         for (size_t j = 0; j < ret_var.datalen; j++) {
12646                 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
12647                 *ret_conv_35_conv = ret_var.data[j];
12648                 ret_arr_ptr[j] = tag_ptr(ret_conv_35_conv, true);
12649         }
12650         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12651         FREE(ret_var.data);
12652         return ret_arr;
12653 }
12654
12655 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
12656 CHECK(!owner->result_ok);
12657         return *owner->contents.err;
12658 }
12659 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12660         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
12661         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
12662         return ret_conv;
12663 }
12664
12665 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
12666 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
12667 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
12668 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
12669 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
12670 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
12671 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
12672 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
12673 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
12674 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
12675 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
12676 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
12677 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
12678 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
12679 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
12680 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
12681 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
12682 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
12683 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
12684 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
12685 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
12686 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
12687 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
12688 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
12689 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
12690 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
12691 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
12692 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
12693 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
12694 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
12695 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
12696 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
12697 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
12698 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
12699 static jclass LDKBolt11ParseError_Skip_class = NULL;
12700 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
12701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
12702         LDKBolt11ParseError_Bech32Error_class =
12703                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
12704         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
12705         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
12706         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
12707         LDKBolt11ParseError_ParseAmountError_class =
12708                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
12709         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
12710         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
12711         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
12712         LDKBolt11ParseError_MalformedSignature_class =
12713                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
12714         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
12715         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
12716         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
12717         LDKBolt11ParseError_BadPrefix_class =
12718                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
12719         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
12720         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
12721         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
12722         LDKBolt11ParseError_UnknownCurrency_class =
12723                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
12724         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
12725         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
12726         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
12727         LDKBolt11ParseError_UnknownSiPrefix_class =
12728                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
12729         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
12730         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
12731         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
12732         LDKBolt11ParseError_MalformedHRP_class =
12733                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
12734         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
12735         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
12736         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
12737         LDKBolt11ParseError_TooShortDataPart_class =
12738                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
12739         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
12740         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
12741         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
12742         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
12743                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
12744         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
12745         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
12746         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
12747         LDKBolt11ParseError_DescriptionDecodeError_class =
12748                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
12749         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
12750         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
12751         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
12752         LDKBolt11ParseError_PaddingError_class =
12753                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
12754         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
12755         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
12756         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
12757         LDKBolt11ParseError_IntegerOverflowError_class =
12758                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
12759         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
12760         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
12761         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
12762         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
12763                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
12764         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
12765         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
12766         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
12767         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
12768                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
12769         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
12770         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
12771         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
12772         LDKBolt11ParseError_InvalidScriptHashLength_class =
12773                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
12774         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
12775         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
12776         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
12777         LDKBolt11ParseError_InvalidRecoveryId_class =
12778                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
12779         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
12780         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
12781         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
12782         LDKBolt11ParseError_InvalidSliceLength_class =
12783                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
12784         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
12785         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
12786         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
12787         LDKBolt11ParseError_Skip_class =
12788                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
12789         CHECK(LDKBolt11ParseError_Skip_class != NULL);
12790         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
12791         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
12792 }
12793 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12794         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12795         switch(obj->tag) {
12796                 case LDKBolt11ParseError_Bech32Error: {
12797                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
12798                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
12799                 }
12800                 case LDKBolt11ParseError_ParseAmountError: {
12801                         /*obj->parse_amount_error*/
12802                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
12803                 }
12804                 case LDKBolt11ParseError_MalformedSignature: {
12805                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
12806                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
12807                 }
12808                 case LDKBolt11ParseError_BadPrefix: {
12809                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
12810                 }
12811                 case LDKBolt11ParseError_UnknownCurrency: {
12812                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
12813                 }
12814                 case LDKBolt11ParseError_UnknownSiPrefix: {
12815                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
12816                 }
12817                 case LDKBolt11ParseError_MalformedHRP: {
12818                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
12819                 }
12820                 case LDKBolt11ParseError_TooShortDataPart: {
12821                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
12822                 }
12823                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
12824                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
12825                 }
12826                 case LDKBolt11ParseError_DescriptionDecodeError: {
12827                         /*obj->description_decode_error*/
12828                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
12829                 }
12830                 case LDKBolt11ParseError_PaddingError: {
12831                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
12832                 }
12833                 case LDKBolt11ParseError_IntegerOverflowError: {
12834                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
12835                 }
12836                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
12837                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
12838                 }
12839                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
12840                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
12841                 }
12842                 case LDKBolt11ParseError_InvalidScriptHashLength: {
12843                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
12844                 }
12845                 case LDKBolt11ParseError_InvalidRecoveryId: {
12846                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
12847                 }
12848                 case LDKBolt11ParseError_InvalidSliceLength: {
12849                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
12850                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
12851                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
12852                 }
12853                 case LDKBolt11ParseError_Skip: {
12854                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
12855                 }
12856                 default: abort();
12857         }
12858 }
12859 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12860 CHECK(owner->result_ok);
12861         return SiPrefix_clone(&*owner->contents.result);
12862 }
12863 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12864         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12865         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
12866         return ret_conv;
12867 }
12868
12869 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12870 CHECK(!owner->result_ok);
12871         return Bolt11ParseError_clone(&*owner->contents.err);
12872 }
12873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12874         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12875         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12876         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
12877         int64_t ret_ref = tag_ptr(ret_copy, true);
12878         return ret_ref;
12879 }
12880
12881 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
12882 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
12883 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
12884 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
12885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
12886         LDKParseOrSemanticError_ParseError_class =
12887                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
12888         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
12889         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
12890         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
12891         LDKParseOrSemanticError_SemanticError_class =
12892                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
12893         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
12894         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
12895         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
12896 }
12897 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12898         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12899         switch(obj->tag) {
12900                 case LDKParseOrSemanticError_ParseError: {
12901                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
12902                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
12903                 }
12904                 case LDKParseOrSemanticError_SemanticError: {
12905                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
12906                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
12907                 }
12908                 default: abort();
12909         }
12910 }
12911 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12912         LDKBolt11Invoice ret = *owner->contents.result;
12913         ret.is_owned = false;
12914         return ret;
12915 }
12916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12917         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12918         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
12919         int64_t ret_ref = 0;
12920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12922         return ret_ref;
12923 }
12924
12925 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12926 CHECK(!owner->result_ok);
12927         return ParseOrSemanticError_clone(&*owner->contents.err);
12928 }
12929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12930         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12931         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
12932         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
12933         int64_t ret_ref = tag_ptr(ret_copy, true);
12934         return ret_ref;
12935 }
12936
12937 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12938         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
12939         ret.is_owned = false;
12940         return ret;
12941 }
12942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12943         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12944         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
12945         int64_t ret_ref = 0;
12946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12948         return ret_ref;
12949 }
12950
12951 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12952 CHECK(!owner->result_ok);
12953         return Bolt11ParseError_clone(&*owner->contents.err);
12954 }
12955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12956         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12957         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12958         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
12959         int64_t ret_ref = tag_ptr(ret_copy, true);
12960         return ret_ref;
12961 }
12962
12963 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12964         LDKRawBolt11Invoice ret = owner->a;
12965         ret.is_owned = false;
12966         return ret;
12967 }
12968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
12969         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12970         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
12971         int64_t ret_ref = 0;
12972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12974         return ret_ref;
12975 }
12976
12977 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12978         return ThirtyTwoBytes_clone(&owner->b);
12979 }
12980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
12981         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12982         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12983         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
12984         return ret_arr;
12985 }
12986
12987 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12988         LDKBolt11InvoiceSignature ret = owner->c;
12989         ret.is_owned = false;
12990         return ret;
12991 }
12992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
12993         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12994         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
12995         int64_t ret_ref = 0;
12996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12998         return ret_ref;
12999 }
13000
13001 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
13002         LDKPayeePubKey ret = *owner->contents.result;
13003         ret.is_owned = false;
13004         return ret;
13005 }
13006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13007         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
13008         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
13009         int64_t ret_ref = 0;
13010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13012         return ret_ref;
13013 }
13014
13015 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
13016 CHECK(!owner->result_ok);
13017         return *owner->contents.err;
13018 }
13019 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13020         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
13021         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
13022         return ret_conv;
13023 }
13024
13025 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
13026         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
13027         for (size_t i = 0; i < ret.datalen; i++) {
13028                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
13029         }
13030         return ret;
13031 }
13032 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13033         LDKPositiveTimestamp ret = *owner->contents.result;
13034         ret.is_owned = false;
13035         return ret;
13036 }
13037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13038         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13039         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
13040         int64_t ret_ref = 0;
13041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13043         return ret_ref;
13044 }
13045
13046 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13047 CHECK(!owner->result_ok);
13048         return CreationError_clone(&*owner->contents.err);
13049 }
13050 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13051         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13052         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
13053         return ret_conv;
13054 }
13055
13056 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13057 CHECK(owner->result_ok);
13058         return *owner->contents.result;
13059 }
13060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13061         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13062         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
13063 }
13064
13065 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13066 CHECK(!owner->result_ok);
13067         return Bolt11SemanticError_clone(&*owner->contents.err);
13068 }
13069 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13070         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13071         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
13072         return ret_conv;
13073 }
13074
13075 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13076         LDKBolt11Invoice ret = *owner->contents.result;
13077         ret.is_owned = false;
13078         return ret;
13079 }
13080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13081         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13082         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
13083         int64_t ret_ref = 0;
13084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13086         return ret_ref;
13087 }
13088
13089 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13090 CHECK(!owner->result_ok);
13091         return Bolt11SemanticError_clone(&*owner->contents.err);
13092 }
13093 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13094         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13095         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
13096         return ret_conv;
13097 }
13098
13099 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13100         LDKDescription ret = *owner->contents.result;
13101         ret.is_owned = false;
13102         return ret;
13103 }
13104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13105         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13106         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
13107         int64_t ret_ref = 0;
13108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13110         return ret_ref;
13111 }
13112
13113 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13114 CHECK(!owner->result_ok);
13115         return CreationError_clone(&*owner->contents.err);
13116 }
13117 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13118         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13119         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
13120         return ret_conv;
13121 }
13122
13123 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13124         LDKPrivateRoute ret = *owner->contents.result;
13125         ret.is_owned = false;
13126         return ret;
13127 }
13128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13129         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13130         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
13131         int64_t ret_ref = 0;
13132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13134         return ret_ref;
13135 }
13136
13137 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13138 CHECK(!owner->result_ok);
13139         return CreationError_clone(&*owner->contents.err);
13140 }
13141 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13142         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13143         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
13144         return ret_conv;
13145 }
13146
13147 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13148         LDKOutPoint ret = *owner->contents.result;
13149         ret.is_owned = false;
13150         return ret;
13151 }
13152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13153         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13154         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
13155         int64_t ret_ref = 0;
13156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13158         return ret_ref;
13159 }
13160
13161 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13162 CHECK(!owner->result_ok);
13163         return DecodeError_clone(&*owner->contents.err);
13164 }
13165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13166         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13167         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13168         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
13169         int64_t ret_ref = tag_ptr(ret_copy, true);
13170         return ret_ref;
13171 }
13172
13173 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13174         LDKBigSize ret = *owner->contents.result;
13175         ret.is_owned = false;
13176         return ret;
13177 }
13178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13179         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13180         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
13181         int64_t ret_ref = 0;
13182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13184         return ret_ref;
13185 }
13186
13187 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13188 CHECK(!owner->result_ok);
13189         return DecodeError_clone(&*owner->contents.err);
13190 }
13191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13192         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13193         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13194         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
13195         int64_t ret_ref = tag_ptr(ret_copy, true);
13196         return ret_ref;
13197 }
13198
13199 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13200         LDKHostname ret = *owner->contents.result;
13201         ret.is_owned = false;
13202         return ret;
13203 }
13204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13205         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13206         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
13207         int64_t ret_ref = 0;
13208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13210         return ret_ref;
13211 }
13212
13213 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13214 CHECK(!owner->result_ok);
13215         return DecodeError_clone(&*owner->contents.err);
13216 }
13217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13218         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13219         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13220         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
13221         int64_t ret_ref = tag_ptr(ret_copy, true);
13222         return ret_ref;
13223 }
13224
13225 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13226         LDKTransactionU16LenLimited ret = *owner->contents.result;
13227         ret.is_owned = false;
13228         return ret;
13229 }
13230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13231         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13232         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
13233         int64_t ret_ref = 0;
13234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13236         return ret_ref;
13237 }
13238
13239 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13240 CHECK(!owner->result_ok);
13241         return *owner->contents.err;
13242 }
13243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13244         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13245         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
13246 }
13247
13248 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13249         LDKTransactionU16LenLimited ret = *owner->contents.result;
13250         ret.is_owned = false;
13251         return ret;
13252 }
13253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13254         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13255         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
13256         int64_t ret_ref = 0;
13257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13259         return ret_ref;
13260 }
13261
13262 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13263 CHECK(!owner->result_ok);
13264         return DecodeError_clone(&*owner->contents.err);
13265 }
13266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13267         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13268         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13269         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
13270         int64_t ret_ref = tag_ptr(ret_copy, true);
13271         return ret_ref;
13272 }
13273
13274 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13275         LDKUntrustedString ret = *owner->contents.result;
13276         ret.is_owned = false;
13277         return ret;
13278 }
13279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13280         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13281         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
13282         int64_t ret_ref = 0;
13283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13285         return ret_ref;
13286 }
13287
13288 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13289 CHECK(!owner->result_ok);
13290         return DecodeError_clone(&*owner->contents.err);
13291 }
13292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13293         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13294         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13295         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
13296         int64_t ret_ref = tag_ptr(ret_copy, true);
13297         return ret_ref;
13298 }
13299
13300 static jclass LDKPaymentError_Invoice_class = NULL;
13301 static jmethodID LDKPaymentError_Invoice_meth = NULL;
13302 static jclass LDKPaymentError_Sending_class = NULL;
13303 static jmethodID LDKPaymentError_Sending_meth = NULL;
13304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
13305         LDKPaymentError_Invoice_class =
13306                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
13307         CHECK(LDKPaymentError_Invoice_class != NULL);
13308         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
13309         CHECK(LDKPaymentError_Invoice_meth != NULL);
13310         LDKPaymentError_Sending_class =
13311                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
13312         CHECK(LDKPaymentError_Sending_class != NULL);
13313         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(Lorg/ldk/enums/RetryableSendFailure;)V");
13314         CHECK(LDKPaymentError_Sending_meth != NULL);
13315 }
13316 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13317         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
13318         switch(obj->tag) {
13319                 case LDKPaymentError_Invoice: {
13320                         LDKStr invoice_str = obj->invoice;
13321                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
13322                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
13323                 }
13324                 case LDKPaymentError_Sending: {
13325                         jclass sending_conv = LDKRetryableSendFailure_to_java(env, obj->sending);
13326                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_conv);
13327                 }
13328                 default: abort();
13329         }
13330 }
13331 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
13332 CHECK(owner->result_ok);
13333         return ThirtyTwoBytes_clone(&*owner->contents.result);
13334 }
13335 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13336         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
13337         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13338         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
13339         return ret_arr;
13340 }
13341
13342 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
13343 CHECK(!owner->result_ok);
13344         return PaymentError_clone(&*owner->contents.err);
13345 }
13346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13347         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
13348         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
13349         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
13350         int64_t ret_ref = tag_ptr(ret_copy, true);
13351         return ret_ref;
13352 }
13353
13354 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
13355 CHECK(owner->result_ok);
13356         return *owner->contents.result;
13357 }
13358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13359         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
13360         CResult_NonePaymentErrorZ_get_ok(owner_conv);
13361 }
13362
13363 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
13364 CHECK(!owner->result_ok);
13365         return PaymentError_clone(&*owner->contents.err);
13366 }
13367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13368         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
13369         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
13370         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
13371         int64_t ret_ref = tag_ptr(ret_copy, true);
13372         return ret_ref;
13373 }
13374
13375 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
13376 CHECK(owner->result_ok);
13377         return *owner->contents.result;
13378 }
13379 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13380         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
13381         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
13382         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13383         return ret_conv;
13384 }
13385
13386 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
13387 CHECK(!owner->result_ok);
13388         return *owner->contents.err;
13389 }
13390 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13391         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
13392         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
13393         return ret_conv;
13394 }
13395
13396 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
13397         LDKOnionMessagePath ret = *owner->contents.result;
13398         ret.is_owned = false;
13399         return ret;
13400 }
13401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13402         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
13403         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
13404         int64_t ret_ref = 0;
13405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13407         return ret_ref;
13408 }
13409
13410 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
13411 CHECK(!owner->result_ok);
13412         return *owner->contents.err;
13413 }
13414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13415         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
13416         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
13417 }
13418
13419 static jclass LDKSendError_Secp256k1_class = NULL;
13420 static jmethodID LDKSendError_Secp256k1_meth = NULL;
13421 static jclass LDKSendError_TooBigPacket_class = NULL;
13422 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
13423 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
13424 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
13425 static jclass LDKSendError_InvalidFirstHop_class = NULL;
13426 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
13427 static jclass LDKSendError_InvalidMessage_class = NULL;
13428 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
13429 static jclass LDKSendError_BufferFull_class = NULL;
13430 static jmethodID LDKSendError_BufferFull_meth = NULL;
13431 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
13432 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
13433 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
13434 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
13435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
13436         LDKSendError_Secp256k1_class =
13437                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
13438         CHECK(LDKSendError_Secp256k1_class != NULL);
13439         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
13440         CHECK(LDKSendError_Secp256k1_meth != NULL);
13441         LDKSendError_TooBigPacket_class =
13442                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
13443         CHECK(LDKSendError_TooBigPacket_class != NULL);
13444         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
13445         CHECK(LDKSendError_TooBigPacket_meth != NULL);
13446         LDKSendError_TooFewBlindedHops_class =
13447                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
13448         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
13449         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
13450         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
13451         LDKSendError_InvalidFirstHop_class =
13452                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
13453         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
13454         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "()V");
13455         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
13456         LDKSendError_InvalidMessage_class =
13457                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
13458         CHECK(LDKSendError_InvalidMessage_class != NULL);
13459         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
13460         CHECK(LDKSendError_InvalidMessage_meth != NULL);
13461         LDKSendError_BufferFull_class =
13462                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
13463         CHECK(LDKSendError_BufferFull_class != NULL);
13464         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
13465         CHECK(LDKSendError_BufferFull_meth != NULL);
13466         LDKSendError_GetNodeIdFailed_class =
13467                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
13468         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
13469         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
13470         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
13471         LDKSendError_BlindedPathAdvanceFailed_class =
13472                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
13473         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
13474         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
13475         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
13476 }
13477 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13478         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
13479         switch(obj->tag) {
13480                 case LDKSendError_Secp256k1: {
13481                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
13482                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
13483                 }
13484                 case LDKSendError_TooBigPacket: {
13485                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
13486                 }
13487                 case LDKSendError_TooFewBlindedHops: {
13488                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
13489                 }
13490                 case LDKSendError_InvalidFirstHop: {
13491                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth);
13492                 }
13493                 case LDKSendError_InvalidMessage: {
13494                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
13495                 }
13496                 case LDKSendError_BufferFull: {
13497                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
13498                 }
13499                 case LDKSendError_GetNodeIdFailed: {
13500                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
13501                 }
13502                 case LDKSendError_BlindedPathAdvanceFailed: {
13503                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
13504                 }
13505                 default: abort();
13506         }
13507 }
13508 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
13509 CHECK(owner->result_ok);
13510         return *owner->contents.result;
13511 }
13512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13513         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
13514         CResult_NoneSendErrorZ_get_ok(owner_conv);
13515 }
13516
13517 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
13518 CHECK(!owner->result_ok);
13519         return SendError_clone(&*owner->contents.err);
13520 }
13521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13522         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
13523         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
13524         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
13525         int64_t ret_ref = tag_ptr(ret_copy, true);
13526         return ret_ref;
13527 }
13528
13529 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13530         LDKBlindedPath ret = *owner->contents.result;
13531         ret.is_owned = false;
13532         return ret;
13533 }
13534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13535         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13536         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
13537         int64_t ret_ref = 0;
13538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13540         return ret_ref;
13541 }
13542
13543 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13544 CHECK(!owner->result_ok);
13545         return *owner->contents.err;
13546 }
13547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13548         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13549         CResult_BlindedPathNoneZ_get_err(owner_conv);
13550 }
13551
13552 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13553         LDKBlindedPath ret = *owner->contents.result;
13554         ret.is_owned = false;
13555         return ret;
13556 }
13557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13558         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13559         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
13560         int64_t ret_ref = 0;
13561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13563         return ret_ref;
13564 }
13565
13566 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13567 CHECK(!owner->result_ok);
13568         return DecodeError_clone(&*owner->contents.err);
13569 }
13570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13571         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13572         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13573         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
13574         int64_t ret_ref = tag_ptr(ret_copy, true);
13575         return ret_ref;
13576 }
13577
13578 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13579         LDKBlindedHop ret = *owner->contents.result;
13580         ret.is_owned = false;
13581         return ret;
13582 }
13583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13584         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13585         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
13586         int64_t ret_ref = 0;
13587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13589         return ret_ref;
13590 }
13591
13592 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13593 CHECK(!owner->result_ok);
13594         return DecodeError_clone(&*owner->contents.err);
13595 }
13596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13597         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13598         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13599         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
13600         int64_t ret_ref = tag_ptr(ret_copy, true);
13601         return ret_ref;
13602 }
13603
13604 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13605         LDKInvoiceError ret = *owner->contents.result;
13606         ret.is_owned = false;
13607         return ret;
13608 }
13609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13610         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13611         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
13612         int64_t ret_ref = 0;
13613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13615         return ret_ref;
13616 }
13617
13618 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13619 CHECK(!owner->result_ok);
13620         return DecodeError_clone(&*owner->contents.err);
13621 }
13622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13623         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13624         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13625         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
13626         int64_t ret_ref = tag_ptr(ret_copy, true);
13627         return ret_ref;
13628 }
13629
13630 typedef struct LDKFilter_JCalls {
13631         atomic_size_t refcnt;
13632         JavaVM *vm;
13633         jweak o;
13634         jmethodID register_tx_meth;
13635         jmethodID register_output_meth;
13636 } LDKFilter_JCalls;
13637 static void LDKFilter_JCalls_free(void* this_arg) {
13638         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13639         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13640                 JNIEnv *env;
13641                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13642                 if (get_jenv_res == JNI_EDETACHED) {
13643                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13644                 } else {
13645                         DO_ASSERT(get_jenv_res == JNI_OK);
13646                 }
13647                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13648                 if (get_jenv_res == JNI_EDETACHED) {
13649                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13650                 }
13651                 FREE(j_calls);
13652         }
13653 }
13654 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
13655         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13656         JNIEnv *env;
13657         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13658         if (get_jenv_res == JNI_EDETACHED) {
13659                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13660         } else {
13661                 DO_ASSERT(get_jenv_res == JNI_OK);
13662         }
13663         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
13664         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
13665         LDKu8slice script_pubkey_var = script_pubkey;
13666         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
13667         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
13668         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13669         CHECK(obj != NULL);
13670         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
13671         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13672                 (*env)->ExceptionDescribe(env);
13673                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
13674         }
13675         if (get_jenv_res == JNI_EDETACHED) {
13676                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13677         }
13678 }
13679 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
13680         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13681         JNIEnv *env;
13682         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13683         if (get_jenv_res == JNI_EDETACHED) {
13684                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13685         } else {
13686                 DO_ASSERT(get_jenv_res == JNI_OK);
13687         }
13688         LDKWatchedOutput output_var = output;
13689         int64_t output_ref = 0;
13690         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
13691         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
13692         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13693         CHECK(obj != NULL);
13694         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
13695         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13696                 (*env)->ExceptionDescribe(env);
13697                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
13698         }
13699         if (get_jenv_res == JNI_EDETACHED) {
13700                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13701         }
13702 }
13703 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
13704         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
13705         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13706 }
13707 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
13708         jclass c = (*env)->GetObjectClass(env, o);
13709         CHECK(c != NULL);
13710         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
13711         atomic_init(&calls->refcnt, 1);
13712         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13713         calls->o = (*env)->NewWeakGlobalRef(env, o);
13714         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
13715         CHECK(calls->register_tx_meth != NULL);
13716         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
13717         CHECK(calls->register_output_meth != NULL);
13718
13719         LDKFilter ret = {
13720                 .this_arg = (void*) calls,
13721                 .register_tx = register_tx_LDKFilter_jcall,
13722                 .register_output = register_output_LDKFilter_jcall,
13723                 .free = LDKFilter_JCalls_free,
13724         };
13725         return ret;
13726 }
13727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
13728         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13729         *res_ptr = LDKFilter_init(env, clz, o);
13730         return tag_ptr(res_ptr, true);
13731 }
13732 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) {
13733         void* this_arg_ptr = untag_ptr(this_arg);
13734         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13735         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13736         uint8_t txid_arr[32];
13737         CHECK((*env)->GetArrayLength(env, txid) == 32);
13738         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
13739         uint8_t (*txid_ref)[32] = &txid_arr;
13740         LDKu8slice script_pubkey_ref;
13741         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
13742         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
13743         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
13744         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
13745 }
13746
13747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
13748         void* this_arg_ptr = untag_ptr(this_arg);
13749         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13750         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13751         LDKWatchedOutput output_conv;
13752         output_conv.inner = untag_ptr(output);
13753         output_conv.is_owned = ptr_is_owned(output);
13754         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
13755         output_conv = WatchedOutput_clone(&output_conv);
13756         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
13757 }
13758
13759 static jclass LDKCOption_FilterZ_Some_class = NULL;
13760 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
13761 static jclass LDKCOption_FilterZ_None_class = NULL;
13762 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
13763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
13764         LDKCOption_FilterZ_Some_class =
13765                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
13766         CHECK(LDKCOption_FilterZ_Some_class != NULL);
13767         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
13768         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
13769         LDKCOption_FilterZ_None_class =
13770                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
13771         CHECK(LDKCOption_FilterZ_None_class != NULL);
13772         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
13773         CHECK(LDKCOption_FilterZ_None_meth != NULL);
13774 }
13775 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13776         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13777         switch(obj->tag) {
13778                 case LDKCOption_FilterZ_Some: {
13779                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
13780                         *some_ret = obj->some;
13781                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
13782                         if ((*some_ret).free == LDKFilter_JCalls_free) {
13783                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13784                                 LDKFilter_JCalls_cloned(&(*some_ret));
13785                         }
13786                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
13787                 }
13788                 case LDKCOption_FilterZ_None: {
13789                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
13790                 }
13791                 default: abort();
13792         }
13793 }
13794 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13795         LDKLockedChannelMonitor ret = *owner->contents.result;
13796         ret.is_owned = false;
13797         return ret;
13798 }
13799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13800         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13801         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
13802         int64_t ret_ref = 0;
13803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13805         return ret_ref;
13806 }
13807
13808 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13809 CHECK(!owner->result_ok);
13810         return *owner->contents.err;
13811 }
13812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13813         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13814         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
13815 }
13816
13817 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
13818         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
13819         for (size_t i = 0; i < ret.datalen; i++) {
13820                 ret.data[i] = OutPoint_clone(&orig->data[i]);
13821         }
13822         return ret;
13823 }
13824 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
13825         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
13826         for (size_t i = 0; i < ret.datalen; i++) {
13827                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
13828         }
13829         return ret;
13830 }
13831 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
13832         LDKOutPoint ret = owner->a;
13833         ret.is_owned = false;
13834         return ret;
13835 }
13836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
13837         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
13838         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
13839         int64_t ret_ref = 0;
13840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13842         return ret_ref;
13843 }
13844
13845 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
13846         return CVec_MonitorUpdateIdZ_clone(&owner->b);
13847 }
13848 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
13849         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
13850         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
13851         int64_tArray ret_arr = NULL;
13852         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13853         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13854         for (size_t r = 0; r < ret_var.datalen; r++) {
13855                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
13856                 int64_t ret_conv_17_ref = 0;
13857                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
13858                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
13859                 ret_arr_ptr[r] = ret_conv_17_ref;
13860         }
13861         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13862         FREE(ret_var.data);
13863         return ret_arr;
13864 }
13865
13866 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
13867         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
13868         for (size_t i = 0; i < ret.datalen; i++) {
13869                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
13870         }
13871         return ret;
13872 }
13873 typedef struct LDKPersister_JCalls {
13874         atomic_size_t refcnt;
13875         JavaVM *vm;
13876         jweak o;
13877         jmethodID persist_manager_meth;
13878         jmethodID persist_graph_meth;
13879         jmethodID persist_scorer_meth;
13880 } LDKPersister_JCalls;
13881 static void LDKPersister_JCalls_free(void* this_arg) {
13882         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13883         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13884                 JNIEnv *env;
13885                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13886                 if (get_jenv_res == JNI_EDETACHED) {
13887                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13888                 } else {
13889                         DO_ASSERT(get_jenv_res == JNI_OK);
13890                 }
13891                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13892                 if (get_jenv_res == JNI_EDETACHED) {
13893                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13894                 }
13895                 FREE(j_calls);
13896         }
13897 }
13898 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
13899         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13900         JNIEnv *env;
13901         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13902         if (get_jenv_res == JNI_EDETACHED) {
13903                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13904         } else {
13905                 DO_ASSERT(get_jenv_res == JNI_OK);
13906         }
13907         LDKChannelManager channel_manager_var = *channel_manager;
13908         int64_t channel_manager_ref = 0;
13909         // WARNING: we may need a move here but no clone is available for LDKChannelManager
13910         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
13911         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
13912         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13913         CHECK(obj != NULL);
13914         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
13915         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13916                 (*env)->ExceptionDescribe(env);
13917                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
13918         }
13919         void* ret_ptr = untag_ptr(ret);
13920         CHECK_ACCESS(ret_ptr);
13921         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13922         FREE(untag_ptr(ret));
13923         if (get_jenv_res == JNI_EDETACHED) {
13924                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13925         }
13926         return ret_conv;
13927 }
13928 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
13929         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13930         JNIEnv *env;
13931         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13932         if (get_jenv_res == JNI_EDETACHED) {
13933                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13934         } else {
13935                 DO_ASSERT(get_jenv_res == JNI_OK);
13936         }
13937         LDKNetworkGraph network_graph_var = *network_graph;
13938         int64_t network_graph_ref = 0;
13939         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
13940         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
13941         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
13942         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13943         CHECK(obj != NULL);
13944         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
13945         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13946                 (*env)->ExceptionDescribe(env);
13947                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
13948         }
13949         void* ret_ptr = untag_ptr(ret);
13950         CHECK_ACCESS(ret_ptr);
13951         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13952         FREE(untag_ptr(ret));
13953         if (get_jenv_res == JNI_EDETACHED) {
13954                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13955         }
13956         return ret_conv;
13957 }
13958 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
13959         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13960         JNIEnv *env;
13961         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13962         if (get_jenv_res == JNI_EDETACHED) {
13963                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13964         } else {
13965                 DO_ASSERT(get_jenv_res == JNI_OK);
13966         }
13967         // WARNING: This object doesn't live past this scope, needs clone!
13968         int64_t ret_scorer = tag_ptr(scorer, false);
13969         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13970         CHECK(obj != NULL);
13971         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
13972         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13973                 (*env)->ExceptionDescribe(env);
13974                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
13975         }
13976         void* ret_ptr = untag_ptr(ret);
13977         CHECK_ACCESS(ret_ptr);
13978         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13979         FREE(untag_ptr(ret));
13980         if (get_jenv_res == JNI_EDETACHED) {
13981                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13982         }
13983         return ret_conv;
13984 }
13985 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
13986         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
13987         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13988 }
13989 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
13990         jclass c = (*env)->GetObjectClass(env, o);
13991         CHECK(c != NULL);
13992         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
13993         atomic_init(&calls->refcnt, 1);
13994         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13995         calls->o = (*env)->NewWeakGlobalRef(env, o);
13996         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
13997         CHECK(calls->persist_manager_meth != NULL);
13998         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
13999         CHECK(calls->persist_graph_meth != NULL);
14000         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
14001         CHECK(calls->persist_scorer_meth != NULL);
14002
14003         LDKPersister ret = {
14004                 .this_arg = (void*) calls,
14005                 .persist_manager = persist_manager_LDKPersister_jcall,
14006                 .persist_graph = persist_graph_LDKPersister_jcall,
14007                 .persist_scorer = persist_scorer_LDKPersister_jcall,
14008                 .free = LDKPersister_JCalls_free,
14009         };
14010         return ret;
14011 }
14012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
14013         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
14014         *res_ptr = LDKPersister_init(env, clz, o);
14015         return tag_ptr(res_ptr, true);
14016 }
14017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
14018         void* this_arg_ptr = untag_ptr(this_arg);
14019         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14020         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14021         LDKChannelManager channel_manager_conv;
14022         channel_manager_conv.inner = untag_ptr(channel_manager);
14023         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
14024         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
14025         channel_manager_conv.is_owned = false;
14026         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14027         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
14028         return tag_ptr(ret_conv, true);
14029 }
14030
14031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
14032         void* this_arg_ptr = untag_ptr(this_arg);
14033         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14034         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14035         LDKNetworkGraph network_graph_conv;
14036         network_graph_conv.inner = untag_ptr(network_graph);
14037         network_graph_conv.is_owned = ptr_is_owned(network_graph);
14038         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
14039         network_graph_conv.is_owned = false;
14040         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14041         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
14042         return tag_ptr(ret_conv, true);
14043 }
14044
14045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
14046         void* this_arg_ptr = untag_ptr(this_arg);
14047         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14048         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14049         void* scorer_ptr = untag_ptr(scorer);
14050         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
14051         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
14052         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14053         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
14054         return tag_ptr(ret_conv, true);
14055 }
14056
14057 typedef struct LDKFutureCallback_JCalls {
14058         atomic_size_t refcnt;
14059         JavaVM *vm;
14060         jweak o;
14061         jmethodID call_meth;
14062 } LDKFutureCallback_JCalls;
14063 static void LDKFutureCallback_JCalls_free(void* this_arg) {
14064         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14065         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14066                 JNIEnv *env;
14067                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14068                 if (get_jenv_res == JNI_EDETACHED) {
14069                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14070                 } else {
14071                         DO_ASSERT(get_jenv_res == JNI_OK);
14072                 }
14073                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14074                 if (get_jenv_res == JNI_EDETACHED) {
14075                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14076                 }
14077                 FREE(j_calls);
14078         }
14079 }
14080 void call_LDKFutureCallback_jcall(const void* this_arg) {
14081         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14082         JNIEnv *env;
14083         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14084         if (get_jenv_res == JNI_EDETACHED) {
14085                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14086         } else {
14087                 DO_ASSERT(get_jenv_res == JNI_OK);
14088         }
14089         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14090         CHECK(obj != NULL);
14091         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
14092         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14093                 (*env)->ExceptionDescribe(env);
14094                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
14095         }
14096         if (get_jenv_res == JNI_EDETACHED) {
14097                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14098         }
14099 }
14100 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
14101         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
14102         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14103 }
14104 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
14105         jclass c = (*env)->GetObjectClass(env, o);
14106         CHECK(c != NULL);
14107         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
14108         atomic_init(&calls->refcnt, 1);
14109         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14110         calls->o = (*env)->NewWeakGlobalRef(env, o);
14111         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
14112         CHECK(calls->call_meth != NULL);
14113
14114         LDKFutureCallback ret = {
14115                 .this_arg = (void*) calls,
14116                 .call = call_LDKFutureCallback_jcall,
14117                 .free = LDKFutureCallback_JCalls_free,
14118         };
14119         return ret;
14120 }
14121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
14122         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
14123         *res_ptr = LDKFutureCallback_init(env, clz, o);
14124         return tag_ptr(res_ptr, true);
14125 }
14126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
14127         void* this_arg_ptr = untag_ptr(this_arg);
14128         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14129         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
14130         (this_arg_conv->call)(this_arg_conv->this_arg);
14131 }
14132
14133 typedef struct LDKListen_JCalls {
14134         atomic_size_t refcnt;
14135         JavaVM *vm;
14136         jweak o;
14137         jmethodID filtered_block_connected_meth;
14138         jmethodID block_connected_meth;
14139         jmethodID block_disconnected_meth;
14140 } LDKListen_JCalls;
14141 static void LDKListen_JCalls_free(void* this_arg) {
14142         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14143         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14144                 JNIEnv *env;
14145                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14146                 if (get_jenv_res == JNI_EDETACHED) {
14147                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14148                 } else {
14149                         DO_ASSERT(get_jenv_res == JNI_OK);
14150                 }
14151                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14152                 if (get_jenv_res == JNI_EDETACHED) {
14153                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14154                 }
14155                 FREE(j_calls);
14156         }
14157 }
14158 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14159         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14160         JNIEnv *env;
14161         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14162         if (get_jenv_res == JNI_EDETACHED) {
14163                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14164         } else {
14165                 DO_ASSERT(get_jenv_res == JNI_OK);
14166         }
14167         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
14168         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
14169         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14170         int64_tArray txdata_arr = NULL;
14171         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
14172         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
14173         for (size_t c = 0; c < txdata_var.datalen; c++) {
14174                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14175                 *txdata_conv_28_conv = txdata_var.data[c];
14176                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14177         }
14178         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
14179         FREE(txdata_var.data);
14180         int32_t height_conv = height;
14181         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14182         CHECK(obj != NULL);
14183         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
14184         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14185                 (*env)->ExceptionDescribe(env);
14186                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
14187         }
14188         if (get_jenv_res == JNI_EDETACHED) {
14189                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14190         }
14191 }
14192 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
14193         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14194         JNIEnv *env;
14195         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14196         if (get_jenv_res == JNI_EDETACHED) {
14197                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14198         } else {
14199                 DO_ASSERT(get_jenv_res == JNI_OK);
14200         }
14201         LDKu8slice block_var = block;
14202         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
14203         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
14204         int32_t height_conv = height;
14205         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14206         CHECK(obj != NULL);
14207         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
14208         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14209                 (*env)->ExceptionDescribe(env);
14210                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
14211         }
14212         if (get_jenv_res == JNI_EDETACHED) {
14213                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14214         }
14215 }
14216 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14217         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14218         JNIEnv *env;
14219         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14220         if (get_jenv_res == JNI_EDETACHED) {
14221                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14222         } else {
14223                 DO_ASSERT(get_jenv_res == JNI_OK);
14224         }
14225         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
14226         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
14227         int32_t height_conv = height;
14228         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14229         CHECK(obj != NULL);
14230         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
14231         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14232                 (*env)->ExceptionDescribe(env);
14233                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
14234         }
14235         if (get_jenv_res == JNI_EDETACHED) {
14236                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14237         }
14238 }
14239 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
14240         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
14241         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14242 }
14243 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
14244         jclass c = (*env)->GetObjectClass(env, o);
14245         CHECK(c != NULL);
14246         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
14247         atomic_init(&calls->refcnt, 1);
14248         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14249         calls->o = (*env)->NewWeakGlobalRef(env, o);
14250         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
14251         CHECK(calls->filtered_block_connected_meth != NULL);
14252         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
14253         CHECK(calls->block_connected_meth != NULL);
14254         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
14255         CHECK(calls->block_disconnected_meth != NULL);
14256
14257         LDKListen ret = {
14258                 .this_arg = (void*) calls,
14259                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
14260                 .block_connected = block_connected_LDKListen_jcall,
14261                 .block_disconnected = block_disconnected_LDKListen_jcall,
14262                 .free = LDKListen_JCalls_free,
14263         };
14264         return ret;
14265 }
14266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
14267         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
14268         *res_ptr = LDKListen_init(env, clz, o);
14269         return tag_ptr(res_ptr, true);
14270 }
14271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1filtered_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
14272         void* this_arg_ptr = untag_ptr(this_arg);
14273         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14274         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14275         uint8_t header_arr[80];
14276         CHECK((*env)->GetArrayLength(env, header) == 80);
14277         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14278         uint8_t (*header_ref)[80] = &header_arr;
14279         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14280         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14281         if (txdata_constr.datalen > 0)
14282                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14283         else
14284                 txdata_constr.data = NULL;
14285         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14286         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14287                 int64_t txdata_conv_28 = txdata_vals[c];
14288                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14289                 CHECK_ACCESS(txdata_conv_28_ptr);
14290                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14291                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14292                 txdata_constr.data[c] = txdata_conv_28_conv;
14293         }
14294         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14295         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14296 }
14297
14298 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) {
14299         void* this_arg_ptr = untag_ptr(this_arg);
14300         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14301         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14302         LDKu8slice block_ref;
14303         block_ref.datalen = (*env)->GetArrayLength(env, block);
14304         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
14305         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
14306         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
14307 }
14308
14309 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) {
14310         void* this_arg_ptr = untag_ptr(this_arg);
14311         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14312         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14313         uint8_t header_arr[80];
14314         CHECK((*env)->GetArrayLength(env, header) == 80);
14315         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14316         uint8_t (*header_ref)[80] = &header_arr;
14317         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
14318 }
14319
14320 typedef struct LDKConfirm_JCalls {
14321         atomic_size_t refcnt;
14322         JavaVM *vm;
14323         jweak o;
14324         jmethodID transactions_confirmed_meth;
14325         jmethodID transaction_unconfirmed_meth;
14326         jmethodID best_block_updated_meth;
14327         jmethodID get_relevant_txids_meth;
14328 } LDKConfirm_JCalls;
14329 static void LDKConfirm_JCalls_free(void* this_arg) {
14330         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14331         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14332                 JNIEnv *env;
14333                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14334                 if (get_jenv_res == JNI_EDETACHED) {
14335                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14336                 } else {
14337                         DO_ASSERT(get_jenv_res == JNI_OK);
14338                 }
14339                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14340                 if (get_jenv_res == JNI_EDETACHED) {
14341                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14342                 }
14343                 FREE(j_calls);
14344         }
14345 }
14346 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14347         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14348         JNIEnv *env;
14349         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14350         if (get_jenv_res == JNI_EDETACHED) {
14351                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14352         } else {
14353                 DO_ASSERT(get_jenv_res == JNI_OK);
14354         }
14355         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
14356         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
14357         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14358         int64_tArray txdata_arr = NULL;
14359         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
14360         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
14361         for (size_t c = 0; c < txdata_var.datalen; c++) {
14362                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14363                 *txdata_conv_28_conv = txdata_var.data[c];
14364                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14365         }
14366         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
14367         FREE(txdata_var.data);
14368         int32_t height_conv = height;
14369         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14370         CHECK(obj != NULL);
14371         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
14372         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14373                 (*env)->ExceptionDescribe(env);
14374                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
14375         }
14376         if (get_jenv_res == JNI_EDETACHED) {
14377                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14378         }
14379 }
14380 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
14381         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14382         JNIEnv *env;
14383         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14384         if (get_jenv_res == JNI_EDETACHED) {
14385                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14386         } else {
14387                 DO_ASSERT(get_jenv_res == JNI_OK);
14388         }
14389         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
14390         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
14391         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14392         CHECK(obj != NULL);
14393         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
14394         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14395                 (*env)->ExceptionDescribe(env);
14396                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
14397         }
14398         if (get_jenv_res == JNI_EDETACHED) {
14399                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14400         }
14401 }
14402 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14403         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14404         JNIEnv *env;
14405         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14406         if (get_jenv_res == JNI_EDETACHED) {
14407                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14408         } else {
14409                 DO_ASSERT(get_jenv_res == JNI_OK);
14410         }
14411         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
14412         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
14413         int32_t height_conv = height;
14414         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14415         CHECK(obj != NULL);
14416         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
14417         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14418                 (*env)->ExceptionDescribe(env);
14419                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
14420         }
14421         if (get_jenv_res == JNI_EDETACHED) {
14422                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14423         }
14424 }
14425 LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
14426         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14427         JNIEnv *env;
14428         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14429         if (get_jenv_res == JNI_EDETACHED) {
14430                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14431         } else {
14432                 DO_ASSERT(get_jenv_res == JNI_OK);
14433         }
14434         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14435         CHECK(obj != NULL);
14436         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
14437         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14438                 (*env)->ExceptionDescribe(env);
14439                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
14440         }
14441         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_constr;
14442         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
14443         if (ret_constr.datalen > 0)
14444                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ Elements");
14445         else
14446                 ret_constr.data = NULL;
14447         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
14448         for (size_t i = 0; i < ret_constr.datalen; i++) {
14449                 int64_t ret_conv_34 = ret_vals[i];
14450                 void* ret_conv_34_ptr = untag_ptr(ret_conv_34);
14451                 CHECK_ACCESS(ret_conv_34_ptr);
14452                 LDKC2Tuple_TxidCOption_BlockHashZZ ret_conv_34_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(ret_conv_34_ptr);
14453                 FREE(untag_ptr(ret_conv_34));
14454                 ret_constr.data[i] = ret_conv_34_conv;
14455         }
14456         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
14457         if (get_jenv_res == JNI_EDETACHED) {
14458                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14459         }
14460         return ret_constr;
14461 }
14462 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
14463         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
14464         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14465 }
14466 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
14467         jclass c = (*env)->GetObjectClass(env, o);
14468         CHECK(c != NULL);
14469         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
14470         atomic_init(&calls->refcnt, 1);
14471         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14472         calls->o = (*env)->NewWeakGlobalRef(env, o);
14473         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
14474         CHECK(calls->transactions_confirmed_meth != NULL);
14475         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
14476         CHECK(calls->transaction_unconfirmed_meth != NULL);
14477         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
14478         CHECK(calls->best_block_updated_meth != NULL);
14479         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
14480         CHECK(calls->get_relevant_txids_meth != NULL);
14481
14482         LDKConfirm ret = {
14483                 .this_arg = (void*) calls,
14484                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
14485                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
14486                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
14487                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
14488                 .free = LDKConfirm_JCalls_free,
14489         };
14490         return ret;
14491 }
14492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
14493         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14494         *res_ptr = LDKConfirm_init(env, clz, o);
14495         return tag_ptr(res_ptr, true);
14496 }
14497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
14498         void* this_arg_ptr = untag_ptr(this_arg);
14499         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14500         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14501         uint8_t header_arr[80];
14502         CHECK((*env)->GetArrayLength(env, header) == 80);
14503         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14504         uint8_t (*header_ref)[80] = &header_arr;
14505         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14506         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14507         if (txdata_constr.datalen > 0)
14508                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14509         else
14510                 txdata_constr.data = NULL;
14511         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14512         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14513                 int64_t txdata_conv_28 = txdata_vals[c];
14514                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14515                 CHECK_ACCESS(txdata_conv_28_ptr);
14516                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14517                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14518                 txdata_constr.data[c] = txdata_conv_28_conv;
14519         }
14520         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14521         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14522 }
14523
14524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
14525         void* this_arg_ptr = untag_ptr(this_arg);
14526         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14527         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14528         uint8_t txid_arr[32];
14529         CHECK((*env)->GetArrayLength(env, txid) == 32);
14530         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14531         uint8_t (*txid_ref)[32] = &txid_arr;
14532         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
14533 }
14534
14535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
14536         void* this_arg_ptr = untag_ptr(this_arg);
14537         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14538         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14539         uint8_t header_arr[80];
14540         CHECK((*env)->GetArrayLength(env, header) == 80);
14541         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14542         uint8_t (*header_ref)[80] = &header_arr;
14543         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
14544 }
14545
14546 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
14547         void* this_arg_ptr = untag_ptr(this_arg);
14548         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14549         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14550         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
14551         int64_tArray ret_arr = NULL;
14552         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14553         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14554         for (size_t i = 0; i < ret_var.datalen; i++) {
14555                 LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv_34_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
14556                 *ret_conv_34_conv = ret_var.data[i];
14557                 ret_arr_ptr[i] = tag_ptr(ret_conv_34_conv, true);
14558         }
14559         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14560         FREE(ret_var.data);
14561         return ret_arr;
14562 }
14563
14564 typedef struct LDKPersist_JCalls {
14565         atomic_size_t refcnt;
14566         JavaVM *vm;
14567         jweak o;
14568         jmethodID persist_new_channel_meth;
14569         jmethodID update_persisted_channel_meth;
14570 } LDKPersist_JCalls;
14571 static void LDKPersist_JCalls_free(void* this_arg) {
14572         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14573         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14574                 JNIEnv *env;
14575                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14576                 if (get_jenv_res == JNI_EDETACHED) {
14577                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14578                 } else {
14579                         DO_ASSERT(get_jenv_res == JNI_OK);
14580                 }
14581                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14582                 if (get_jenv_res == JNI_EDETACHED) {
14583                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14584                 }
14585                 FREE(j_calls);
14586         }
14587 }
14588 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14589         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14590         JNIEnv *env;
14591         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14592         if (get_jenv_res == JNI_EDETACHED) {
14593                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14594         } else {
14595                 DO_ASSERT(get_jenv_res == JNI_OK);
14596         }
14597         LDKOutPoint channel_id_var = channel_id;
14598         int64_t channel_id_ref = 0;
14599         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14600         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
14601         LDKChannelMonitor data_var = *data;
14602         int64_t data_ref = 0;
14603         data_var = ChannelMonitor_clone(&data_var);
14604         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14605         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14606         LDKMonitorUpdateId update_id_var = update_id;
14607         int64_t update_id_ref = 0;
14608         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14609         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14610         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14611         CHECK(obj != NULL);
14612         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
14613         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14614                 (*env)->ExceptionDescribe(env);
14615                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
14616         }
14617         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
14618         if (get_jenv_res == JNI_EDETACHED) {
14619                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14620         }
14621         return ret_conv;
14622 }
14623 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14624         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14625         JNIEnv *env;
14626         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14627         if (get_jenv_res == JNI_EDETACHED) {
14628                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14629         } else {
14630                 DO_ASSERT(get_jenv_res == JNI_OK);
14631         }
14632         LDKOutPoint channel_id_var = channel_id;
14633         int64_t channel_id_ref = 0;
14634         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14635         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
14636         LDKChannelMonitorUpdate update_var = update;
14637         int64_t update_ref = 0;
14638         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
14639         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
14640         LDKChannelMonitor data_var = *data;
14641         int64_t data_ref = 0;
14642         data_var = ChannelMonitor_clone(&data_var);
14643         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14644         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14645         LDKMonitorUpdateId update_id_var = update_id;
14646         int64_t update_id_ref = 0;
14647         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14648         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14649         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14650         CHECK(obj != NULL);
14651         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
14652         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14653                 (*env)->ExceptionDescribe(env);
14654                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
14655         }
14656         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
14657         if (get_jenv_res == JNI_EDETACHED) {
14658                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14659         }
14660         return ret_conv;
14661 }
14662 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
14663         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
14664         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14665 }
14666 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
14667         jclass c = (*env)->GetObjectClass(env, o);
14668         CHECK(c != NULL);
14669         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
14670         atomic_init(&calls->refcnt, 1);
14671         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14672         calls->o = (*env)->NewWeakGlobalRef(env, o);
14673         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
14674         CHECK(calls->persist_new_channel_meth != NULL);
14675         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
14676         CHECK(calls->update_persisted_channel_meth != NULL);
14677
14678         LDKPersist ret = {
14679                 .this_arg = (void*) calls,
14680                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
14681                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
14682                 .free = LDKPersist_JCalls_free,
14683         };
14684         return ret;
14685 }
14686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
14687         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
14688         *res_ptr = LDKPersist_init(env, clz, o);
14689         return tag_ptr(res_ptr, true);
14690 }
14691 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
14692         void* this_arg_ptr = untag_ptr(this_arg);
14693         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14694         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14695         LDKOutPoint channel_id_conv;
14696         channel_id_conv.inner = untag_ptr(channel_id);
14697         channel_id_conv.is_owned = ptr_is_owned(channel_id);
14698         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
14699         channel_id_conv = OutPoint_clone(&channel_id_conv);
14700         LDKChannelMonitor data_conv;
14701         data_conv.inner = untag_ptr(data);
14702         data_conv.is_owned = ptr_is_owned(data);
14703         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14704         data_conv.is_owned = false;
14705         LDKMonitorUpdateId update_id_conv;
14706         update_id_conv.inner = untag_ptr(update_id);
14707         update_id_conv.is_owned = ptr_is_owned(update_id);
14708         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14709         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14710         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv));
14711         return ret_conv;
14712 }
14713
14714 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
14715         void* this_arg_ptr = untag_ptr(this_arg);
14716         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14717         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14718         LDKOutPoint channel_id_conv;
14719         channel_id_conv.inner = untag_ptr(channel_id);
14720         channel_id_conv.is_owned = ptr_is_owned(channel_id);
14721         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
14722         channel_id_conv = OutPoint_clone(&channel_id_conv);
14723         LDKChannelMonitorUpdate update_conv;
14724         update_conv.inner = untag_ptr(update);
14725         update_conv.is_owned = ptr_is_owned(update);
14726         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
14727         update_conv = ChannelMonitorUpdate_clone(&update_conv);
14728         LDKChannelMonitor data_conv;
14729         data_conv.inner = untag_ptr(data);
14730         data_conv.is_owned = ptr_is_owned(data);
14731         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14732         data_conv.is_owned = false;
14733         LDKMonitorUpdateId update_id_conv;
14734         update_id_conv.inner = untag_ptr(update_id);
14735         update_id_conv.is_owned = ptr_is_owned(update_id);
14736         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14737         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14738         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv));
14739         return ret_conv;
14740 }
14741
14742 typedef struct LDKEventHandler_JCalls {
14743         atomic_size_t refcnt;
14744         JavaVM *vm;
14745         jweak o;
14746         jmethodID handle_event_meth;
14747 } LDKEventHandler_JCalls;
14748 static void LDKEventHandler_JCalls_free(void* this_arg) {
14749         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
14750         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14751                 JNIEnv *env;
14752                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14753                 if (get_jenv_res == JNI_EDETACHED) {
14754                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14755                 } else {
14756                         DO_ASSERT(get_jenv_res == JNI_OK);
14757                 }
14758                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14759                 if (get_jenv_res == JNI_EDETACHED) {
14760                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14761                 }
14762                 FREE(j_calls);
14763         }
14764 }
14765 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
14766         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
14767         JNIEnv *env;
14768         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14769         if (get_jenv_res == JNI_EDETACHED) {
14770                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14771         } else {
14772                 DO_ASSERT(get_jenv_res == JNI_OK);
14773         }
14774         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14775         *event_copy = event;
14776         int64_t event_ref = tag_ptr(event_copy, true);
14777         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14778         CHECK(obj != NULL);
14779         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
14780         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14781                 (*env)->ExceptionDescribe(env);
14782                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
14783         }
14784         if (get_jenv_res == JNI_EDETACHED) {
14785                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14786         }
14787 }
14788 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
14789         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
14790         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14791 }
14792 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
14793         jclass c = (*env)->GetObjectClass(env, o);
14794         CHECK(c != NULL);
14795         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
14796         atomic_init(&calls->refcnt, 1);
14797         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14798         calls->o = (*env)->NewWeakGlobalRef(env, o);
14799         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
14800         CHECK(calls->handle_event_meth != NULL);
14801
14802         LDKEventHandler ret = {
14803                 .this_arg = (void*) calls,
14804                 .handle_event = handle_event_LDKEventHandler_jcall,
14805                 .free = LDKEventHandler_JCalls_free,
14806         };
14807         return ret;
14808 }
14809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
14810         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
14811         *res_ptr = LDKEventHandler_init(env, clz, o);
14812         return tag_ptr(res_ptr, true);
14813 }
14814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
14815         void* this_arg_ptr = untag_ptr(this_arg);
14816         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14817         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
14818         void* event_ptr = untag_ptr(event);
14819         CHECK_ACCESS(event_ptr);
14820         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
14821         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
14822         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
14823 }
14824
14825 typedef struct LDKEventsProvider_JCalls {
14826         atomic_size_t refcnt;
14827         JavaVM *vm;
14828         jweak o;
14829         jmethodID process_pending_events_meth;
14830 } LDKEventsProvider_JCalls;
14831 static void LDKEventsProvider_JCalls_free(void* this_arg) {
14832         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
14833         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14834                 JNIEnv *env;
14835                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14836                 if (get_jenv_res == JNI_EDETACHED) {
14837                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14838                 } else {
14839                         DO_ASSERT(get_jenv_res == JNI_OK);
14840                 }
14841                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14842                 if (get_jenv_res == JNI_EDETACHED) {
14843                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14844                 }
14845                 FREE(j_calls);
14846         }
14847 }
14848 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
14849         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
14850         JNIEnv *env;
14851         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14852         if (get_jenv_res == JNI_EDETACHED) {
14853                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14854         } else {
14855                 DO_ASSERT(get_jenv_res == JNI_OK);
14856         }
14857         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
14858         *handler_ret = handler;
14859         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14860         CHECK(obj != NULL);
14861         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
14862         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14863                 (*env)->ExceptionDescribe(env);
14864                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
14865         }
14866         if (get_jenv_res == JNI_EDETACHED) {
14867                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14868         }
14869 }
14870 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
14871         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
14872         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14873 }
14874 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
14875         jclass c = (*env)->GetObjectClass(env, o);
14876         CHECK(c != NULL);
14877         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
14878         atomic_init(&calls->refcnt, 1);
14879         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14880         calls->o = (*env)->NewWeakGlobalRef(env, o);
14881         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
14882         CHECK(calls->process_pending_events_meth != NULL);
14883
14884         LDKEventsProvider ret = {
14885                 .this_arg = (void*) calls,
14886                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
14887                 .free = LDKEventsProvider_JCalls_free,
14888         };
14889         return ret;
14890 }
14891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
14892         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14893         *res_ptr = LDKEventsProvider_init(env, clz, o);
14894         return tag_ptr(res_ptr, true);
14895 }
14896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
14897         void* this_arg_ptr = untag_ptr(this_arg);
14898         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14899         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
14900         void* handler_ptr = untag_ptr(handler);
14901         CHECK_ACCESS(handler_ptr);
14902         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
14903         if (handler_conv.free == LDKEventHandler_JCalls_free) {
14904                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14905                 LDKEventHandler_JCalls_cloned(&handler_conv);
14906         }
14907         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
14908 }
14909
14910 static jclass LDKRetry_Attempts_class = NULL;
14911 static jmethodID LDKRetry_Attempts_meth = NULL;
14912 static jclass LDKRetry_Timeout_class = NULL;
14913 static jmethodID LDKRetry_Timeout_meth = NULL;
14914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
14915         LDKRetry_Attempts_class =
14916                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
14917         CHECK(LDKRetry_Attempts_class != NULL);
14918         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
14919         CHECK(LDKRetry_Attempts_meth != NULL);
14920         LDKRetry_Timeout_class =
14921                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
14922         CHECK(LDKRetry_Timeout_class != NULL);
14923         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
14924         CHECK(LDKRetry_Timeout_meth != NULL);
14925 }
14926 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14927         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
14928         switch(obj->tag) {
14929                 case LDKRetry_Attempts: {
14930                         int64_t attempts_conv = obj->attempts;
14931                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
14932                 }
14933                 case LDKRetry_Timeout: {
14934                         int64_t timeout_conv = obj->timeout;
14935                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
14936                 }
14937                 default: abort();
14938         }
14939 }
14940 typedef struct LDKMessageSendEventsProvider_JCalls {
14941         atomic_size_t refcnt;
14942         JavaVM *vm;
14943         jweak o;
14944         jmethodID get_and_clear_pending_msg_events_meth;
14945 } LDKMessageSendEventsProvider_JCalls;
14946 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
14947         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
14948         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14949                 JNIEnv *env;
14950                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14951                 if (get_jenv_res == JNI_EDETACHED) {
14952                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14953                 } else {
14954                         DO_ASSERT(get_jenv_res == JNI_OK);
14955                 }
14956                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14957                 if (get_jenv_res == JNI_EDETACHED) {
14958                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14959                 }
14960                 FREE(j_calls);
14961         }
14962 }
14963 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
14964         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
14965         JNIEnv *env;
14966         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14967         if (get_jenv_res == JNI_EDETACHED) {
14968                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14969         } else {
14970                 DO_ASSERT(get_jenv_res == JNI_OK);
14971         }
14972         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14973         CHECK(obj != NULL);
14974         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
14975         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14976                 (*env)->ExceptionDescribe(env);
14977                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
14978         }
14979         LDKCVec_MessageSendEventZ ret_constr;
14980         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
14981         if (ret_constr.datalen > 0)
14982                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
14983         else
14984                 ret_constr.data = NULL;
14985         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
14986         for (size_t s = 0; s < ret_constr.datalen; s++) {
14987                 int64_t ret_conv_18 = ret_vals[s];
14988                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
14989                 CHECK_ACCESS(ret_conv_18_ptr);
14990                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
14991                 FREE(untag_ptr(ret_conv_18));
14992                 ret_constr.data[s] = ret_conv_18_conv;
14993         }
14994         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
14995         if (get_jenv_res == JNI_EDETACHED) {
14996                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14997         }
14998         return ret_constr;
14999 }
15000 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
15001         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
15002         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15003 }
15004 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
15005         jclass c = (*env)->GetObjectClass(env, o);
15006         CHECK(c != NULL);
15007         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
15008         atomic_init(&calls->refcnt, 1);
15009         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15010         calls->o = (*env)->NewWeakGlobalRef(env, o);
15011         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
15012         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
15013
15014         LDKMessageSendEventsProvider ret = {
15015                 .this_arg = (void*) calls,
15016                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
15017                 .free = LDKMessageSendEventsProvider_JCalls_free,
15018         };
15019         return ret;
15020 }
15021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
15022         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15023         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
15024         return tag_ptr(res_ptr, true);
15025 }
15026 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
15027         void* this_arg_ptr = untag_ptr(this_arg);
15028         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15029         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
15030         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
15031         int64_tArray ret_arr = NULL;
15032         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15033         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15034         for (size_t s = 0; s < ret_var.datalen; s++) {
15035                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15036                 *ret_conv_18_copy = ret_var.data[s];
15037                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
15038                 ret_arr_ptr[s] = ret_conv_18_ref;
15039         }
15040         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15041         FREE(ret_var.data);
15042         return ret_arr;
15043 }
15044
15045 typedef struct LDKChannelMessageHandler_JCalls {
15046         atomic_size_t refcnt;
15047         JavaVM *vm;
15048         jweak o;
15049         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
15050         jmethodID handle_open_channel_meth;
15051         jmethodID handle_open_channel_v2_meth;
15052         jmethodID handle_accept_channel_meth;
15053         jmethodID handle_accept_channel_v2_meth;
15054         jmethodID handle_funding_created_meth;
15055         jmethodID handle_funding_signed_meth;
15056         jmethodID handle_channel_ready_meth;
15057         jmethodID handle_shutdown_meth;
15058         jmethodID handle_closing_signed_meth;
15059         jmethodID handle_tx_add_input_meth;
15060         jmethodID handle_tx_add_output_meth;
15061         jmethodID handle_tx_remove_input_meth;
15062         jmethodID handle_tx_remove_output_meth;
15063         jmethodID handle_tx_complete_meth;
15064         jmethodID handle_tx_signatures_meth;
15065         jmethodID handle_tx_init_rbf_meth;
15066         jmethodID handle_tx_ack_rbf_meth;
15067         jmethodID handle_tx_abort_meth;
15068         jmethodID handle_update_add_htlc_meth;
15069         jmethodID handle_update_fulfill_htlc_meth;
15070         jmethodID handle_update_fail_htlc_meth;
15071         jmethodID handle_update_fail_malformed_htlc_meth;
15072         jmethodID handle_commitment_signed_meth;
15073         jmethodID handle_revoke_and_ack_meth;
15074         jmethodID handle_update_fee_meth;
15075         jmethodID handle_announcement_signatures_meth;
15076         jmethodID peer_disconnected_meth;
15077         jmethodID peer_connected_meth;
15078         jmethodID handle_channel_reestablish_meth;
15079         jmethodID handle_channel_update_meth;
15080         jmethodID handle_error_meth;
15081         jmethodID provided_node_features_meth;
15082         jmethodID provided_init_features_meth;
15083         jmethodID get_genesis_hashes_meth;
15084 } LDKChannelMessageHandler_JCalls;
15085 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
15086         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15087         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15088                 JNIEnv *env;
15089                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15090                 if (get_jenv_res == JNI_EDETACHED) {
15091                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15092                 } else {
15093                         DO_ASSERT(get_jenv_res == JNI_OK);
15094                 }
15095                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15096                 if (get_jenv_res == JNI_EDETACHED) {
15097                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15098                 }
15099                 FREE(j_calls);
15100         }
15101 }
15102 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
15103         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15104         JNIEnv *env;
15105         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15106         if (get_jenv_res == JNI_EDETACHED) {
15107                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15108         } else {
15109                 DO_ASSERT(get_jenv_res == JNI_OK);
15110         }
15111         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15112         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15113         LDKOpenChannel msg_var = *msg;
15114         int64_t msg_ref = 0;
15115         msg_var = OpenChannel_clone(&msg_var);
15116         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15117         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15118         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15119         CHECK(obj != NULL);
15120         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
15121         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15122                 (*env)->ExceptionDescribe(env);
15123                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
15124         }
15125         if (get_jenv_res == JNI_EDETACHED) {
15126                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15127         }
15128 }
15129 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
15130         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15131         JNIEnv *env;
15132         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15133         if (get_jenv_res == JNI_EDETACHED) {
15134                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15135         } else {
15136                 DO_ASSERT(get_jenv_res == JNI_OK);
15137         }
15138         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15139         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15140         LDKOpenChannelV2 msg_var = *msg;
15141         int64_t msg_ref = 0;
15142         msg_var = OpenChannelV2_clone(&msg_var);
15143         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15144         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15145         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15146         CHECK(obj != NULL);
15147         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
15148         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15149                 (*env)->ExceptionDescribe(env);
15150                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
15151         }
15152         if (get_jenv_res == JNI_EDETACHED) {
15153                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15154         }
15155 }
15156 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
15157         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15158         JNIEnv *env;
15159         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15160         if (get_jenv_res == JNI_EDETACHED) {
15161                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15162         } else {
15163                 DO_ASSERT(get_jenv_res == JNI_OK);
15164         }
15165         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15166         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15167         LDKAcceptChannel msg_var = *msg;
15168         int64_t msg_ref = 0;
15169         msg_var = AcceptChannel_clone(&msg_var);
15170         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15171         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15172         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15173         CHECK(obj != NULL);
15174         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
15175         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15176                 (*env)->ExceptionDescribe(env);
15177                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
15178         }
15179         if (get_jenv_res == JNI_EDETACHED) {
15180                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15181         }
15182 }
15183 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
15184         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15185         JNIEnv *env;
15186         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15187         if (get_jenv_res == JNI_EDETACHED) {
15188                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15189         } else {
15190                 DO_ASSERT(get_jenv_res == JNI_OK);
15191         }
15192         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15193         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15194         LDKAcceptChannelV2 msg_var = *msg;
15195         int64_t msg_ref = 0;
15196         msg_var = AcceptChannelV2_clone(&msg_var);
15197         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15198         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15199         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15200         CHECK(obj != NULL);
15201         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
15202         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15203                 (*env)->ExceptionDescribe(env);
15204                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
15205         }
15206         if (get_jenv_res == JNI_EDETACHED) {
15207                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15208         }
15209 }
15210 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
15211         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15212         JNIEnv *env;
15213         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15214         if (get_jenv_res == JNI_EDETACHED) {
15215                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15216         } else {
15217                 DO_ASSERT(get_jenv_res == JNI_OK);
15218         }
15219         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15220         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15221         LDKFundingCreated msg_var = *msg;
15222         int64_t msg_ref = 0;
15223         msg_var = FundingCreated_clone(&msg_var);
15224         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15225         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15226         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15227         CHECK(obj != NULL);
15228         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
15229         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15230                 (*env)->ExceptionDescribe(env);
15231                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
15232         }
15233         if (get_jenv_res == JNI_EDETACHED) {
15234                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15235         }
15236 }
15237 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
15238         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15239         JNIEnv *env;
15240         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15241         if (get_jenv_res == JNI_EDETACHED) {
15242                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15243         } else {
15244                 DO_ASSERT(get_jenv_res == JNI_OK);
15245         }
15246         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15247         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15248         LDKFundingSigned msg_var = *msg;
15249         int64_t msg_ref = 0;
15250         msg_var = FundingSigned_clone(&msg_var);
15251         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15252         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15253         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15254         CHECK(obj != NULL);
15255         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
15256         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15257                 (*env)->ExceptionDescribe(env);
15258                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
15259         }
15260         if (get_jenv_res == JNI_EDETACHED) {
15261                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15262         }
15263 }
15264 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
15265         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15266         JNIEnv *env;
15267         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15268         if (get_jenv_res == JNI_EDETACHED) {
15269                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15270         } else {
15271                 DO_ASSERT(get_jenv_res == JNI_OK);
15272         }
15273         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15274         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15275         LDKChannelReady msg_var = *msg;
15276         int64_t msg_ref = 0;
15277         msg_var = ChannelReady_clone(&msg_var);
15278         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15279         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15280         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15281         CHECK(obj != NULL);
15282         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
15283         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15284                 (*env)->ExceptionDescribe(env);
15285                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
15286         }
15287         if (get_jenv_res == JNI_EDETACHED) {
15288                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15289         }
15290 }
15291 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
15292         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15293         JNIEnv *env;
15294         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15295         if (get_jenv_res == JNI_EDETACHED) {
15296                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15297         } else {
15298                 DO_ASSERT(get_jenv_res == JNI_OK);
15299         }
15300         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15301         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15302         LDKShutdown msg_var = *msg;
15303         int64_t msg_ref = 0;
15304         msg_var = Shutdown_clone(&msg_var);
15305         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15306         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15307         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15308         CHECK(obj != NULL);
15309         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
15310         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15311                 (*env)->ExceptionDescribe(env);
15312                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
15313         }
15314         if (get_jenv_res == JNI_EDETACHED) {
15315                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15316         }
15317 }
15318 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
15319         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15320         JNIEnv *env;
15321         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15322         if (get_jenv_res == JNI_EDETACHED) {
15323                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15324         } else {
15325                 DO_ASSERT(get_jenv_res == JNI_OK);
15326         }
15327         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15328         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15329         LDKClosingSigned msg_var = *msg;
15330         int64_t msg_ref = 0;
15331         msg_var = ClosingSigned_clone(&msg_var);
15332         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15333         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15334         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15335         CHECK(obj != NULL);
15336         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
15337         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15338                 (*env)->ExceptionDescribe(env);
15339                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
15340         }
15341         if (get_jenv_res == JNI_EDETACHED) {
15342                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15343         }
15344 }
15345 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
15346         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15347         JNIEnv *env;
15348         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15349         if (get_jenv_res == JNI_EDETACHED) {
15350                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15351         } else {
15352                 DO_ASSERT(get_jenv_res == JNI_OK);
15353         }
15354         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15355         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15356         LDKTxAddInput msg_var = *msg;
15357         int64_t msg_ref = 0;
15358         msg_var = TxAddInput_clone(&msg_var);
15359         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15360         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15361         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15362         CHECK(obj != NULL);
15363         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
15364         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15365                 (*env)->ExceptionDescribe(env);
15366                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
15367         }
15368         if (get_jenv_res == JNI_EDETACHED) {
15369                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15370         }
15371 }
15372 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
15373         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15374         JNIEnv *env;
15375         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15376         if (get_jenv_res == JNI_EDETACHED) {
15377                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15378         } else {
15379                 DO_ASSERT(get_jenv_res == JNI_OK);
15380         }
15381         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15382         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15383         LDKTxAddOutput msg_var = *msg;
15384         int64_t msg_ref = 0;
15385         msg_var = TxAddOutput_clone(&msg_var);
15386         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15387         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15388         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15389         CHECK(obj != NULL);
15390         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
15391         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15392                 (*env)->ExceptionDescribe(env);
15393                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
15394         }
15395         if (get_jenv_res == JNI_EDETACHED) {
15396                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15397         }
15398 }
15399 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
15400         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15401         JNIEnv *env;
15402         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15403         if (get_jenv_res == JNI_EDETACHED) {
15404                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15405         } else {
15406                 DO_ASSERT(get_jenv_res == JNI_OK);
15407         }
15408         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15409         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15410         LDKTxRemoveInput msg_var = *msg;
15411         int64_t msg_ref = 0;
15412         msg_var = TxRemoveInput_clone(&msg_var);
15413         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15414         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15415         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15416         CHECK(obj != NULL);
15417         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
15418         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15419                 (*env)->ExceptionDescribe(env);
15420                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
15421         }
15422         if (get_jenv_res == JNI_EDETACHED) {
15423                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15424         }
15425 }
15426 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
15427         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15428         JNIEnv *env;
15429         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15430         if (get_jenv_res == JNI_EDETACHED) {
15431                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15432         } else {
15433                 DO_ASSERT(get_jenv_res == JNI_OK);
15434         }
15435         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15436         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15437         LDKTxRemoveOutput msg_var = *msg;
15438         int64_t msg_ref = 0;
15439         msg_var = TxRemoveOutput_clone(&msg_var);
15440         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15441         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15442         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15443         CHECK(obj != NULL);
15444         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
15445         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15446                 (*env)->ExceptionDescribe(env);
15447                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
15448         }
15449         if (get_jenv_res == JNI_EDETACHED) {
15450                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15451         }
15452 }
15453 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
15454         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15455         JNIEnv *env;
15456         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15457         if (get_jenv_res == JNI_EDETACHED) {
15458                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15459         } else {
15460                 DO_ASSERT(get_jenv_res == JNI_OK);
15461         }
15462         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15463         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15464         LDKTxComplete msg_var = *msg;
15465         int64_t msg_ref = 0;
15466         msg_var = TxComplete_clone(&msg_var);
15467         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15468         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15469         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15470         CHECK(obj != NULL);
15471         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
15472         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15473                 (*env)->ExceptionDescribe(env);
15474                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
15475         }
15476         if (get_jenv_res == JNI_EDETACHED) {
15477                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15478         }
15479 }
15480 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
15481         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15482         JNIEnv *env;
15483         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15484         if (get_jenv_res == JNI_EDETACHED) {
15485                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15486         } else {
15487                 DO_ASSERT(get_jenv_res == JNI_OK);
15488         }
15489         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15490         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15491         LDKTxSignatures msg_var = *msg;
15492         int64_t msg_ref = 0;
15493         msg_var = TxSignatures_clone(&msg_var);
15494         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15495         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15496         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15497         CHECK(obj != NULL);
15498         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
15499         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15500                 (*env)->ExceptionDescribe(env);
15501                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler from rust threw an exception.");
15502         }
15503         if (get_jenv_res == JNI_EDETACHED) {
15504                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15505         }
15506 }
15507 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
15508         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15509         JNIEnv *env;
15510         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15511         if (get_jenv_res == JNI_EDETACHED) {
15512                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15513         } else {
15514                 DO_ASSERT(get_jenv_res == JNI_OK);
15515         }
15516         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15517         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15518         LDKTxInitRbf msg_var = *msg;
15519         int64_t msg_ref = 0;
15520         msg_var = TxInitRbf_clone(&msg_var);
15521         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15522         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15523         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15524         CHECK(obj != NULL);
15525         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
15526         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15527                 (*env)->ExceptionDescribe(env);
15528                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
15529         }
15530         if (get_jenv_res == JNI_EDETACHED) {
15531                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15532         }
15533 }
15534 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
15535         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15536         JNIEnv *env;
15537         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15538         if (get_jenv_res == JNI_EDETACHED) {
15539                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15540         } else {
15541                 DO_ASSERT(get_jenv_res == JNI_OK);
15542         }
15543         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15544         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15545         LDKTxAckRbf msg_var = *msg;
15546         int64_t msg_ref = 0;
15547         msg_var = TxAckRbf_clone(&msg_var);
15548         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15549         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15550         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15551         CHECK(obj != NULL);
15552         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
15553         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15554                 (*env)->ExceptionDescribe(env);
15555                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
15556         }
15557         if (get_jenv_res == JNI_EDETACHED) {
15558                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15559         }
15560 }
15561 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
15562         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15563         JNIEnv *env;
15564         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15565         if (get_jenv_res == JNI_EDETACHED) {
15566                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15567         } else {
15568                 DO_ASSERT(get_jenv_res == JNI_OK);
15569         }
15570         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15571         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15572         LDKTxAbort msg_var = *msg;
15573         int64_t msg_ref = 0;
15574         msg_var = TxAbort_clone(&msg_var);
15575         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15576         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15577         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15578         CHECK(obj != NULL);
15579         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
15580         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15581                 (*env)->ExceptionDescribe(env);
15582                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
15583         }
15584         if (get_jenv_res == JNI_EDETACHED) {
15585                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15586         }
15587 }
15588 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
15589         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15590         JNIEnv *env;
15591         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15592         if (get_jenv_res == JNI_EDETACHED) {
15593                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15594         } else {
15595                 DO_ASSERT(get_jenv_res == JNI_OK);
15596         }
15597         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15598         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15599         LDKUpdateAddHTLC msg_var = *msg;
15600         int64_t msg_ref = 0;
15601         msg_var = UpdateAddHTLC_clone(&msg_var);
15602         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15603         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15604         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15605         CHECK(obj != NULL);
15606         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
15607         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15608                 (*env)->ExceptionDescribe(env);
15609                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
15610         }
15611         if (get_jenv_res == JNI_EDETACHED) {
15612                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15613         }
15614 }
15615 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
15616         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15617         JNIEnv *env;
15618         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15619         if (get_jenv_res == JNI_EDETACHED) {
15620                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15621         } else {
15622                 DO_ASSERT(get_jenv_res == JNI_OK);
15623         }
15624         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15625         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15626         LDKUpdateFulfillHTLC msg_var = *msg;
15627         int64_t msg_ref = 0;
15628         msg_var = UpdateFulfillHTLC_clone(&msg_var);
15629         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15630         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15631         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15632         CHECK(obj != NULL);
15633         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
15634         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15635                 (*env)->ExceptionDescribe(env);
15636                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
15637         }
15638         if (get_jenv_res == JNI_EDETACHED) {
15639                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15640         }
15641 }
15642 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
15643         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15644         JNIEnv *env;
15645         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15646         if (get_jenv_res == JNI_EDETACHED) {
15647                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15648         } else {
15649                 DO_ASSERT(get_jenv_res == JNI_OK);
15650         }
15651         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15652         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15653         LDKUpdateFailHTLC msg_var = *msg;
15654         int64_t msg_ref = 0;
15655         msg_var = UpdateFailHTLC_clone(&msg_var);
15656         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15657         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15658         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15659         CHECK(obj != NULL);
15660         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
15661         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15662                 (*env)->ExceptionDescribe(env);
15663                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
15664         }
15665         if (get_jenv_res == JNI_EDETACHED) {
15666                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15667         }
15668 }
15669 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
15670         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15671         JNIEnv *env;
15672         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15673         if (get_jenv_res == JNI_EDETACHED) {
15674                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15675         } else {
15676                 DO_ASSERT(get_jenv_res == JNI_OK);
15677         }
15678         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15679         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15680         LDKUpdateFailMalformedHTLC msg_var = *msg;
15681         int64_t msg_ref = 0;
15682         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
15683         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15684         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15685         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15686         CHECK(obj != NULL);
15687         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
15688         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15689                 (*env)->ExceptionDescribe(env);
15690                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
15691         }
15692         if (get_jenv_res == JNI_EDETACHED) {
15693                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15694         }
15695 }
15696 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
15697         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15698         JNIEnv *env;
15699         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15700         if (get_jenv_res == JNI_EDETACHED) {
15701                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15702         } else {
15703                 DO_ASSERT(get_jenv_res == JNI_OK);
15704         }
15705         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15706         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15707         LDKCommitmentSigned msg_var = *msg;
15708         int64_t msg_ref = 0;
15709         msg_var = CommitmentSigned_clone(&msg_var);
15710         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15711         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15712         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15713         CHECK(obj != NULL);
15714         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
15715         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15716                 (*env)->ExceptionDescribe(env);
15717                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
15718         }
15719         if (get_jenv_res == JNI_EDETACHED) {
15720                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15721         }
15722 }
15723 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
15724         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15725         JNIEnv *env;
15726         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15727         if (get_jenv_res == JNI_EDETACHED) {
15728                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15729         } else {
15730                 DO_ASSERT(get_jenv_res == JNI_OK);
15731         }
15732         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15733         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15734         LDKRevokeAndACK msg_var = *msg;
15735         int64_t msg_ref = 0;
15736         msg_var = RevokeAndACK_clone(&msg_var);
15737         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15738         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15739         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15740         CHECK(obj != NULL);
15741         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
15742         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15743                 (*env)->ExceptionDescribe(env);
15744                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
15745         }
15746         if (get_jenv_res == JNI_EDETACHED) {
15747                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15748         }
15749 }
15750 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
15751         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15752         JNIEnv *env;
15753         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15754         if (get_jenv_res == JNI_EDETACHED) {
15755                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15756         } else {
15757                 DO_ASSERT(get_jenv_res == JNI_OK);
15758         }
15759         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15760         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15761         LDKUpdateFee msg_var = *msg;
15762         int64_t msg_ref = 0;
15763         msg_var = UpdateFee_clone(&msg_var);
15764         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15765         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15766         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15767         CHECK(obj != NULL);
15768         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
15769         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15770                 (*env)->ExceptionDescribe(env);
15771                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
15772         }
15773         if (get_jenv_res == JNI_EDETACHED) {
15774                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15775         }
15776 }
15777 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
15778         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15779         JNIEnv *env;
15780         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15781         if (get_jenv_res == JNI_EDETACHED) {
15782                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15783         } else {
15784                 DO_ASSERT(get_jenv_res == JNI_OK);
15785         }
15786         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15787         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15788         LDKAnnouncementSignatures msg_var = *msg;
15789         int64_t msg_ref = 0;
15790         msg_var = AnnouncementSignatures_clone(&msg_var);
15791         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15792         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15793         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15794         CHECK(obj != NULL);
15795         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
15796         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15797                 (*env)->ExceptionDescribe(env);
15798                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
15799         }
15800         if (get_jenv_res == JNI_EDETACHED) {
15801                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15802         }
15803 }
15804 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15805         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15806         JNIEnv *env;
15807         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15808         if (get_jenv_res == JNI_EDETACHED) {
15809                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15810         } else {
15811                 DO_ASSERT(get_jenv_res == JNI_OK);
15812         }
15813         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15814         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15815         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15816         CHECK(obj != NULL);
15817         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
15818         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15819                 (*env)->ExceptionDescribe(env);
15820                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
15821         }
15822         if (get_jenv_res == JNI_EDETACHED) {
15823                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15824         }
15825 }
15826 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
15827         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15828         JNIEnv *env;
15829         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15830         if (get_jenv_res == JNI_EDETACHED) {
15831                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15832         } else {
15833                 DO_ASSERT(get_jenv_res == JNI_OK);
15834         }
15835         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15836         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15837         LDKInit msg_var = *msg;
15838         int64_t msg_ref = 0;
15839         msg_var = Init_clone(&msg_var);
15840         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15841         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15842         jboolean inbound_conv = inbound;
15843         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15844         CHECK(obj != NULL);
15845         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
15846         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15847                 (*env)->ExceptionDescribe(env);
15848                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
15849         }
15850         void* ret_ptr = untag_ptr(ret);
15851         CHECK_ACCESS(ret_ptr);
15852         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15853         FREE(untag_ptr(ret));
15854         if (get_jenv_res == JNI_EDETACHED) {
15855                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15856         }
15857         return ret_conv;
15858 }
15859 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
15860         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15861         JNIEnv *env;
15862         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15863         if (get_jenv_res == JNI_EDETACHED) {
15864                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15865         } else {
15866                 DO_ASSERT(get_jenv_res == JNI_OK);
15867         }
15868         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15869         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15870         LDKChannelReestablish msg_var = *msg;
15871         int64_t msg_ref = 0;
15872         msg_var = ChannelReestablish_clone(&msg_var);
15873         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15874         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15875         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15876         CHECK(obj != NULL);
15877         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
15878         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15879                 (*env)->ExceptionDescribe(env);
15880                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
15881         }
15882         if (get_jenv_res == JNI_EDETACHED) {
15883                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15884         }
15885 }
15886 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
15887         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15888         JNIEnv *env;
15889         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15890         if (get_jenv_res == JNI_EDETACHED) {
15891                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15892         } else {
15893                 DO_ASSERT(get_jenv_res == JNI_OK);
15894         }
15895         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15896         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15897         LDKChannelUpdate msg_var = *msg;
15898         int64_t msg_ref = 0;
15899         msg_var = ChannelUpdate_clone(&msg_var);
15900         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15901         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15902         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15903         CHECK(obj != NULL);
15904         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
15905         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15906                 (*env)->ExceptionDescribe(env);
15907                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
15908         }
15909         if (get_jenv_res == JNI_EDETACHED) {
15910                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15911         }
15912 }
15913 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
15914         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15915         JNIEnv *env;
15916         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15917         if (get_jenv_res == JNI_EDETACHED) {
15918                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15919         } else {
15920                 DO_ASSERT(get_jenv_res == JNI_OK);
15921         }
15922         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15923         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15924         LDKErrorMessage msg_var = *msg;
15925         int64_t msg_ref = 0;
15926         msg_var = ErrorMessage_clone(&msg_var);
15927         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15928         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15929         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15930         CHECK(obj != NULL);
15931         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
15932         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15933                 (*env)->ExceptionDescribe(env);
15934                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
15935         }
15936         if (get_jenv_res == JNI_EDETACHED) {
15937                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15938         }
15939 }
15940 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
15941         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15942         JNIEnv *env;
15943         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15944         if (get_jenv_res == JNI_EDETACHED) {
15945                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15946         } else {
15947                 DO_ASSERT(get_jenv_res == JNI_OK);
15948         }
15949         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15950         CHECK(obj != NULL);
15951         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
15952         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15953                 (*env)->ExceptionDescribe(env);
15954                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
15955         }
15956         LDKNodeFeatures ret_conv;
15957         ret_conv.inner = untag_ptr(ret);
15958         ret_conv.is_owned = ptr_is_owned(ret);
15959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15960         if (get_jenv_res == JNI_EDETACHED) {
15961                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15962         }
15963         return ret_conv;
15964 }
15965 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15966         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15967         JNIEnv *env;
15968         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15969         if (get_jenv_res == JNI_EDETACHED) {
15970                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15971         } else {
15972                 DO_ASSERT(get_jenv_res == JNI_OK);
15973         }
15974         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15975         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15976         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15977         CHECK(obj != NULL);
15978         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
15979         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15980                 (*env)->ExceptionDescribe(env);
15981                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
15982         }
15983         LDKInitFeatures ret_conv;
15984         ret_conv.inner = untag_ptr(ret);
15985         ret_conv.is_owned = ptr_is_owned(ret);
15986         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15987         if (get_jenv_res == JNI_EDETACHED) {
15988                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15989         }
15990         return ret_conv;
15991 }
15992 LDKCOption_CVec_ChainHashZZ get_genesis_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
15993         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15994         JNIEnv *env;
15995         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15996         if (get_jenv_res == JNI_EDETACHED) {
15997                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15998         } else {
15999                 DO_ASSERT(get_jenv_res == JNI_OK);
16000         }
16001         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16002         CHECK(obj != NULL);
16003         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_genesis_hashes_meth);
16004         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16005                 (*env)->ExceptionDescribe(env);
16006                 (*env)->FatalError(env, "A call to get_genesis_hashes in LDKChannelMessageHandler from rust threw an exception.");
16007         }
16008         void* ret_ptr = untag_ptr(ret);
16009         CHECK_ACCESS(ret_ptr);
16010         LDKCOption_CVec_ChainHashZZ ret_conv = *(LDKCOption_CVec_ChainHashZZ*)(ret_ptr);
16011         FREE(untag_ptr(ret));
16012         if (get_jenv_res == JNI_EDETACHED) {
16013                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16014         }
16015         return ret_conv;
16016 }
16017 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
16018         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
16019         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16020         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
16021 }
16022 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
16023         jclass c = (*env)->GetObjectClass(env, o);
16024         CHECK(c != NULL);
16025         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
16026         atomic_init(&calls->refcnt, 1);
16027         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16028         calls->o = (*env)->NewWeakGlobalRef(env, o);
16029         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
16030         CHECK(calls->handle_open_channel_meth != NULL);
16031         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
16032         CHECK(calls->handle_open_channel_v2_meth != NULL);
16033         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
16034         CHECK(calls->handle_accept_channel_meth != NULL);
16035         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
16036         CHECK(calls->handle_accept_channel_v2_meth != NULL);
16037         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
16038         CHECK(calls->handle_funding_created_meth != NULL);
16039         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
16040         CHECK(calls->handle_funding_signed_meth != NULL);
16041         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
16042         CHECK(calls->handle_channel_ready_meth != NULL);
16043         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
16044         CHECK(calls->handle_shutdown_meth != NULL);
16045         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
16046         CHECK(calls->handle_closing_signed_meth != NULL);
16047         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
16048         CHECK(calls->handle_tx_add_input_meth != NULL);
16049         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
16050         CHECK(calls->handle_tx_add_output_meth != NULL);
16051         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
16052         CHECK(calls->handle_tx_remove_input_meth != NULL);
16053         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
16054         CHECK(calls->handle_tx_remove_output_meth != NULL);
16055         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
16056         CHECK(calls->handle_tx_complete_meth != NULL);
16057         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
16058         CHECK(calls->handle_tx_signatures_meth != NULL);
16059         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
16060         CHECK(calls->handle_tx_init_rbf_meth != NULL);
16061         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
16062         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
16063         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
16064         CHECK(calls->handle_tx_abort_meth != NULL);
16065         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
16066         CHECK(calls->handle_update_add_htlc_meth != NULL);
16067         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
16068         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
16069         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
16070         CHECK(calls->handle_update_fail_htlc_meth != NULL);
16071         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
16072         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
16073         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
16074         CHECK(calls->handle_commitment_signed_meth != NULL);
16075         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
16076         CHECK(calls->handle_revoke_and_ack_meth != NULL);
16077         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
16078         CHECK(calls->handle_update_fee_meth != NULL);
16079         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
16080         CHECK(calls->handle_announcement_signatures_meth != NULL);
16081         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
16082         CHECK(calls->peer_disconnected_meth != NULL);
16083         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
16084         CHECK(calls->peer_connected_meth != NULL);
16085         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
16086         CHECK(calls->handle_channel_reestablish_meth != NULL);
16087         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
16088         CHECK(calls->handle_channel_update_meth != NULL);
16089         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
16090         CHECK(calls->handle_error_meth != NULL);
16091         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
16092         CHECK(calls->provided_node_features_meth != NULL);
16093         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
16094         CHECK(calls->provided_init_features_meth != NULL);
16095         calls->get_genesis_hashes_meth = (*env)->GetMethodID(env, c, "get_genesis_hashes", "()J");
16096         CHECK(calls->get_genesis_hashes_meth != NULL);
16097
16098         LDKChannelMessageHandler ret = {
16099                 .this_arg = (void*) calls,
16100                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
16101                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
16102                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
16103                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
16104                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
16105                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
16106                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
16107                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
16108                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
16109                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
16110                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
16111                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
16112                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
16113                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
16114                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
16115                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
16116                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
16117                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
16118                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
16119                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
16120                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
16121                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
16122                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
16123                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
16124                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
16125                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
16126                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
16127                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
16128                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
16129                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
16130                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
16131                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
16132                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
16133                 .get_genesis_hashes = get_genesis_hashes_LDKChannelMessageHandler_jcall,
16134                 .free = LDKChannelMessageHandler_JCalls_free,
16135                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
16136         };
16137         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
16138         return ret;
16139 }
16140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
16141         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16142         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
16143         return tag_ptr(res_ptr, true);
16144 }
16145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
16146         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
16147         return tag_ptr(&inp->MessageSendEventsProvider, false);
16148 }
16149 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 msg) {
16150         void* this_arg_ptr = untag_ptr(this_arg);
16151         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16152         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16153         LDKPublicKey their_node_id_ref;
16154         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16155         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16156         LDKOpenChannel msg_conv;
16157         msg_conv.inner = untag_ptr(msg);
16158         msg_conv.is_owned = ptr_is_owned(msg);
16159         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16160         msg_conv.is_owned = false;
16161         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16162 }
16163
16164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel_1v2(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16165         void* this_arg_ptr = untag_ptr(this_arg);
16166         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16167         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16168         LDKPublicKey their_node_id_ref;
16169         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16170         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16171         LDKOpenChannelV2 msg_conv;
16172         msg_conv.inner = untag_ptr(msg);
16173         msg_conv.is_owned = ptr_is_owned(msg);
16174         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16175         msg_conv.is_owned = false;
16176         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16177 }
16178
16179 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 msg) {
16180         void* this_arg_ptr = untag_ptr(this_arg);
16181         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16182         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16183         LDKPublicKey their_node_id_ref;
16184         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16185         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16186         LDKAcceptChannel msg_conv;
16187         msg_conv.inner = untag_ptr(msg);
16188         msg_conv.is_owned = ptr_is_owned(msg);
16189         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16190         msg_conv.is_owned = false;
16191         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16192 }
16193
16194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel_1v2(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16195         void* this_arg_ptr = untag_ptr(this_arg);
16196         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16197         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16198         LDKPublicKey their_node_id_ref;
16199         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16200         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16201         LDKAcceptChannelV2 msg_conv;
16202         msg_conv.inner = untag_ptr(msg);
16203         msg_conv.is_owned = ptr_is_owned(msg);
16204         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16205         msg_conv.is_owned = false;
16206         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16207 }
16208
16209 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) {
16210         void* this_arg_ptr = untag_ptr(this_arg);
16211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16212         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16213         LDKPublicKey their_node_id_ref;
16214         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16215         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16216         LDKFundingCreated msg_conv;
16217         msg_conv.inner = untag_ptr(msg);
16218         msg_conv.is_owned = ptr_is_owned(msg);
16219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16220         msg_conv.is_owned = false;
16221         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16222 }
16223
16224 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) {
16225         void* this_arg_ptr = untag_ptr(this_arg);
16226         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16227         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16228         LDKPublicKey their_node_id_ref;
16229         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16230         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16231         LDKFundingSigned msg_conv;
16232         msg_conv.inner = untag_ptr(msg);
16233         msg_conv.is_owned = ptr_is_owned(msg);
16234         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16235         msg_conv.is_owned = false;
16236         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16237 }
16238
16239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16240         void* this_arg_ptr = untag_ptr(this_arg);
16241         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16242         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16243         LDKPublicKey their_node_id_ref;
16244         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16245         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16246         LDKChannelReady msg_conv;
16247         msg_conv.inner = untag_ptr(msg);
16248         msg_conv.is_owned = ptr_is_owned(msg);
16249         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16250         msg_conv.is_owned = false;
16251         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16252 }
16253
16254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16255         void* this_arg_ptr = untag_ptr(this_arg);
16256         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16257         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16258         LDKPublicKey their_node_id_ref;
16259         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16260         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16261         LDKShutdown msg_conv;
16262         msg_conv.inner = untag_ptr(msg);
16263         msg_conv.is_owned = ptr_is_owned(msg);
16264         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16265         msg_conv.is_owned = false;
16266         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16267 }
16268
16269 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) {
16270         void* this_arg_ptr = untag_ptr(this_arg);
16271         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16272         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16273         LDKPublicKey their_node_id_ref;
16274         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16275         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16276         LDKClosingSigned msg_conv;
16277         msg_conv.inner = untag_ptr(msg);
16278         msg_conv.is_owned = ptr_is_owned(msg);
16279         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16280         msg_conv.is_owned = false;
16281         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16282 }
16283
16284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1add_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16285         void* this_arg_ptr = untag_ptr(this_arg);
16286         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16287         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16288         LDKPublicKey their_node_id_ref;
16289         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16290         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16291         LDKTxAddInput msg_conv;
16292         msg_conv.inner = untag_ptr(msg);
16293         msg_conv.is_owned = ptr_is_owned(msg);
16294         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16295         msg_conv.is_owned = false;
16296         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16297 }
16298
16299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1add_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16300         void* this_arg_ptr = untag_ptr(this_arg);
16301         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16302         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16303         LDKPublicKey their_node_id_ref;
16304         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16305         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16306         LDKTxAddOutput msg_conv;
16307         msg_conv.inner = untag_ptr(msg);
16308         msg_conv.is_owned = ptr_is_owned(msg);
16309         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16310         msg_conv.is_owned = false;
16311         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16312 }
16313
16314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1remove_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16315         void* this_arg_ptr = untag_ptr(this_arg);
16316         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16317         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16318         LDKPublicKey their_node_id_ref;
16319         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16320         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16321         LDKTxRemoveInput msg_conv;
16322         msg_conv.inner = untag_ptr(msg);
16323         msg_conv.is_owned = ptr_is_owned(msg);
16324         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16325         msg_conv.is_owned = false;
16326         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16327 }
16328
16329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1remove_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16330         void* this_arg_ptr = untag_ptr(this_arg);
16331         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16332         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16333         LDKPublicKey their_node_id_ref;
16334         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16335         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16336         LDKTxRemoveOutput msg_conv;
16337         msg_conv.inner = untag_ptr(msg);
16338         msg_conv.is_owned = ptr_is_owned(msg);
16339         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16340         msg_conv.is_owned = false;
16341         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16342 }
16343
16344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1complete(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16345         void* this_arg_ptr = untag_ptr(this_arg);
16346         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16347         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16348         LDKPublicKey their_node_id_ref;
16349         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16350         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16351         LDKTxComplete msg_conv;
16352         msg_conv.inner = untag_ptr(msg);
16353         msg_conv.is_owned = ptr_is_owned(msg);
16354         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16355         msg_conv.is_owned = false;
16356         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16357 }
16358
16359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1signatures(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16360         void* this_arg_ptr = untag_ptr(this_arg);
16361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16362         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16363         LDKPublicKey their_node_id_ref;
16364         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16365         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16366         LDKTxSignatures msg_conv;
16367         msg_conv.inner = untag_ptr(msg);
16368         msg_conv.is_owned = ptr_is_owned(msg);
16369         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16370         msg_conv.is_owned = false;
16371         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16372 }
16373
16374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1init_1rbf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16375         void* this_arg_ptr = untag_ptr(this_arg);
16376         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16377         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16378         LDKPublicKey their_node_id_ref;
16379         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16380         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16381         LDKTxInitRbf msg_conv;
16382         msg_conv.inner = untag_ptr(msg);
16383         msg_conv.is_owned = ptr_is_owned(msg);
16384         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16385         msg_conv.is_owned = false;
16386         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16387 }
16388
16389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1ack_1rbf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16390         void* this_arg_ptr = untag_ptr(this_arg);
16391         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16392         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16393         LDKPublicKey their_node_id_ref;
16394         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16395         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16396         LDKTxAckRbf msg_conv;
16397         msg_conv.inner = untag_ptr(msg);
16398         msg_conv.is_owned = ptr_is_owned(msg);
16399         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16400         msg_conv.is_owned = false;
16401         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16402 }
16403
16404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1tx_1abort(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16405         void* this_arg_ptr = untag_ptr(this_arg);
16406         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16407         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16408         LDKPublicKey their_node_id_ref;
16409         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16410         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16411         LDKTxAbort msg_conv;
16412         msg_conv.inner = untag_ptr(msg);
16413         msg_conv.is_owned = ptr_is_owned(msg);
16414         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16415         msg_conv.is_owned = false;
16416         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16417 }
16418
16419 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) {
16420         void* this_arg_ptr = untag_ptr(this_arg);
16421         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16422         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16423         LDKPublicKey their_node_id_ref;
16424         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16425         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16426         LDKUpdateAddHTLC msg_conv;
16427         msg_conv.inner = untag_ptr(msg);
16428         msg_conv.is_owned = ptr_is_owned(msg);
16429         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16430         msg_conv.is_owned = false;
16431         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16432 }
16433
16434 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) {
16435         void* this_arg_ptr = untag_ptr(this_arg);
16436         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16437         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16438         LDKPublicKey their_node_id_ref;
16439         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16440         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16441         LDKUpdateFulfillHTLC msg_conv;
16442         msg_conv.inner = untag_ptr(msg);
16443         msg_conv.is_owned = ptr_is_owned(msg);
16444         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16445         msg_conv.is_owned = false;
16446         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16447 }
16448
16449 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) {
16450         void* this_arg_ptr = untag_ptr(this_arg);
16451         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16452         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16453         LDKPublicKey their_node_id_ref;
16454         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16455         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16456         LDKUpdateFailHTLC msg_conv;
16457         msg_conv.inner = untag_ptr(msg);
16458         msg_conv.is_owned = ptr_is_owned(msg);
16459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16460         msg_conv.is_owned = false;
16461         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16462 }
16463
16464 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) {
16465         void* this_arg_ptr = untag_ptr(this_arg);
16466         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16467         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16468         LDKPublicKey their_node_id_ref;
16469         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16470         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16471         LDKUpdateFailMalformedHTLC msg_conv;
16472         msg_conv.inner = untag_ptr(msg);
16473         msg_conv.is_owned = ptr_is_owned(msg);
16474         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16475         msg_conv.is_owned = false;
16476         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16477 }
16478
16479 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) {
16480         void* this_arg_ptr = untag_ptr(this_arg);
16481         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16482         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16483         LDKPublicKey their_node_id_ref;
16484         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16485         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16486         LDKCommitmentSigned msg_conv;
16487         msg_conv.inner = untag_ptr(msg);
16488         msg_conv.is_owned = ptr_is_owned(msg);
16489         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16490         msg_conv.is_owned = false;
16491         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16492 }
16493
16494 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) {
16495         void* this_arg_ptr = untag_ptr(this_arg);
16496         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16497         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16498         LDKPublicKey their_node_id_ref;
16499         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16500         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16501         LDKRevokeAndACK msg_conv;
16502         msg_conv.inner = untag_ptr(msg);
16503         msg_conv.is_owned = ptr_is_owned(msg);
16504         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16505         msg_conv.is_owned = false;
16506         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16507 }
16508
16509 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) {
16510         void* this_arg_ptr = untag_ptr(this_arg);
16511         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16512         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16513         LDKPublicKey their_node_id_ref;
16514         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16515         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16516         LDKUpdateFee msg_conv;
16517         msg_conv.inner = untag_ptr(msg);
16518         msg_conv.is_owned = ptr_is_owned(msg);
16519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16520         msg_conv.is_owned = false;
16521         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16522 }
16523
16524 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) {
16525         void* this_arg_ptr = untag_ptr(this_arg);
16526         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16527         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16528         LDKPublicKey their_node_id_ref;
16529         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16530         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16531         LDKAnnouncementSignatures msg_conv;
16532         msg_conv.inner = untag_ptr(msg);
16533         msg_conv.is_owned = ptr_is_owned(msg);
16534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16535         msg_conv.is_owned = false;
16536         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16537 }
16538
16539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
16540         void* this_arg_ptr = untag_ptr(this_arg);
16541         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16542         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16543         LDKPublicKey their_node_id_ref;
16544         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16545         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16546         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
16547 }
16548
16549 JNIEXPORT int64_t 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, jboolean inbound) {
16550         void* this_arg_ptr = untag_ptr(this_arg);
16551         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16552         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16553         LDKPublicKey their_node_id_ref;
16554         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16555         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16556         LDKInit msg_conv;
16557         msg_conv.inner = untag_ptr(msg);
16558         msg_conv.is_owned = ptr_is_owned(msg);
16559         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16560         msg_conv.is_owned = false;
16561         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16562         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
16563         return tag_ptr(ret_conv, true);
16564 }
16565
16566 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) {
16567         void* this_arg_ptr = untag_ptr(this_arg);
16568         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16569         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16570         LDKPublicKey their_node_id_ref;
16571         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16572         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16573         LDKChannelReestablish msg_conv;
16574         msg_conv.inner = untag_ptr(msg);
16575         msg_conv.is_owned = ptr_is_owned(msg);
16576         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16577         msg_conv.is_owned = false;
16578         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16579 }
16580
16581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
16582         void* this_arg_ptr = untag_ptr(this_arg);
16583         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16584         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16585         LDKPublicKey their_node_id_ref;
16586         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16587         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16588         LDKChannelUpdate msg_conv;
16589         msg_conv.inner = untag_ptr(msg);
16590         msg_conv.is_owned = ptr_is_owned(msg);
16591         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16592         msg_conv.is_owned = false;
16593         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16594 }
16595
16596 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) {
16597         void* this_arg_ptr = untag_ptr(this_arg);
16598         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16599         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16600         LDKPublicKey their_node_id_ref;
16601         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16602         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16603         LDKErrorMessage msg_conv;
16604         msg_conv.inner = untag_ptr(msg);
16605         msg_conv.is_owned = ptr_is_owned(msg);
16606         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16607         msg_conv.is_owned = false;
16608         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16609 }
16610
16611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
16612         void* this_arg_ptr = untag_ptr(this_arg);
16613         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16614         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16615         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16616         int64_t ret_ref = 0;
16617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16619         return ret_ref;
16620 }
16621
16622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
16623         void* this_arg_ptr = untag_ptr(this_arg);
16624         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16625         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16626         LDKPublicKey their_node_id_ref;
16627         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16628         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16629         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16630         int64_t ret_ref = 0;
16631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16633         return ret_ref;
16634 }
16635
16636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1genesis_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
16637         void* this_arg_ptr = untag_ptr(this_arg);
16638         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16639         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16640         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
16641         *ret_copy = (this_arg_conv->get_genesis_hashes)(this_arg_conv->this_arg);
16642         int64_t ret_ref = tag_ptr(ret_copy, true);
16643         return ret_ref;
16644 }
16645
16646 typedef struct LDKRoutingMessageHandler_JCalls {
16647         atomic_size_t refcnt;
16648         JavaVM *vm;
16649         jweak o;
16650         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16651         jmethodID handle_node_announcement_meth;
16652         jmethodID handle_channel_announcement_meth;
16653         jmethodID handle_channel_update_meth;
16654         jmethodID get_next_channel_announcement_meth;
16655         jmethodID get_next_node_announcement_meth;
16656         jmethodID peer_connected_meth;
16657         jmethodID handle_reply_channel_range_meth;
16658         jmethodID handle_reply_short_channel_ids_end_meth;
16659         jmethodID handle_query_channel_range_meth;
16660         jmethodID handle_query_short_channel_ids_meth;
16661         jmethodID processing_queue_high_meth;
16662         jmethodID provided_node_features_meth;
16663         jmethodID provided_init_features_meth;
16664 } LDKRoutingMessageHandler_JCalls;
16665 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
16666         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16667         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16668                 JNIEnv *env;
16669                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16670                 if (get_jenv_res == JNI_EDETACHED) {
16671                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16672                 } else {
16673                         DO_ASSERT(get_jenv_res == JNI_OK);
16674                 }
16675                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16676                 if (get_jenv_res == JNI_EDETACHED) {
16677                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16678                 }
16679                 FREE(j_calls);
16680         }
16681 }
16682 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
16683         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16684         JNIEnv *env;
16685         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16686         if (get_jenv_res == JNI_EDETACHED) {
16687                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16688         } else {
16689                 DO_ASSERT(get_jenv_res == JNI_OK);
16690         }
16691         LDKNodeAnnouncement msg_var = *msg;
16692         int64_t msg_ref = 0;
16693         msg_var = NodeAnnouncement_clone(&msg_var);
16694         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16695         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16696         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16697         CHECK(obj != NULL);
16698         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
16699         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16700                 (*env)->ExceptionDescribe(env);
16701                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
16702         }
16703         void* ret_ptr = untag_ptr(ret);
16704         CHECK_ACCESS(ret_ptr);
16705         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16706         FREE(untag_ptr(ret));
16707         if (get_jenv_res == JNI_EDETACHED) {
16708                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16709         }
16710         return ret_conv;
16711 }
16712 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
16713         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16714         JNIEnv *env;
16715         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16716         if (get_jenv_res == JNI_EDETACHED) {
16717                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16718         } else {
16719                 DO_ASSERT(get_jenv_res == JNI_OK);
16720         }
16721         LDKChannelAnnouncement msg_var = *msg;
16722         int64_t msg_ref = 0;
16723         msg_var = ChannelAnnouncement_clone(&msg_var);
16724         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16725         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16726         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16727         CHECK(obj != NULL);
16728         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
16729         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16730                 (*env)->ExceptionDescribe(env);
16731                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
16732         }
16733         void* ret_ptr = untag_ptr(ret);
16734         CHECK_ACCESS(ret_ptr);
16735         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16736         FREE(untag_ptr(ret));
16737         if (get_jenv_res == JNI_EDETACHED) {
16738                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16739         }
16740         return ret_conv;
16741 }
16742 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
16743         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16744         JNIEnv *env;
16745         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16746         if (get_jenv_res == JNI_EDETACHED) {
16747                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16748         } else {
16749                 DO_ASSERT(get_jenv_res == JNI_OK);
16750         }
16751         LDKChannelUpdate msg_var = *msg;
16752         int64_t msg_ref = 0;
16753         msg_var = ChannelUpdate_clone(&msg_var);
16754         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16755         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16756         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16757         CHECK(obj != NULL);
16758         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
16759         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16760                 (*env)->ExceptionDescribe(env);
16761                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
16762         }
16763         void* ret_ptr = untag_ptr(ret);
16764         CHECK_ACCESS(ret_ptr);
16765         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16766         FREE(untag_ptr(ret));
16767         if (get_jenv_res == JNI_EDETACHED) {
16768                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16769         }
16770         return ret_conv;
16771 }
16772 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
16773         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16774         JNIEnv *env;
16775         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16776         if (get_jenv_res == JNI_EDETACHED) {
16777                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16778         } else {
16779                 DO_ASSERT(get_jenv_res == JNI_OK);
16780         }
16781         int64_t starting_point_conv = starting_point;
16782         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16783         CHECK(obj != NULL);
16784         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
16785         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16786                 (*env)->ExceptionDescribe(env);
16787                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
16788         }
16789         void* ret_ptr = untag_ptr(ret);
16790         CHECK_ACCESS(ret_ptr);
16791         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
16792         FREE(untag_ptr(ret));
16793         if (get_jenv_res == JNI_EDETACHED) {
16794                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16795         }
16796         return ret_conv;
16797 }
16798 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
16799         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16800         JNIEnv *env;
16801         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16802         if (get_jenv_res == JNI_EDETACHED) {
16803                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16804         } else {
16805                 DO_ASSERT(get_jenv_res == JNI_OK);
16806         }
16807         LDKNodeId starting_point_var = starting_point;
16808         int64_t starting_point_ref = 0;
16809         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
16810         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
16811         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16812         CHECK(obj != NULL);
16813         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
16814         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16815                 (*env)->ExceptionDescribe(env);
16816                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
16817         }
16818         LDKNodeAnnouncement ret_conv;
16819         ret_conv.inner = untag_ptr(ret);
16820         ret_conv.is_owned = ptr_is_owned(ret);
16821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16822         if (get_jenv_res == JNI_EDETACHED) {
16823                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16824         }
16825         return ret_conv;
16826 }
16827 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16828         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16829         JNIEnv *env;
16830         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16831         if (get_jenv_res == JNI_EDETACHED) {
16832                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16833         } else {
16834                 DO_ASSERT(get_jenv_res == JNI_OK);
16835         }
16836         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16837         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16838         LDKInit init_var = *init;
16839         int64_t init_ref = 0;
16840         init_var = Init_clone(&init_var);
16841         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16842         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16843         jboolean inbound_conv = inbound;
16844         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16845         CHECK(obj != NULL);
16846         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
16847         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16848                 (*env)->ExceptionDescribe(env);
16849                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
16850         }
16851         void* ret_ptr = untag_ptr(ret);
16852         CHECK_ACCESS(ret_ptr);
16853         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16854         FREE(untag_ptr(ret));
16855         if (get_jenv_res == JNI_EDETACHED) {
16856                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16857         }
16858         return ret_conv;
16859 }
16860 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
16861         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16862         JNIEnv *env;
16863         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16864         if (get_jenv_res == JNI_EDETACHED) {
16865                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16866         } else {
16867                 DO_ASSERT(get_jenv_res == JNI_OK);
16868         }
16869         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16870         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16871         LDKReplyChannelRange msg_var = msg;
16872         int64_t msg_ref = 0;
16873         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16874         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16875         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16876         CHECK(obj != NULL);
16877         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
16878         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16879                 (*env)->ExceptionDescribe(env);
16880                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
16881         }
16882         void* ret_ptr = untag_ptr(ret);
16883         CHECK_ACCESS(ret_ptr);
16884         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16885         FREE(untag_ptr(ret));
16886         if (get_jenv_res == JNI_EDETACHED) {
16887                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16888         }
16889         return ret_conv;
16890 }
16891 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
16892         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16893         JNIEnv *env;
16894         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16895         if (get_jenv_res == JNI_EDETACHED) {
16896                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16897         } else {
16898                 DO_ASSERT(get_jenv_res == JNI_OK);
16899         }
16900         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16901         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16902         LDKReplyShortChannelIdsEnd msg_var = msg;
16903         int64_t msg_ref = 0;
16904         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16905         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16906         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16907         CHECK(obj != NULL);
16908         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
16909         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16910                 (*env)->ExceptionDescribe(env);
16911                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
16912         }
16913         void* ret_ptr = untag_ptr(ret);
16914         CHECK_ACCESS(ret_ptr);
16915         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16916         FREE(untag_ptr(ret));
16917         if (get_jenv_res == JNI_EDETACHED) {
16918                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16919         }
16920         return ret_conv;
16921 }
16922 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
16923         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16924         JNIEnv *env;
16925         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16926         if (get_jenv_res == JNI_EDETACHED) {
16927                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16928         } else {
16929                 DO_ASSERT(get_jenv_res == JNI_OK);
16930         }
16931         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16932         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16933         LDKQueryChannelRange msg_var = msg;
16934         int64_t msg_ref = 0;
16935         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16936         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16937         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16938         CHECK(obj != NULL);
16939         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
16940         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16941                 (*env)->ExceptionDescribe(env);
16942                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
16943         }
16944         void* ret_ptr = untag_ptr(ret);
16945         CHECK_ACCESS(ret_ptr);
16946         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16947         FREE(untag_ptr(ret));
16948         if (get_jenv_res == JNI_EDETACHED) {
16949                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16950         }
16951         return ret_conv;
16952 }
16953 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
16954         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16955         JNIEnv *env;
16956         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16957         if (get_jenv_res == JNI_EDETACHED) {
16958                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16959         } else {
16960                 DO_ASSERT(get_jenv_res == JNI_OK);
16961         }
16962         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16963         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16964         LDKQueryShortChannelIds msg_var = msg;
16965         int64_t msg_ref = 0;
16966         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16967         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16968         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16969         CHECK(obj != NULL);
16970         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
16971         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16972                 (*env)->ExceptionDescribe(env);
16973                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
16974         }
16975         void* ret_ptr = untag_ptr(ret);
16976         CHECK_ACCESS(ret_ptr);
16977         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16978         FREE(untag_ptr(ret));
16979         if (get_jenv_res == JNI_EDETACHED) {
16980                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16981         }
16982         return ret_conv;
16983 }
16984 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16985         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16986         JNIEnv *env;
16987         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16988         if (get_jenv_res == JNI_EDETACHED) {
16989                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16990         } else {
16991                 DO_ASSERT(get_jenv_res == JNI_OK);
16992         }
16993         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16994         CHECK(obj != NULL);
16995         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
16996         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16997                 (*env)->ExceptionDescribe(env);
16998                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
16999         }
17000         if (get_jenv_res == JNI_EDETACHED) {
17001                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17002         }
17003         return ret;
17004 }
17005 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
17006         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17007         JNIEnv *env;
17008         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17009         if (get_jenv_res == JNI_EDETACHED) {
17010                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17011         } else {
17012                 DO_ASSERT(get_jenv_res == JNI_OK);
17013         }
17014         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17015         CHECK(obj != NULL);
17016         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
17017         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17018                 (*env)->ExceptionDescribe(env);
17019                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
17020         }
17021         LDKNodeFeatures ret_conv;
17022         ret_conv.inner = untag_ptr(ret);
17023         ret_conv.is_owned = ptr_is_owned(ret);
17024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17025         if (get_jenv_res == JNI_EDETACHED) {
17026                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17027         }
17028         return ret_conv;
17029 }
17030 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17031         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17032         JNIEnv *env;
17033         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17034         if (get_jenv_res == JNI_EDETACHED) {
17035                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17036         } else {
17037                 DO_ASSERT(get_jenv_res == JNI_OK);
17038         }
17039         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17040         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17041         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17042         CHECK(obj != NULL);
17043         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
17044         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17045                 (*env)->ExceptionDescribe(env);
17046                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
17047         }
17048         LDKInitFeatures ret_conv;
17049         ret_conv.inner = untag_ptr(ret);
17050         ret_conv.is_owned = ptr_is_owned(ret);
17051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17052         if (get_jenv_res == JNI_EDETACHED) {
17053                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17054         }
17055         return ret_conv;
17056 }
17057 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
17058         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
17059         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17060         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
17061 }
17062 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17063         jclass c = (*env)->GetObjectClass(env, o);
17064         CHECK(c != NULL);
17065         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
17066         atomic_init(&calls->refcnt, 1);
17067         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17068         calls->o = (*env)->NewWeakGlobalRef(env, o);
17069         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
17070         CHECK(calls->handle_node_announcement_meth != NULL);
17071         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
17072         CHECK(calls->handle_channel_announcement_meth != NULL);
17073         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
17074         CHECK(calls->handle_channel_update_meth != NULL);
17075         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
17076         CHECK(calls->get_next_channel_announcement_meth != NULL);
17077         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
17078         CHECK(calls->get_next_node_announcement_meth != NULL);
17079         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
17080         CHECK(calls->peer_connected_meth != NULL);
17081         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
17082         CHECK(calls->handle_reply_channel_range_meth != NULL);
17083         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
17084         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
17085         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
17086         CHECK(calls->handle_query_channel_range_meth != NULL);
17087         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
17088         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
17089         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
17090         CHECK(calls->processing_queue_high_meth != NULL);
17091         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17092         CHECK(calls->provided_node_features_meth != NULL);
17093         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17094         CHECK(calls->provided_init_features_meth != NULL);
17095
17096         LDKRoutingMessageHandler ret = {
17097                 .this_arg = (void*) calls,
17098                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
17099                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
17100                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
17101                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
17102                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
17103                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
17104                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
17105                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
17106                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
17107                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
17108                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
17109                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
17110                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
17111                 .free = LDKRoutingMessageHandler_JCalls_free,
17112                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
17113         };
17114         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
17115         return ret;
17116 }
17117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17118         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
17119         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
17120         return tag_ptr(res_ptr, true);
17121 }
17122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
17123         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
17124         return tag_ptr(&inp->MessageSendEventsProvider, false);
17125 }
17126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17127         void* this_arg_ptr = untag_ptr(this_arg);
17128         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17129         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17130         LDKNodeAnnouncement msg_conv;
17131         msg_conv.inner = untag_ptr(msg);
17132         msg_conv.is_owned = ptr_is_owned(msg);
17133         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17134         msg_conv.is_owned = false;
17135         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17136         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
17137         return tag_ptr(ret_conv, true);
17138 }
17139
17140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17141         void* this_arg_ptr = untag_ptr(this_arg);
17142         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17143         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17144         LDKChannelAnnouncement msg_conv;
17145         msg_conv.inner = untag_ptr(msg);
17146         msg_conv.is_owned = ptr_is_owned(msg);
17147         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17148         msg_conv.is_owned = false;
17149         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17150         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
17151         return tag_ptr(ret_conv, true);
17152 }
17153
17154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17155         void* this_arg_ptr = untag_ptr(this_arg);
17156         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17157         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17158         LDKChannelUpdate msg_conv;
17159         msg_conv.inner = untag_ptr(msg);
17160         msg_conv.is_owned = ptr_is_owned(msg);
17161         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17162         msg_conv.is_owned = false;
17163         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17164         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
17165         return tag_ptr(ret_conv, true);
17166 }
17167
17168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point) {
17169         void* this_arg_ptr = untag_ptr(this_arg);
17170         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17171         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17172         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
17173         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
17174         int64_t ret_ref = tag_ptr(ret_copy, true);
17175         return ret_ref;
17176 }
17177
17178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point) {
17179         void* this_arg_ptr = untag_ptr(this_arg);
17180         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17181         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17182         LDKNodeId starting_point_conv;
17183         starting_point_conv.inner = untag_ptr(starting_point);
17184         starting_point_conv.is_owned = ptr_is_owned(starting_point);
17185         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
17186         starting_point_conv = NodeId_clone(&starting_point_conv);
17187         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
17188         int64_t ret_ref = 0;
17189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17191         return ret_ref;
17192 }
17193
17194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
17195         void* this_arg_ptr = untag_ptr(this_arg);
17196         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17197         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17198         LDKPublicKey their_node_id_ref;
17199         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17200         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17201         LDKInit init_conv;
17202         init_conv.inner = untag_ptr(init);
17203         init_conv.is_owned = ptr_is_owned(init);
17204         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
17205         init_conv.is_owned = false;
17206         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17207         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
17208         return tag_ptr(ret_conv, true);
17209 }
17210
17211 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) {
17212         void* this_arg_ptr = untag_ptr(this_arg);
17213         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17214         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17215         LDKPublicKey their_node_id_ref;
17216         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17217         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17218         LDKReplyChannelRange msg_conv;
17219         msg_conv.inner = untag_ptr(msg);
17220         msg_conv.is_owned = ptr_is_owned(msg);
17221         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17222         msg_conv = ReplyChannelRange_clone(&msg_conv);
17223         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17224         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
17225         return tag_ptr(ret_conv, true);
17226 }
17227
17228 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) {
17229         void* this_arg_ptr = untag_ptr(this_arg);
17230         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17231         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17232         LDKPublicKey their_node_id_ref;
17233         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17234         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17235         LDKReplyShortChannelIdsEnd msg_conv;
17236         msg_conv.inner = untag_ptr(msg);
17237         msg_conv.is_owned = ptr_is_owned(msg);
17238         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17239         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
17240         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17241         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
17242         return tag_ptr(ret_conv, true);
17243 }
17244
17245 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) {
17246         void* this_arg_ptr = untag_ptr(this_arg);
17247         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17248         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17249         LDKPublicKey their_node_id_ref;
17250         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17251         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17252         LDKQueryChannelRange msg_conv;
17253         msg_conv.inner = untag_ptr(msg);
17254         msg_conv.is_owned = ptr_is_owned(msg);
17255         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17256         msg_conv = QueryChannelRange_clone(&msg_conv);
17257         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17258         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
17259         return tag_ptr(ret_conv, true);
17260 }
17261
17262 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) {
17263         void* this_arg_ptr = untag_ptr(this_arg);
17264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17265         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17266         LDKPublicKey their_node_id_ref;
17267         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17268         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17269         LDKQueryShortChannelIds msg_conv;
17270         msg_conv.inner = untag_ptr(msg);
17271         msg_conv.is_owned = ptr_is_owned(msg);
17272         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17273         msg_conv = QueryShortChannelIds_clone(&msg_conv);
17274         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17275         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
17276         return tag_ptr(ret_conv, true);
17277 }
17278
17279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
17280         void* this_arg_ptr = untag_ptr(this_arg);
17281         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17282         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17283         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
17284         return ret_conv;
17285 }
17286
17287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17288         void* this_arg_ptr = untag_ptr(this_arg);
17289         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17290         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17291         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17292         int64_t ret_ref = 0;
17293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17295         return ret_ref;
17296 }
17297
17298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
17299         void* this_arg_ptr = untag_ptr(this_arg);
17300         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17301         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17302         LDKPublicKey their_node_id_ref;
17303         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17304         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17305         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17306         int64_t ret_ref = 0;
17307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17309         return ret_ref;
17310 }
17311
17312 typedef struct LDKOnionMessageProvider_JCalls {
17313         atomic_size_t refcnt;
17314         JavaVM *vm;
17315         jweak o;
17316         jmethodID next_onion_message_for_peer_meth;
17317 } LDKOnionMessageProvider_JCalls;
17318 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
17319         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
17320         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17321                 JNIEnv *env;
17322                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17323                 if (get_jenv_res == JNI_EDETACHED) {
17324                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17325                 } else {
17326                         DO_ASSERT(get_jenv_res == JNI_OK);
17327                 }
17328                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17329                 if (get_jenv_res == JNI_EDETACHED) {
17330                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17331                 }
17332                 FREE(j_calls);
17333         }
17334 }
17335 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
17336         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
17337         JNIEnv *env;
17338         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17339         if (get_jenv_res == JNI_EDETACHED) {
17340                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17341         } else {
17342                 DO_ASSERT(get_jenv_res == JNI_OK);
17343         }
17344         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
17345         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
17346         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17347         CHECK(obj != NULL);
17348         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
17349         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17350                 (*env)->ExceptionDescribe(env);
17351                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageProvider from rust threw an exception.");
17352         }
17353         LDKOnionMessage ret_conv;
17354         ret_conv.inner = untag_ptr(ret);
17355         ret_conv.is_owned = ptr_is_owned(ret);
17356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17357         if (get_jenv_res == JNI_EDETACHED) {
17358                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17359         }
17360         return ret_conv;
17361 }
17362 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
17363         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
17364         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17365 }
17366 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JNIEnv *env, jclass clz, jobject o) {
17367         jclass c = (*env)->GetObjectClass(env, o);
17368         CHECK(c != NULL);
17369         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
17370         atomic_init(&calls->refcnt, 1);
17371         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17372         calls->o = (*env)->NewWeakGlobalRef(env, o);
17373         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
17374         CHECK(calls->next_onion_message_for_peer_meth != NULL);
17375
17376         LDKOnionMessageProvider ret = {
17377                 .this_arg = (void*) calls,
17378                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
17379                 .free = LDKOnionMessageProvider_JCalls_free,
17380         };
17381         return ret;
17382 }
17383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageProvider_1new(JNIEnv *env, jclass clz, jobject o) {
17384         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
17385         *res_ptr = LDKOnionMessageProvider_init(env, clz, o);
17386         return tag_ptr(res_ptr, true);
17387 }
17388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1next_1onion_1message_1for_1peer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id) {
17389         void* this_arg_ptr = untag_ptr(this_arg);
17390         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17391         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
17392         LDKPublicKey peer_node_id_ref;
17393         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
17394         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
17395         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
17396         int64_t ret_ref = 0;
17397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17399         return ret_ref;
17400 }
17401
17402 typedef struct LDKOnionMessageHandler_JCalls {
17403         atomic_size_t refcnt;
17404         JavaVM *vm;
17405         jweak o;
17406         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
17407         jmethodID handle_onion_message_meth;
17408         jmethodID peer_connected_meth;
17409         jmethodID peer_disconnected_meth;
17410         jmethodID provided_node_features_meth;
17411         jmethodID provided_init_features_meth;
17412 } LDKOnionMessageHandler_JCalls;
17413 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
17414         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17415         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17416                 JNIEnv *env;
17417                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17418                 if (get_jenv_res == JNI_EDETACHED) {
17419                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17420                 } else {
17421                         DO_ASSERT(get_jenv_res == JNI_OK);
17422                 }
17423                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17424                 if (get_jenv_res == JNI_EDETACHED) {
17425                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17426                 }
17427                 FREE(j_calls);
17428         }
17429 }
17430 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
17431         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17432         JNIEnv *env;
17433         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17434         if (get_jenv_res == JNI_EDETACHED) {
17435                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17436         } else {
17437                 DO_ASSERT(get_jenv_res == JNI_OK);
17438         }
17439         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
17440         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
17441         LDKOnionMessage msg_var = *msg;
17442         int64_t msg_ref = 0;
17443         msg_var = OnionMessage_clone(&msg_var);
17444         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17445         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17446         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17447         CHECK(obj != NULL);
17448         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
17449         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17450                 (*env)->ExceptionDescribe(env);
17451                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
17452         }
17453         if (get_jenv_res == JNI_EDETACHED) {
17454                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17455         }
17456 }
17457 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
17458         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17459         JNIEnv *env;
17460         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17461         if (get_jenv_res == JNI_EDETACHED) {
17462                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17463         } else {
17464                 DO_ASSERT(get_jenv_res == JNI_OK);
17465         }
17466         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17467         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17468         LDKInit init_var = *init;
17469         int64_t init_ref = 0;
17470         init_var = Init_clone(&init_var);
17471         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
17472         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
17473         jboolean inbound_conv = inbound;
17474         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17475         CHECK(obj != NULL);
17476         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
17477         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17478                 (*env)->ExceptionDescribe(env);
17479                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
17480         }
17481         void* ret_ptr = untag_ptr(ret);
17482         CHECK_ACCESS(ret_ptr);
17483         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
17484         FREE(untag_ptr(ret));
17485         if (get_jenv_res == JNI_EDETACHED) {
17486                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17487         }
17488         return ret_conv;
17489 }
17490 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17491         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17492         JNIEnv *env;
17493         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17494         if (get_jenv_res == JNI_EDETACHED) {
17495                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17496         } else {
17497                 DO_ASSERT(get_jenv_res == JNI_OK);
17498         }
17499         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17500         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17501         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17502         CHECK(obj != NULL);
17503         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
17504         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17505                 (*env)->ExceptionDescribe(env);
17506                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
17507         }
17508         if (get_jenv_res == JNI_EDETACHED) {
17509                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17510         }
17511 }
17512 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
17513         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17514         JNIEnv *env;
17515         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17516         if (get_jenv_res == JNI_EDETACHED) {
17517                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17518         } else {
17519                 DO_ASSERT(get_jenv_res == JNI_OK);
17520         }
17521         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17522         CHECK(obj != NULL);
17523         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
17524         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17525                 (*env)->ExceptionDescribe(env);
17526                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
17527         }
17528         LDKNodeFeatures ret_conv;
17529         ret_conv.inner = untag_ptr(ret);
17530         ret_conv.is_owned = ptr_is_owned(ret);
17531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17532         if (get_jenv_res == JNI_EDETACHED) {
17533                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17534         }
17535         return ret_conv;
17536 }
17537 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17538         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17539         JNIEnv *env;
17540         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17541         if (get_jenv_res == JNI_EDETACHED) {
17542                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17543         } else {
17544                 DO_ASSERT(get_jenv_res == JNI_OK);
17545         }
17546         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17547         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17548         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17549         CHECK(obj != NULL);
17550         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
17551         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17552                 (*env)->ExceptionDescribe(env);
17553                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
17554         }
17555         LDKInitFeatures ret_conv;
17556         ret_conv.inner = untag_ptr(ret);
17557         ret_conv.is_owned = ptr_is_owned(ret);
17558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17559         if (get_jenv_res == JNI_EDETACHED) {
17560                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17561         }
17562         return ret_conv;
17563 }
17564 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
17565         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
17566         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17567         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
17568 }
17569 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
17570         jclass c = (*env)->GetObjectClass(env, o);
17571         CHECK(c != NULL);
17572         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
17573         atomic_init(&calls->refcnt, 1);
17574         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17575         calls->o = (*env)->NewWeakGlobalRef(env, o);
17576         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
17577         CHECK(calls->handle_onion_message_meth != NULL);
17578         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
17579         CHECK(calls->peer_connected_meth != NULL);
17580         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
17581         CHECK(calls->peer_disconnected_meth != NULL);
17582         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17583         CHECK(calls->provided_node_features_meth != NULL);
17584         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17585         CHECK(calls->provided_init_features_meth != NULL);
17586
17587         LDKOnionMessageHandler ret = {
17588                 .this_arg = (void*) calls,
17589                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
17590                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
17591                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
17592                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
17593                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
17594                 .free = LDKOnionMessageHandler_JCalls_free,
17595                 .OnionMessageProvider = LDKOnionMessageProvider_init(env, clz, OnionMessageProvider),
17596         };
17597         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
17598         return ret;
17599 }
17600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
17601         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
17602         *res_ptr = LDKOnionMessageHandler_init(env, clz, o, OnionMessageProvider);
17603         return tag_ptr(res_ptr, true);
17604 }
17605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1get_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t arg) {
17606         LDKOnionMessageHandler *inp = (LDKOnionMessageHandler *)untag_ptr(arg);
17607         return tag_ptr(&inp->OnionMessageProvider, false);
17608 }
17609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id, int64_t msg) {
17610         void* this_arg_ptr = untag_ptr(this_arg);
17611         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17612         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17613         LDKPublicKey peer_node_id_ref;
17614         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
17615         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
17616         LDKOnionMessage msg_conv;
17617         msg_conv.inner = untag_ptr(msg);
17618         msg_conv.is_owned = ptr_is_owned(msg);
17619         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17620         msg_conv.is_owned = false;
17621         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
17622 }
17623
17624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) {
17625         void* this_arg_ptr = untag_ptr(this_arg);
17626         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17627         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17628         LDKPublicKey their_node_id_ref;
17629         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17630         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17631         LDKInit init_conv;
17632         init_conv.inner = untag_ptr(init);
17633         init_conv.is_owned = ptr_is_owned(init);
17634         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
17635         init_conv.is_owned = false;
17636         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17637         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
17638         return tag_ptr(ret_conv, true);
17639 }
17640
17641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
17642         void* this_arg_ptr = untag_ptr(this_arg);
17643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17644         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17645         LDKPublicKey their_node_id_ref;
17646         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17647         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17648         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
17649 }
17650
17651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17652         void* this_arg_ptr = untag_ptr(this_arg);
17653         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17654         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17655         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17656         int64_t ret_ref = 0;
17657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17659         return ret_ref;
17660 }
17661
17662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
17663         void* this_arg_ptr = untag_ptr(this_arg);
17664         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17665         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17666         LDKPublicKey their_node_id_ref;
17667         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17668         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17669         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17670         int64_t ret_ref = 0;
17671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17673         return ret_ref;
17674 }
17675
17676 typedef struct LDKCustomMessageReader_JCalls {
17677         atomic_size_t refcnt;
17678         JavaVM *vm;
17679         jweak o;
17680         jmethodID read_meth;
17681 } LDKCustomMessageReader_JCalls;
17682 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
17683         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
17684         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17685                 JNIEnv *env;
17686                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17687                 if (get_jenv_res == JNI_EDETACHED) {
17688                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17689                 } else {
17690                         DO_ASSERT(get_jenv_res == JNI_OK);
17691                 }
17692                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17693                 if (get_jenv_res == JNI_EDETACHED) {
17694                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17695                 }
17696                 FREE(j_calls);
17697         }
17698 }
17699 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
17700         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
17701         JNIEnv *env;
17702         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17703         if (get_jenv_res == JNI_EDETACHED) {
17704                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17705         } else {
17706                 DO_ASSERT(get_jenv_res == JNI_OK);
17707         }
17708         int16_t message_type_conv = message_type;
17709         LDKu8slice buffer_var = buffer;
17710         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
17711         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
17712         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17713         CHECK(obj != NULL);
17714         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
17715         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17716                 (*env)->ExceptionDescribe(env);
17717                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
17718         }
17719         void* ret_ptr = untag_ptr(ret);
17720         CHECK_ACCESS(ret_ptr);
17721         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
17722         FREE(untag_ptr(ret));
17723         if (get_jenv_res == JNI_EDETACHED) {
17724                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17725         }
17726         return ret_conv;
17727 }
17728 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
17729         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
17730         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17731 }
17732 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
17733         jclass c = (*env)->GetObjectClass(env, o);
17734         CHECK(c != NULL);
17735         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
17736         atomic_init(&calls->refcnt, 1);
17737         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17738         calls->o = (*env)->NewWeakGlobalRef(env, o);
17739         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
17740         CHECK(calls->read_meth != NULL);
17741
17742         LDKCustomMessageReader ret = {
17743                 .this_arg = (void*) calls,
17744                 .read = read_LDKCustomMessageReader_jcall,
17745                 .free = LDKCustomMessageReader_JCalls_free,
17746         };
17747         return ret;
17748 }
17749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
17750         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
17751         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
17752         return tag_ptr(res_ptr, true);
17753 }
17754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read(JNIEnv *env, jclass clz, int64_t this_arg, int16_t message_type, int8_tArray buffer) {
17755         void* this_arg_ptr = untag_ptr(this_arg);
17756         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17757         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
17758         LDKu8slice buffer_ref;
17759         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
17760         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
17761         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17762         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
17763         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
17764         return tag_ptr(ret_conv, true);
17765 }
17766
17767 typedef struct LDKCustomMessageHandler_JCalls {
17768         atomic_size_t refcnt;
17769         JavaVM *vm;
17770         jweak o;
17771         LDKCustomMessageReader_JCalls* CustomMessageReader;
17772         jmethodID handle_custom_message_meth;
17773         jmethodID get_and_clear_pending_msg_meth;
17774         jmethodID provided_node_features_meth;
17775         jmethodID provided_init_features_meth;
17776 } LDKCustomMessageHandler_JCalls;
17777 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
17778         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17779         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17780                 JNIEnv *env;
17781                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17782                 if (get_jenv_res == JNI_EDETACHED) {
17783                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17784                 } else {
17785                         DO_ASSERT(get_jenv_res == JNI_OK);
17786                 }
17787                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17788                 if (get_jenv_res == JNI_EDETACHED) {
17789                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17790                 }
17791                 FREE(j_calls);
17792         }
17793 }
17794 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
17795         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17796         JNIEnv *env;
17797         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17798         if (get_jenv_res == JNI_EDETACHED) {
17799                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17800         } else {
17801                 DO_ASSERT(get_jenv_res == JNI_OK);
17802         }
17803         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
17804         *msg_ret = msg;
17805         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
17806         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
17807         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17808         CHECK(obj != NULL);
17809         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
17810         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17811                 (*env)->ExceptionDescribe(env);
17812                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
17813         }
17814         void* ret_ptr = untag_ptr(ret);
17815         CHECK_ACCESS(ret_ptr);
17816         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17817         FREE(untag_ptr(ret));
17818         if (get_jenv_res == JNI_EDETACHED) {
17819                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17820         }
17821         return ret_conv;
17822 }
17823 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
17824         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17825         JNIEnv *env;
17826         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17827         if (get_jenv_res == JNI_EDETACHED) {
17828                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17829         } else {
17830                 DO_ASSERT(get_jenv_res == JNI_OK);
17831         }
17832         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17833         CHECK(obj != NULL);
17834         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
17835         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17836                 (*env)->ExceptionDescribe(env);
17837                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
17838         }
17839         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
17840         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
17841         if (ret_constr.datalen > 0)
17842                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17843         else
17844                 ret_constr.data = NULL;
17845         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
17846         for (size_t z = 0; z < ret_constr.datalen; z++) {
17847                 int64_t ret_conv_25 = ret_vals[z];
17848                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
17849                 CHECK_ACCESS(ret_conv_25_ptr);
17850                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
17851                 FREE(untag_ptr(ret_conv_25));
17852                 ret_constr.data[z] = ret_conv_25_conv;
17853         }
17854         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
17855         if (get_jenv_res == JNI_EDETACHED) {
17856                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17857         }
17858         return ret_constr;
17859 }
17860 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
17861         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17862         JNIEnv *env;
17863         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17864         if (get_jenv_res == JNI_EDETACHED) {
17865                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17866         } else {
17867                 DO_ASSERT(get_jenv_res == JNI_OK);
17868         }
17869         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17870         CHECK(obj != NULL);
17871         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
17872         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17873                 (*env)->ExceptionDescribe(env);
17874                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
17875         }
17876         LDKNodeFeatures ret_conv;
17877         ret_conv.inner = untag_ptr(ret);
17878         ret_conv.is_owned = ptr_is_owned(ret);
17879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17880         if (get_jenv_res == JNI_EDETACHED) {
17881                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17882         }
17883         return ret_conv;
17884 }
17885 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17886         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17887         JNIEnv *env;
17888         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17889         if (get_jenv_res == JNI_EDETACHED) {
17890                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17891         } else {
17892                 DO_ASSERT(get_jenv_res == JNI_OK);
17893         }
17894         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17895         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17896         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17897         CHECK(obj != NULL);
17898         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
17899         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17900                 (*env)->ExceptionDescribe(env);
17901                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
17902         }
17903         LDKInitFeatures ret_conv;
17904         ret_conv.inner = untag_ptr(ret);
17905         ret_conv.is_owned = ptr_is_owned(ret);
17906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17907         if (get_jenv_res == JNI_EDETACHED) {
17908                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17909         }
17910         return ret_conv;
17911 }
17912 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
17913         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
17914         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17915         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
17916 }
17917 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
17918         jclass c = (*env)->GetObjectClass(env, o);
17919         CHECK(c != NULL);
17920         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
17921         atomic_init(&calls->refcnt, 1);
17922         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17923         calls->o = (*env)->NewWeakGlobalRef(env, o);
17924         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
17925         CHECK(calls->handle_custom_message_meth != NULL);
17926         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
17927         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
17928         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17929         CHECK(calls->provided_node_features_meth != NULL);
17930         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17931         CHECK(calls->provided_init_features_meth != NULL);
17932
17933         LDKCustomMessageHandler ret = {
17934                 .this_arg = (void*) calls,
17935                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
17936                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
17937                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
17938                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
17939                 .free = LDKCustomMessageHandler_JCalls_free,
17940                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
17941         };
17942         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
17943         return ret;
17944 }
17945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
17946         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
17947         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
17948         return tag_ptr(res_ptr, true);
17949 }
17950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
17951         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
17952         return tag_ptr(&inp->CustomMessageReader, false);
17953 }
17954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
17955         void* this_arg_ptr = untag_ptr(this_arg);
17956         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17957         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17958         void* msg_ptr = untag_ptr(msg);
17959         CHECK_ACCESS(msg_ptr);
17960         LDKType msg_conv = *(LDKType*)(msg_ptr);
17961         if (msg_conv.free == LDKType_JCalls_free) {
17962                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17963                 LDKType_JCalls_cloned(&msg_conv);
17964         }
17965         LDKPublicKey sender_node_id_ref;
17966         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
17967         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
17968         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17969         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
17970         return tag_ptr(ret_conv, true);
17971 }
17972
17973 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
17974         void* this_arg_ptr = untag_ptr(this_arg);
17975         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17976         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17977         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
17978         int64_tArray ret_arr = NULL;
17979         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17980         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17981         for (size_t z = 0; z < ret_var.datalen; z++) {
17982                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17983                 *ret_conv_25_conv = ret_var.data[z];
17984                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
17985         }
17986         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17987         FREE(ret_var.data);
17988         return ret_arr;
17989 }
17990
17991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17992         void* this_arg_ptr = untag_ptr(this_arg);
17993         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17994         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17995         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17996         int64_t ret_ref = 0;
17997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17999         return ret_ref;
18000 }
18001
18002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
18003         void* this_arg_ptr = untag_ptr(this_arg);
18004         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18005         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18006         LDKPublicKey their_node_id_ref;
18007         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18008         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18009         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
18010         int64_t ret_ref = 0;
18011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18013         return ret_ref;
18014 }
18015
18016 typedef struct LDKOffersMessageHandler_JCalls {
18017         atomic_size_t refcnt;
18018         JavaVM *vm;
18019         jweak o;
18020         jmethodID handle_message_meth;
18021 } LDKOffersMessageHandler_JCalls;
18022 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
18023         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
18024         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18025                 JNIEnv *env;
18026                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18027                 if (get_jenv_res == JNI_EDETACHED) {
18028                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18029                 } else {
18030                         DO_ASSERT(get_jenv_res == JNI_OK);
18031                 }
18032                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18033                 if (get_jenv_res == JNI_EDETACHED) {
18034                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18035                 }
18036                 FREE(j_calls);
18037         }
18038 }
18039 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
18040         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
18041         JNIEnv *env;
18042         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18043         if (get_jenv_res == JNI_EDETACHED) {
18044                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18045         } else {
18046                 DO_ASSERT(get_jenv_res == JNI_OK);
18047         }
18048         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
18049         *message_copy = message;
18050         int64_t message_ref = tag_ptr(message_copy, true);
18051         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18052         CHECK(obj != NULL);
18053         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
18054         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18055                 (*env)->ExceptionDescribe(env);
18056                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
18057         }
18058         void* ret_ptr = untag_ptr(ret);
18059         CHECK_ACCESS(ret_ptr);
18060         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
18061         FREE(untag_ptr(ret));
18062         if (get_jenv_res == JNI_EDETACHED) {
18063                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18064         }
18065         return ret_conv;
18066 }
18067 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
18068         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
18069         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18070 }
18071 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
18072         jclass c = (*env)->GetObjectClass(env, o);
18073         CHECK(c != NULL);
18074         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
18075         atomic_init(&calls->refcnt, 1);
18076         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18077         calls->o = (*env)->NewWeakGlobalRef(env, o);
18078         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
18079         CHECK(calls->handle_message_meth != NULL);
18080
18081         LDKOffersMessageHandler ret = {
18082                 .this_arg = (void*) calls,
18083                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
18084                 .free = LDKOffersMessageHandler_JCalls_free,
18085         };
18086         return ret;
18087 }
18088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18089         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
18090         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
18091         return tag_ptr(res_ptr, true);
18092 }
18093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
18094         void* this_arg_ptr = untag_ptr(this_arg);
18095         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18096         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
18097         void* message_ptr = untag_ptr(message);
18098         CHECK_ACCESS(message_ptr);
18099         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
18100         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
18101         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
18102         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
18103         int64_t ret_ref = tag_ptr(ret_copy, true);
18104         return ret_ref;
18105 }
18106
18107 typedef struct LDKCustomOnionMessageHandler_JCalls {
18108         atomic_size_t refcnt;
18109         JavaVM *vm;
18110         jweak o;
18111         jmethodID handle_custom_message_meth;
18112         jmethodID read_custom_message_meth;
18113 } LDKCustomOnionMessageHandler_JCalls;
18114 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
18115         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
18116         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18117                 JNIEnv *env;
18118                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18119                 if (get_jenv_res == JNI_EDETACHED) {
18120                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18121                 } else {
18122                         DO_ASSERT(get_jenv_res == JNI_OK);
18123                 }
18124                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18125                 if (get_jenv_res == JNI_EDETACHED) {
18126                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18127                 }
18128                 FREE(j_calls);
18129         }
18130 }
18131 LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
18132         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
18133         JNIEnv *env;
18134         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18135         if (get_jenv_res == JNI_EDETACHED) {
18136                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18137         } else {
18138                 DO_ASSERT(get_jenv_res == JNI_OK);
18139         }
18140         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
18141         *msg_ret = msg;
18142         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18143         CHECK(obj != NULL);
18144         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
18145         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18146                 (*env)->ExceptionDescribe(env);
18147                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
18148         }
18149         void* ret_ptr = untag_ptr(ret);
18150         CHECK_ACCESS(ret_ptr);
18151         LDKCOption_CustomOnionMessageContentsZ ret_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(ret_ptr);
18152         FREE(untag_ptr(ret));
18153         if (get_jenv_res == JNI_EDETACHED) {
18154                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18155         }
18156         return ret_conv;
18157 }
18158 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
18159         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
18160         JNIEnv *env;
18161         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18162         if (get_jenv_res == JNI_EDETACHED) {
18163                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18164         } else {
18165                 DO_ASSERT(get_jenv_res == JNI_OK);
18166         }
18167         int64_t message_type_conv = message_type;
18168         LDKu8slice buffer_var = buffer;
18169         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
18170         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
18171         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18172         CHECK(obj != NULL);
18173         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
18174         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18175                 (*env)->ExceptionDescribe(env);
18176                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
18177         }
18178         void* ret_ptr = untag_ptr(ret);
18179         CHECK_ACCESS(ret_ptr);
18180         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
18181         FREE(untag_ptr(ret));
18182         if (get_jenv_res == JNI_EDETACHED) {
18183                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18184         }
18185         return ret_conv;
18186 }
18187 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
18188         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
18189         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18190 }
18191 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
18192         jclass c = (*env)->GetObjectClass(env, o);
18193         CHECK(c != NULL);
18194         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
18195         atomic_init(&calls->refcnt, 1);
18196         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18197         calls->o = (*env)->NewWeakGlobalRef(env, o);
18198         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
18199         CHECK(calls->handle_custom_message_meth != NULL);
18200         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
18201         CHECK(calls->read_custom_message_meth != NULL);
18202
18203         LDKCustomOnionMessageHandler ret = {
18204                 .this_arg = (void*) calls,
18205                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
18206                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
18207                 .free = LDKCustomOnionMessageHandler_JCalls_free,
18208         };
18209         return ret;
18210 }
18211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18212         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
18213         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
18214         return tag_ptr(res_ptr, true);
18215 }
18216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18217         void* this_arg_ptr = untag_ptr(this_arg);
18218         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18219         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
18220         void* msg_ptr = untag_ptr(msg);
18221         CHECK_ACCESS(msg_ptr);
18222         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
18223         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
18224                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18225                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
18226         }
18227         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18228         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
18229         int64_t ret_ref = tag_ptr(ret_copy, true);
18230         return ret_ref;
18231 }
18232
18233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1read_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message_type, int8_tArray buffer) {
18234         void* this_arg_ptr = untag_ptr(this_arg);
18235         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18236         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
18237         LDKu8slice buffer_ref;
18238         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
18239         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
18240         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18241         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
18242         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
18243         return tag_ptr(ret_conv, true);
18244 }
18245
18246 typedef struct LDKSocketDescriptor_JCalls {
18247         atomic_size_t refcnt;
18248         JavaVM *vm;
18249         jweak o;
18250         jmethodID send_data_meth;
18251         jmethodID disconnect_socket_meth;
18252         jmethodID eq_meth;
18253         jmethodID hash_meth;
18254 } LDKSocketDescriptor_JCalls;
18255 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
18256         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18257         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18258                 JNIEnv *env;
18259                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18260                 if (get_jenv_res == JNI_EDETACHED) {
18261                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18262                 } else {
18263                         DO_ASSERT(get_jenv_res == JNI_OK);
18264                 }
18265                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18266                 if (get_jenv_res == JNI_EDETACHED) {
18267                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18268                 }
18269                 FREE(j_calls);
18270         }
18271 }
18272 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
18273         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18274         JNIEnv *env;
18275         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18276         if (get_jenv_res == JNI_EDETACHED) {
18277                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18278         } else {
18279                 DO_ASSERT(get_jenv_res == JNI_OK);
18280         }
18281         LDKu8slice data_var = data;
18282         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
18283         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
18284         jboolean resume_read_conv = resume_read;
18285         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18286         CHECK(obj != NULL);
18287         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
18288         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18289                 (*env)->ExceptionDescribe(env);
18290                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
18291         }
18292         if (get_jenv_res == JNI_EDETACHED) {
18293                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18294         }
18295         return ret;
18296 }
18297 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
18298         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18299         JNIEnv *env;
18300         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18301         if (get_jenv_res == JNI_EDETACHED) {
18302                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18303         } else {
18304                 DO_ASSERT(get_jenv_res == JNI_OK);
18305         }
18306         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18307         CHECK(obj != NULL);
18308         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
18309         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18310                 (*env)->ExceptionDescribe(env);
18311                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
18312         }
18313         if (get_jenv_res == JNI_EDETACHED) {
18314                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18315         }
18316 }
18317 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
18318         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18319         JNIEnv *env;
18320         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18321         if (get_jenv_res == JNI_EDETACHED) {
18322                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18323         } else {
18324                 DO_ASSERT(get_jenv_res == JNI_OK);
18325         }
18326         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
18327         *other_arg_clone = SocketDescriptor_clone(other_arg);
18328         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18329         CHECK(obj != NULL);
18330         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
18331         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18332                 (*env)->ExceptionDescribe(env);
18333                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
18334         }
18335         if (get_jenv_res == JNI_EDETACHED) {
18336                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18337         }
18338         return ret;
18339 }
18340 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
18341         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18342         JNIEnv *env;
18343         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18344         if (get_jenv_res == JNI_EDETACHED) {
18345                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18346         } else {
18347                 DO_ASSERT(get_jenv_res == JNI_OK);
18348         }
18349         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18350         CHECK(obj != NULL);
18351         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
18352         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18353                 (*env)->ExceptionDescribe(env);
18354                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
18355         }
18356         if (get_jenv_res == JNI_EDETACHED) {
18357                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18358         }
18359         return ret;
18360 }
18361 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
18362         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
18363         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18364 }
18365 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
18366         jclass c = (*env)->GetObjectClass(env, o);
18367         CHECK(c != NULL);
18368         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
18369         atomic_init(&calls->refcnt, 1);
18370         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18371         calls->o = (*env)->NewWeakGlobalRef(env, o);
18372         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
18373         CHECK(calls->send_data_meth != NULL);
18374         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
18375         CHECK(calls->disconnect_socket_meth != NULL);
18376         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
18377         CHECK(calls->eq_meth != NULL);
18378         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
18379         CHECK(calls->hash_meth != NULL);
18380
18381         LDKSocketDescriptor ret = {
18382                 .this_arg = (void*) calls,
18383                 .send_data = send_data_LDKSocketDescriptor_jcall,
18384                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
18385                 .eq = eq_LDKSocketDescriptor_jcall,
18386                 .hash = hash_LDKSocketDescriptor_jcall,
18387                 .cloned = LDKSocketDescriptor_JCalls_cloned,
18388                 .free = LDKSocketDescriptor_JCalls_free,
18389         };
18390         return ret;
18391 }
18392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
18393         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
18394         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
18395         return tag_ptr(res_ptr, true);
18396 }
18397 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) {
18398         void* this_arg_ptr = untag_ptr(this_arg);
18399         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18400         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
18401         LDKu8slice data_ref;
18402         data_ref.datalen = (*env)->GetArrayLength(env, data);
18403         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
18404         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
18405         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
18406         return ret_conv;
18407 }
18408
18409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
18410         void* this_arg_ptr = untag_ptr(this_arg);
18411         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18412         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
18413         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
18414 }
18415
18416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
18417         void* this_arg_ptr = untag_ptr(this_arg);
18418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18419         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
18420         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
18421         return ret_conv;
18422 }
18423
18424 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
18425 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
18426 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
18427 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
18428 static jclass LDKEffectiveCapacity_Total_class = NULL;
18429 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
18430 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
18431 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
18432 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
18433 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
18434 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
18435 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
18436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
18437         LDKEffectiveCapacity_ExactLiquidity_class =
18438                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
18439         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
18440         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
18441         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
18442         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
18443                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
18444         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
18445         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
18446         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
18447         LDKEffectiveCapacity_Total_class =
18448                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
18449         CHECK(LDKEffectiveCapacity_Total_class != NULL);
18450         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
18451         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
18452         LDKEffectiveCapacity_Infinite_class =
18453                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
18454         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
18455         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
18456         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
18457         LDKEffectiveCapacity_HintMaxHTLC_class =
18458                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
18459         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
18460         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
18461         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
18462         LDKEffectiveCapacity_Unknown_class =
18463                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
18464         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
18465         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
18466         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
18467 }
18468 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18469         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
18470         switch(obj->tag) {
18471                 case LDKEffectiveCapacity_ExactLiquidity: {
18472                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
18473                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
18474                 }
18475                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
18476                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
18477                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
18478                 }
18479                 case LDKEffectiveCapacity_Total: {
18480                         int64_t capacity_msat_conv = obj->total.capacity_msat;
18481                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
18482                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
18483                 }
18484                 case LDKEffectiveCapacity_Infinite: {
18485                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
18486                 }
18487                 case LDKEffectiveCapacity_HintMaxHTLC: {
18488                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
18489                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
18490                 }
18491                 case LDKEffectiveCapacity_Unknown: {
18492                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
18493                 }
18494                 default: abort();
18495         }
18496 }
18497 static jclass LDKPayee_Blinded_class = NULL;
18498 static jmethodID LDKPayee_Blinded_meth = NULL;
18499 static jclass LDKPayee_Clear_class = NULL;
18500 static jmethodID LDKPayee_Clear_meth = NULL;
18501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
18502         LDKPayee_Blinded_class =
18503                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
18504         CHECK(LDKPayee_Blinded_class != NULL);
18505         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
18506         CHECK(LDKPayee_Blinded_meth != NULL);
18507         LDKPayee_Clear_class =
18508                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
18509         CHECK(LDKPayee_Clear_class != NULL);
18510         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
18511         CHECK(LDKPayee_Clear_meth != NULL);
18512 }
18513 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18514         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
18515         switch(obj->tag) {
18516                 case LDKPayee_Blinded: {
18517                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
18518                         int64_tArray route_hints_arr = NULL;
18519                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
18520                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
18521                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
18522                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18523                                 *route_hints_conv_37_conv = route_hints_var.data[l];
18524                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
18525                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
18526                         }
18527                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
18528                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
18529                         int64_t features_ref = 0;
18530                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
18531                         features_ref = tag_ptr(features_var.inner, false);
18532                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
18533                 }
18534                 case LDKPayee_Clear: {
18535                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
18536                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
18537                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
18538                         int64_tArray route_hints_arr = NULL;
18539                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
18540                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
18541                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
18542                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
18543                                 int64_t route_hints_conv_11_ref = 0;
18544                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
18545                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
18546                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
18547                         }
18548                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
18549                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
18550                         int64_t features_ref = 0;
18551                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
18552                         features_ref = tag_ptr(features_var.inner, false);
18553                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
18554                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
18555                 }
18556                 default: abort();
18557         }
18558 }
18559 static jclass LDKDestination_Node_class = NULL;
18560 static jmethodID LDKDestination_Node_meth = NULL;
18561 static jclass LDKDestination_BlindedPath_class = NULL;
18562 static jmethodID LDKDestination_BlindedPath_meth = NULL;
18563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
18564         LDKDestination_Node_class =
18565                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
18566         CHECK(LDKDestination_Node_class != NULL);
18567         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
18568         CHECK(LDKDestination_Node_meth != NULL);
18569         LDKDestination_BlindedPath_class =
18570                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
18571         CHECK(LDKDestination_BlindedPath_class != NULL);
18572         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
18573         CHECK(LDKDestination_BlindedPath_meth != NULL);
18574 }
18575 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18576         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
18577         switch(obj->tag) {
18578                 case LDKDestination_Node: {
18579                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
18580                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
18581                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
18582                 }
18583                 case LDKDestination_BlindedPath: {
18584                         LDKBlindedPath blinded_path_var = obj->blinded_path;
18585                         int64_t blinded_path_ref = 0;
18586                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
18587                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
18588                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
18589                 }
18590                 default: abort();
18591         }
18592 }
18593 typedef struct LDKMessageRouter_JCalls {
18594         atomic_size_t refcnt;
18595         JavaVM *vm;
18596         jweak o;
18597         jmethodID find_path_meth;
18598 } LDKMessageRouter_JCalls;
18599 static void LDKMessageRouter_JCalls_free(void* this_arg) {
18600         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
18601         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18602                 JNIEnv *env;
18603                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18604                 if (get_jenv_res == JNI_EDETACHED) {
18605                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18606                 } else {
18607                         DO_ASSERT(get_jenv_res == JNI_OK);
18608                 }
18609                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18610                 if (get_jenv_res == JNI_EDETACHED) {
18611                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18612                 }
18613                 FREE(j_calls);
18614         }
18615 }
18616 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
18617         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
18618         JNIEnv *env;
18619         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18620         if (get_jenv_res == JNI_EDETACHED) {
18621                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18622         } else {
18623                 DO_ASSERT(get_jenv_res == JNI_OK);
18624         }
18625         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
18626         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
18627         LDKCVec_PublicKeyZ peers_var = peers;
18628         jobjectArray peers_arr = NULL;
18629         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
18630         ;
18631         for (size_t i = 0; i < peers_var.datalen; i++) {
18632                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
18633                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
18634                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
18635         }
18636         
18637         FREE(peers_var.data);
18638         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
18639         *destination_copy = destination;
18640         int64_t destination_ref = tag_ptr(destination_copy, true);
18641         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18642         CHECK(obj != NULL);
18643         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
18644         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18645                 (*env)->ExceptionDescribe(env);
18646                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
18647         }
18648         void* ret_ptr = untag_ptr(ret);
18649         CHECK_ACCESS(ret_ptr);
18650         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
18651         FREE(untag_ptr(ret));
18652         if (get_jenv_res == JNI_EDETACHED) {
18653                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18654         }
18655         return ret_conv;
18656 }
18657 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
18658         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
18659         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18660 }
18661 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
18662         jclass c = (*env)->GetObjectClass(env, o);
18663         CHECK(c != NULL);
18664         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
18665         atomic_init(&calls->refcnt, 1);
18666         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18667         calls->o = (*env)->NewWeakGlobalRef(env, o);
18668         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
18669         CHECK(calls->find_path_meth != NULL);
18670
18671         LDKMessageRouter ret = {
18672                 .this_arg = (void*) calls,
18673                 .find_path = find_path_LDKMessageRouter_jcall,
18674                 .free = LDKMessageRouter_JCalls_free,
18675         };
18676         return ret;
18677 }
18678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
18679         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
18680         *res_ptr = LDKMessageRouter_init(env, clz, o);
18681         return tag_ptr(res_ptr, true);
18682 }
18683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageRouter_1find_1path(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray sender, jobjectArray peers, int64_t destination) {
18684         void* this_arg_ptr = untag_ptr(this_arg);
18685         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18686         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
18687         LDKPublicKey sender_ref;
18688         CHECK((*env)->GetArrayLength(env, sender) == 33);
18689         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
18690         LDKCVec_PublicKeyZ peers_constr;
18691         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
18692         if (peers_constr.datalen > 0)
18693                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
18694         else
18695                 peers_constr.data = NULL;
18696         for (size_t i = 0; i < peers_constr.datalen; i++) {
18697                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
18698                 LDKPublicKey peers_conv_8_ref;
18699                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
18700                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
18701                 peers_constr.data[i] = peers_conv_8_ref;
18702         }
18703         void* destination_ptr = untag_ptr(destination);
18704         CHECK_ACCESS(destination_ptr);
18705         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
18706         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
18707         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18708         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
18709         return tag_ptr(ret_conv, true);
18710 }
18711
18712 static jclass LDKOnionMessageContents_Offers_class = NULL;
18713 static jmethodID LDKOnionMessageContents_Offers_meth = NULL;
18714 static jclass LDKOnionMessageContents_Custom_class = NULL;
18715 static jmethodID LDKOnionMessageContents_Custom_meth = NULL;
18716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOnionMessageContents_init (JNIEnv *env, jclass clz) {
18717         LDKOnionMessageContents_Offers_class =
18718                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Offers"));
18719         CHECK(LDKOnionMessageContents_Offers_class != NULL);
18720         LDKOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Offers_class, "<init>", "(J)V");
18721         CHECK(LDKOnionMessageContents_Offers_meth != NULL);
18722         LDKOnionMessageContents_Custom_class =
18723                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Custom"));
18724         CHECK(LDKOnionMessageContents_Custom_class != NULL);
18725         LDKOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Custom_class, "<init>", "(J)V");
18726         CHECK(LDKOnionMessageContents_Custom_meth != NULL);
18727 }
18728 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18729         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
18730         switch(obj->tag) {
18731                 case LDKOnionMessageContents_Offers: {
18732                         int64_t offers_ref = tag_ptr(&obj->offers, false);
18733                         return (*env)->NewObject(env, LDKOnionMessageContents_Offers_class, LDKOnionMessageContents_Offers_meth, offers_ref);
18734                 }
18735                 case LDKOnionMessageContents_Custom: {
18736                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
18737                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
18738                         return (*env)->NewObject(env, LDKOnionMessageContents_Custom_class, LDKOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
18739                 }
18740                 default: abort();
18741         }
18742 }
18743 typedef struct LDKCoinSelectionSource_JCalls {
18744         atomic_size_t refcnt;
18745         JavaVM *vm;
18746         jweak o;
18747         jmethodID select_confirmed_utxos_meth;
18748         jmethodID sign_tx_meth;
18749 } LDKCoinSelectionSource_JCalls;
18750 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
18751         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
18752         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18753                 JNIEnv *env;
18754                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18755                 if (get_jenv_res == JNI_EDETACHED) {
18756                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18757                 } else {
18758                         DO_ASSERT(get_jenv_res == JNI_OK);
18759                 }
18760                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18761                 if (get_jenv_res == JNI_EDETACHED) {
18762                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18763                 }
18764                 FREE(j_calls);
18765         }
18766 }
18767 LDKCResult_CoinSelectionNoneZ select_confirmed_utxos_LDKCoinSelectionSource_jcall(const void* this_arg, LDKThirtyTwoBytes claim_id, LDKCVec_InputZ must_spend, LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight) {
18768         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
18769         JNIEnv *env;
18770         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18771         if (get_jenv_res == JNI_EDETACHED) {
18772                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18773         } else {
18774                 DO_ASSERT(get_jenv_res == JNI_OK);
18775         }
18776         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
18777         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
18778         LDKCVec_InputZ must_spend_var = must_spend;
18779         int64_tArray must_spend_arr = NULL;
18780         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
18781         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
18782         for (size_t h = 0; h < must_spend_var.datalen; h++) {
18783                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
18784                 int64_t must_spend_conv_7_ref = 0;
18785                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
18786                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
18787                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
18788         }
18789         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
18790         FREE(must_spend_var.data);
18791         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
18792         int64_tArray must_pay_to_arr = NULL;
18793         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
18794         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
18795         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
18796                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18797                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
18798                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
18799         }
18800         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
18801         FREE(must_pay_to_var.data);
18802         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
18803         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18804         CHECK(obj != NULL);
18805         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->select_confirmed_utxos_meth, claim_id_arr, must_spend_arr, must_pay_to_arr, target_feerate_sat_per_1000_weight_conv);
18806         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18807                 (*env)->ExceptionDescribe(env);
18808                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
18809         }
18810         void* ret_ptr = untag_ptr(ret);
18811         CHECK_ACCESS(ret_ptr);
18812         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
18813         FREE(untag_ptr(ret));
18814         if (get_jenv_res == JNI_EDETACHED) {
18815                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18816         }
18817         return ret_conv;
18818 }
18819 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
18820         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
18821         JNIEnv *env;
18822         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18823         if (get_jenv_res == JNI_EDETACHED) {
18824                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18825         } else {
18826                 DO_ASSERT(get_jenv_res == JNI_OK);
18827         }
18828         LDKTransaction tx_var = tx;
18829         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
18830         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
18831         Transaction_free(tx_var);
18832         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18833         CHECK(obj != NULL);
18834         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
18835         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18836                 (*env)->ExceptionDescribe(env);
18837                 (*env)->FatalError(env, "A call to sign_tx in LDKCoinSelectionSource from rust threw an exception.");
18838         }
18839         void* ret_ptr = untag_ptr(ret);
18840         CHECK_ACCESS(ret_ptr);
18841         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
18842         FREE(untag_ptr(ret));
18843         if (get_jenv_res == JNI_EDETACHED) {
18844                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18845         }
18846         return ret_conv;
18847 }
18848 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
18849         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
18850         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18851 }
18852 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
18853         jclass c = (*env)->GetObjectClass(env, o);
18854         CHECK(c != NULL);
18855         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
18856         atomic_init(&calls->refcnt, 1);
18857         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18858         calls->o = (*env)->NewWeakGlobalRef(env, o);
18859         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
18860         CHECK(calls->select_confirmed_utxos_meth != NULL);
18861         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
18862         CHECK(calls->sign_tx_meth != NULL);
18863
18864         LDKCoinSelectionSource ret = {
18865                 .this_arg = (void*) calls,
18866                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
18867                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
18868                 .free = LDKCoinSelectionSource_JCalls_free,
18869         };
18870         return ret;
18871 }
18872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
18873         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
18874         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
18875         return tag_ptr(res_ptr, true);
18876 }
18877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1select_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray claim_id, int64_tArray must_spend, int64_tArray must_pay_to, int32_t target_feerate_sat_per_1000_weight) {
18878         void* this_arg_ptr = untag_ptr(this_arg);
18879         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18880         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
18881         LDKThirtyTwoBytes claim_id_ref;
18882         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
18883         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
18884         LDKCVec_InputZ must_spend_constr;
18885         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
18886         if (must_spend_constr.datalen > 0)
18887                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
18888         else
18889                 must_spend_constr.data = NULL;
18890         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
18891         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
18892                 int64_t must_spend_conv_7 = must_spend_vals[h];
18893                 LDKInput must_spend_conv_7_conv;
18894                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
18895                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
18896                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
18897                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
18898                 must_spend_constr.data[h] = must_spend_conv_7_conv;
18899         }
18900         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
18901         LDKCVec_TxOutZ must_pay_to_constr;
18902         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
18903         if (must_pay_to_constr.datalen > 0)
18904                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
18905         else
18906                 must_pay_to_constr.data = NULL;
18907         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
18908         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
18909                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
18910                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
18911                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
18912                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
18913                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
18914                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
18915         }
18916         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
18917         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
18918         *ret_conv = (this_arg_conv->select_confirmed_utxos)(this_arg_conv->this_arg, claim_id_ref, must_spend_constr, must_pay_to_constr, target_feerate_sat_per_1000_weight);
18919         return tag_ptr(ret_conv, true);
18920 }
18921
18922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
18923         void* this_arg_ptr = untag_ptr(this_arg);
18924         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18925         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
18926         LDKTransaction tx_ref;
18927         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
18928         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
18929         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
18930         tx_ref.data_is_owned = true;
18931         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18932         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
18933         return tag_ptr(ret_conv, true);
18934 }
18935
18936 typedef struct LDKWalletSource_JCalls {
18937         atomic_size_t refcnt;
18938         JavaVM *vm;
18939         jweak o;
18940         jmethodID list_confirmed_utxos_meth;
18941         jmethodID get_change_script_meth;
18942         jmethodID sign_tx_meth;
18943 } LDKWalletSource_JCalls;
18944 static void LDKWalletSource_JCalls_free(void* this_arg) {
18945         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18946         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18947                 JNIEnv *env;
18948                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18949                 if (get_jenv_res == JNI_EDETACHED) {
18950                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18951                 } else {
18952                         DO_ASSERT(get_jenv_res == JNI_OK);
18953                 }
18954                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18955                 if (get_jenv_res == JNI_EDETACHED) {
18956                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18957                 }
18958                 FREE(j_calls);
18959         }
18960 }
18961 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
18962         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18963         JNIEnv *env;
18964         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18965         if (get_jenv_res == JNI_EDETACHED) {
18966                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18967         } else {
18968                 DO_ASSERT(get_jenv_res == JNI_OK);
18969         }
18970         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18971         CHECK(obj != NULL);
18972         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
18973         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18974                 (*env)->ExceptionDescribe(env);
18975                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
18976         }
18977         void* ret_ptr = untag_ptr(ret);
18978         CHECK_ACCESS(ret_ptr);
18979         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
18980         FREE(untag_ptr(ret));
18981         if (get_jenv_res == JNI_EDETACHED) {
18982                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18983         }
18984         return ret_conv;
18985 }
18986 LDKCResult_ScriptNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
18987         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18988         JNIEnv *env;
18989         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18990         if (get_jenv_res == JNI_EDETACHED) {
18991                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18992         } else {
18993                 DO_ASSERT(get_jenv_res == JNI_OK);
18994         }
18995         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18996         CHECK(obj != NULL);
18997         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
18998         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18999                 (*env)->ExceptionDescribe(env);
19000                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
19001         }
19002         void* ret_ptr = untag_ptr(ret);
19003         CHECK_ACCESS(ret_ptr);
19004         LDKCResult_ScriptNoneZ ret_conv = *(LDKCResult_ScriptNoneZ*)(ret_ptr);
19005         FREE(untag_ptr(ret));
19006         if (get_jenv_res == JNI_EDETACHED) {
19007                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19008         }
19009         return ret_conv;
19010 }
19011 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
19012         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
19013         JNIEnv *env;
19014         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19015         if (get_jenv_res == JNI_EDETACHED) {
19016                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19017         } else {
19018                 DO_ASSERT(get_jenv_res == JNI_OK);
19019         }
19020         LDKTransaction tx_var = tx;
19021         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
19022         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
19023         Transaction_free(tx_var);
19024         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19025         CHECK(obj != NULL);
19026         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
19027         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19028                 (*env)->ExceptionDescribe(env);
19029                 (*env)->FatalError(env, "A call to sign_tx in LDKWalletSource from rust threw an exception.");
19030         }
19031         void* ret_ptr = untag_ptr(ret);
19032         CHECK_ACCESS(ret_ptr);
19033         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
19034         FREE(untag_ptr(ret));
19035         if (get_jenv_res == JNI_EDETACHED) {
19036                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19037         }
19038         return ret_conv;
19039 }
19040 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
19041         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
19042         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19043 }
19044 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
19045         jclass c = (*env)->GetObjectClass(env, o);
19046         CHECK(c != NULL);
19047         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
19048         atomic_init(&calls->refcnt, 1);
19049         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19050         calls->o = (*env)->NewWeakGlobalRef(env, o);
19051         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
19052         CHECK(calls->list_confirmed_utxos_meth != NULL);
19053         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
19054         CHECK(calls->get_change_script_meth != NULL);
19055         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
19056         CHECK(calls->sign_tx_meth != NULL);
19057
19058         LDKWalletSource ret = {
19059                 .this_arg = (void*) calls,
19060                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
19061                 .get_change_script = get_change_script_LDKWalletSource_jcall,
19062                 .sign_tx = sign_tx_LDKWalletSource_jcall,
19063                 .free = LDKWalletSource_JCalls_free,
19064         };
19065         return ret;
19066 }
19067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
19068         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
19069         *res_ptr = LDKWalletSource_init(env, clz, o);
19070         return tag_ptr(res_ptr, true);
19071 }
19072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
19073         void* this_arg_ptr = untag_ptr(this_arg);
19074         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19075         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
19076         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19077         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
19078         return tag_ptr(ret_conv, true);
19079 }
19080
19081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
19082         void* this_arg_ptr = untag_ptr(this_arg);
19083         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19084         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
19085         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
19086         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
19087         return tag_ptr(ret_conv, true);
19088 }
19089
19090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
19091         void* this_arg_ptr = untag_ptr(this_arg);
19092         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19093         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
19094         LDKTransaction tx_ref;
19095         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
19096         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
19097         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
19098         tx_ref.data_is_owned = true;
19099         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19100         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
19101         return tag_ptr(ret_conv, true);
19102 }
19103
19104 static jclass LDKGossipSync_P2P_class = NULL;
19105 static jmethodID LDKGossipSync_P2P_meth = NULL;
19106 static jclass LDKGossipSync_Rapid_class = NULL;
19107 static jmethodID LDKGossipSync_Rapid_meth = NULL;
19108 static jclass LDKGossipSync_None_class = NULL;
19109 static jmethodID LDKGossipSync_None_meth = NULL;
19110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
19111         LDKGossipSync_P2P_class =
19112                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
19113         CHECK(LDKGossipSync_P2P_class != NULL);
19114         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
19115         CHECK(LDKGossipSync_P2P_meth != NULL);
19116         LDKGossipSync_Rapid_class =
19117                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
19118         CHECK(LDKGossipSync_Rapid_class != NULL);
19119         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
19120         CHECK(LDKGossipSync_Rapid_meth != NULL);
19121         LDKGossipSync_None_class =
19122                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
19123         CHECK(LDKGossipSync_None_class != NULL);
19124         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
19125         CHECK(LDKGossipSync_None_meth != NULL);
19126 }
19127 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19128         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
19129         switch(obj->tag) {
19130                 case LDKGossipSync_P2P: {
19131                         LDKP2PGossipSync p2p_var = obj->p2p;
19132                         int64_t p2p_ref = 0;
19133                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
19134                         p2p_ref = tag_ptr(p2p_var.inner, false);
19135                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
19136                 }
19137                 case LDKGossipSync_Rapid: {
19138                         LDKRapidGossipSync rapid_var = obj->rapid;
19139                         int64_t rapid_ref = 0;
19140                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
19141                         rapid_ref = tag_ptr(rapid_var.inner, false);
19142                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
19143                 }
19144                 case LDKGossipSync_None: {
19145                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
19146                 }
19147                 default: abort();
19148         }
19149 }
19150 static jclass LDKFallback_SegWitProgram_class = NULL;
19151 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
19152 static jclass LDKFallback_PubKeyHash_class = NULL;
19153 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
19154 static jclass LDKFallback_ScriptHash_class = NULL;
19155 static jmethodID LDKFallback_ScriptHash_meth = NULL;
19156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
19157         LDKFallback_SegWitProgram_class =
19158                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
19159         CHECK(LDKFallback_SegWitProgram_class != NULL);
19160         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
19161         CHECK(LDKFallback_SegWitProgram_meth != NULL);
19162         LDKFallback_PubKeyHash_class =
19163                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
19164         CHECK(LDKFallback_PubKeyHash_class != NULL);
19165         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
19166         CHECK(LDKFallback_PubKeyHash_meth != NULL);
19167         LDKFallback_ScriptHash_class =
19168                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
19169         CHECK(LDKFallback_ScriptHash_class != NULL);
19170         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
19171         CHECK(LDKFallback_ScriptHash_meth != NULL);
19172 }
19173 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19174         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
19175         switch(obj->tag) {
19176                 case LDKFallback_SegWitProgram: {
19177                         uint8_t version_val = obj->seg_wit_program.version._0;
19178                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
19179                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
19180                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
19181                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
19182                 }
19183                 case LDKFallback_PubKeyHash: {
19184                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
19185                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
19186                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
19187                 }
19188                 case LDKFallback_ScriptHash: {
19189                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
19190                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
19191                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
19192                 }
19193                 default: abort();
19194         }
19195 }
19196 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
19197         LDKStr ret_str = _ldk_get_compiled_version();
19198         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19199         Str_free(ret_str);
19200         return ret_conv;
19201 }
19202
19203 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
19204         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
19205         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19206         Str_free(ret_str);
19207         return ret_conv;
19208 }
19209
19210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
19211         LDKU128 val_ref;
19212         CHECK((*env)->GetArrayLength(env, val) == 16);
19213         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
19214         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
19215         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
19216         return ret_arr;
19217 }
19218
19219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
19220         LDKSixteenBytes le_bytes_ref;
19221         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
19222         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
19223         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
19224         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
19225         return ret_arr;
19226 }
19227
19228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
19229         LDKThirtyTwoBytes big_endian_bytes_ref;
19230         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
19231         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
19232         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
19233         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
19234         return tag_ptr(ret_ref, true);
19235 }
19236
19237 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
19238         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
19239         *ret_copy = Bech32Error_clone(arg);
19240         int64_t ret_ref = tag_ptr(ret_copy, true);
19241         return ret_ref;
19242 }
19243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19244         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
19245         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
19246         return ret_conv;
19247 }
19248
19249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19250         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
19251         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
19252         *ret_copy = Bech32Error_clone(orig_conv);
19253         int64_t ret_ref = tag_ptr(ret_copy, true);
19254         return ret_ref;
19255 }
19256
19257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
19258         if (!ptr_is_owned(o)) return;
19259         void* o_ptr = untag_ptr(o);
19260         CHECK_ACCESS(o_ptr);
19261         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
19262         FREE(untag_ptr(o));
19263         Bech32Error_free(o_conv);
19264 }
19265
19266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
19267         LDKTransaction _res_ref;
19268         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
19269         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
19270         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
19271         _res_ref.data_is_owned = true;
19272         Transaction_free(_res_ref);
19273 }
19274
19275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
19276         LDKWitness _res_ref;
19277         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
19278         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
19279         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
19280         _res_ref.data_is_owned = true;
19281         Witness_free(_res_ref);
19282 }
19283
19284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
19285         if (!ptr_is_owned(_res)) return;
19286         void* _res_ptr = untag_ptr(_res);
19287         CHECK_ACCESS(_res_ptr);
19288         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
19289         FREE(untag_ptr(_res));
19290         TxIn_free(_res_conv);
19291 }
19292
19293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxIn_1new(JNIEnv *env, jclass clz, int8_tArray witness, int8_tArray script_sig, int32_t sequence, int8_tArray previous_txid, int32_t previous_vout) {
19294         LDKWitness witness_ref;
19295         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
19296         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
19297         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
19298         witness_ref.data_is_owned = true;
19299         LDKCVec_u8Z script_sig_ref;
19300         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
19301         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
19302         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
19303         LDKThirtyTwoBytes previous_txid_ref;
19304         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
19305         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
19306         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
19307         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
19308         return tag_ptr(ret_ref, true);
19309 }
19310
19311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
19312         LDKCVec_u8Z script_pubkey_ref;
19313         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
19314         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
19315         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
19316         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
19317         *ret_ref = TxOut_new(script_pubkey_ref, value);
19318         return tag_ptr(ret_ref, true);
19319 }
19320
19321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
19322         if (!ptr_is_owned(_res)) return;
19323         void* _res_ptr = untag_ptr(_res);
19324         CHECK_ACCESS(_res_ptr);
19325         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
19326         FREE(untag_ptr(_res));
19327         TxOut_free(_res_conv);
19328 }
19329
19330 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
19331         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
19332         *ret_ref = TxOut_clone(arg);
19333         return tag_ptr(ret_ref, true);
19334 }
19335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19336         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
19337         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
19338         return ret_conv;
19339 }
19340
19341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19342         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
19343         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
19344         *ret_ref = TxOut_clone(orig_conv);
19345         return tag_ptr(ret_ref, true);
19346 }
19347
19348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
19349         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
19350         Str_free(dummy);
19351 }
19352
19353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19354         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
19355         *ret_copy = COption_DurationZ_some(o);
19356         int64_t ret_ref = tag_ptr(ret_copy, true);
19357         return ret_ref;
19358 }
19359
19360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1none(JNIEnv *env, jclass clz) {
19361         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
19362         *ret_copy = COption_DurationZ_none();
19363         int64_t ret_ref = tag_ptr(ret_copy, true);
19364         return ret_ref;
19365 }
19366
19367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19368         if (!ptr_is_owned(_res)) return;
19369         void* _res_ptr = untag_ptr(_res);
19370         CHECK_ACCESS(_res_ptr);
19371         LDKCOption_DurationZ _res_conv = *(LDKCOption_DurationZ*)(_res_ptr);
19372         FREE(untag_ptr(_res));
19373         COption_DurationZ_free(_res_conv);
19374 }
19375
19376 static inline uint64_t COption_DurationZ_clone_ptr(LDKCOption_DurationZ *NONNULL_PTR arg) {
19377         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
19378         *ret_copy = COption_DurationZ_clone(arg);
19379         int64_t ret_ref = tag_ptr(ret_copy, true);
19380         return ret_ref;
19381 }
19382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19383         LDKCOption_DurationZ* arg_conv = (LDKCOption_DurationZ*)untag_ptr(arg);
19384         int64_t ret_conv = COption_DurationZ_clone_ptr(arg_conv);
19385         return ret_conv;
19386 }
19387
19388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19389         LDKCOption_DurationZ* orig_conv = (LDKCOption_DurationZ*)untag_ptr(orig);
19390         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
19391         *ret_copy = COption_DurationZ_clone(orig_conv);
19392         int64_t ret_ref = tag_ptr(ret_copy, true);
19393         return ret_ref;
19394 }
19395
19396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19397         LDKCVec_BlindedPathZ _res_constr;
19398         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19399         if (_res_constr.datalen > 0)
19400                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
19401         else
19402                 _res_constr.data = NULL;
19403         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19404         for (size_t n = 0; n < _res_constr.datalen; n++) {
19405                 int64_t _res_conv_13 = _res_vals[n];
19406                 LDKBlindedPath _res_conv_13_conv;
19407                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
19408                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
19409                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
19410                 _res_constr.data[n] = _res_conv_13_conv;
19411         }
19412         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19413         CVec_BlindedPathZ_free(_res_constr);
19414 }
19415
19416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
19417         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19418         *ret_copy = COption_u64Z_some(o);
19419         int64_t ret_ref = tag_ptr(ret_copy, true);
19420         return ret_ref;
19421 }
19422
19423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
19424         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19425         *ret_copy = COption_u64Z_none();
19426         int64_t ret_ref = tag_ptr(ret_copy, true);
19427         return ret_ref;
19428 }
19429
19430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
19431         if (!ptr_is_owned(_res)) return;
19432         void* _res_ptr = untag_ptr(_res);
19433         CHECK_ACCESS(_res_ptr);
19434         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
19435         FREE(untag_ptr(_res));
19436         COption_u64Z_free(_res_conv);
19437 }
19438
19439 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
19440         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19441         *ret_copy = COption_u64Z_clone(arg);
19442         int64_t ret_ref = tag_ptr(ret_copy, true);
19443         return ret_ref;
19444 }
19445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19446         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
19447         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
19448         return ret_conv;
19449 }
19450
19451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19452         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
19453         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19454         *ret_copy = COption_u64Z_clone(orig_conv);
19455         int64_t ret_ref = tag_ptr(ret_copy, true);
19456         return ret_ref;
19457 }
19458
19459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19460         LDKRefund o_conv;
19461         o_conv.inner = untag_ptr(o);
19462         o_conv.is_owned = ptr_is_owned(o);
19463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19464         o_conv = Refund_clone(&o_conv);
19465         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
19466         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
19467         return tag_ptr(ret_conv, true);
19468 }
19469
19470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19471         LDKBolt12ParseError e_conv;
19472         e_conv.inner = untag_ptr(e);
19473         e_conv.is_owned = ptr_is_owned(e);
19474         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19475         e_conv = Bolt12ParseError_clone(&e_conv);
19476         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
19477         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
19478         return tag_ptr(ret_conv, true);
19479 }
19480
19481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19482         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
19483         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
19484         return ret_conv;
19485 }
19486
19487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19488         if (!ptr_is_owned(_res)) return;
19489         void* _res_ptr = untag_ptr(_res);
19490         CHECK_ACCESS(_res_ptr);
19491         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
19492         FREE(untag_ptr(_res));
19493         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
19494 }
19495
19496 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
19497         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
19498         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
19499         return tag_ptr(ret_conv, true);
19500 }
19501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19502         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
19503         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
19504         return ret_conv;
19505 }
19506
19507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19508         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
19509         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
19510         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
19511         return tag_ptr(ret_conv, true);
19512 }
19513
19514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
19515         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19516         *ret_conv = CResult_NoneAPIErrorZ_ok();
19517         return tag_ptr(ret_conv, true);
19518 }
19519
19520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19521         void* e_ptr = untag_ptr(e);
19522         CHECK_ACCESS(e_ptr);
19523         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19524         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
19525         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19526         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
19527         return tag_ptr(ret_conv, true);
19528 }
19529
19530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19531         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
19532         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
19533         return ret_conv;
19534 }
19535
19536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19537         if (!ptr_is_owned(_res)) return;
19538         void* _res_ptr = untag_ptr(_res);
19539         CHECK_ACCESS(_res_ptr);
19540         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
19541         FREE(untag_ptr(_res));
19542         CResult_NoneAPIErrorZ_free(_res_conv);
19543 }
19544
19545 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
19546         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19547         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
19548         return tag_ptr(ret_conv, true);
19549 }
19550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19551         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
19552         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
19553         return ret_conv;
19554 }
19555
19556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19557         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
19558         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19559         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
19560         return tag_ptr(ret_conv, true);
19561 }
19562
19563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19564         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
19565         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19566         if (_res_constr.datalen > 0)
19567                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19568         else
19569                 _res_constr.data = NULL;
19570         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19571         for (size_t w = 0; w < _res_constr.datalen; w++) {
19572                 int64_t _res_conv_22 = _res_vals[w];
19573                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
19574                 CHECK_ACCESS(_res_conv_22_ptr);
19575                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
19576                 FREE(untag_ptr(_res_conv_22));
19577                 _res_constr.data[w] = _res_conv_22_conv;
19578         }
19579         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19580         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
19581 }
19582
19583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19584         LDKCVec_APIErrorZ _res_constr;
19585         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19586         if (_res_constr.datalen > 0)
19587                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
19588         else
19589                 _res_constr.data = NULL;
19590         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19591         for (size_t k = 0; k < _res_constr.datalen; k++) {
19592                 int64_t _res_conv_10 = _res_vals[k];
19593                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
19594                 CHECK_ACCESS(_res_conv_10_ptr);
19595                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
19596                 FREE(untag_ptr(_res_conv_10));
19597                 _res_constr.data[k] = _res_conv_10_conv;
19598         }
19599         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19600         CVec_APIErrorZ_free(_res_constr);
19601 }
19602
19603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
19604         LDKThirtyTwoBytes o_ref;
19605         CHECK((*env)->GetArrayLength(env, o) == 32);
19606         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19607         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
19608         *ret_copy = COption_PaymentSecretZ_some(o_ref);
19609         int64_t ret_ref = tag_ptr(ret_copy, true);
19610         return ret_ref;
19611 }
19612
19613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1none(JNIEnv *env, jclass clz) {
19614         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
19615         *ret_copy = COption_PaymentSecretZ_none();
19616         int64_t ret_ref = tag_ptr(ret_copy, true);
19617         return ret_ref;
19618 }
19619
19620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19621         if (!ptr_is_owned(_res)) return;
19622         void* _res_ptr = untag_ptr(_res);
19623         CHECK_ACCESS(_res_ptr);
19624         LDKCOption_PaymentSecretZ _res_conv = *(LDKCOption_PaymentSecretZ*)(_res_ptr);
19625         FREE(untag_ptr(_res));
19626         COption_PaymentSecretZ_free(_res_conv);
19627 }
19628
19629 static inline uint64_t COption_PaymentSecretZ_clone_ptr(LDKCOption_PaymentSecretZ *NONNULL_PTR arg) {
19630         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
19631         *ret_copy = COption_PaymentSecretZ_clone(arg);
19632         int64_t ret_ref = tag_ptr(ret_copy, true);
19633         return ret_ref;
19634 }
19635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19636         LDKCOption_PaymentSecretZ* arg_conv = (LDKCOption_PaymentSecretZ*)untag_ptr(arg);
19637         int64_t ret_conv = COption_PaymentSecretZ_clone_ptr(arg_conv);
19638         return ret_conv;
19639 }
19640
19641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19642         LDKCOption_PaymentSecretZ* orig_conv = (LDKCOption_PaymentSecretZ*)untag_ptr(orig);
19643         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
19644         *ret_copy = COption_PaymentSecretZ_clone(orig_conv);
19645         int64_t ret_ref = tag_ptr(ret_copy, true);
19646         return ret_ref;
19647 }
19648
19649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
19650         LDKCVec_u8Z _res_ref;
19651         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
19652         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
19653         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
19654         CVec_u8Z_free(_res_ref);
19655 }
19656
19657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
19658         LDKCVec_u8Z o_ref;
19659         o_ref.datalen = (*env)->GetArrayLength(env, o);
19660         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19661         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
19662         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
19663         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
19664         int64_t ret_ref = tag_ptr(ret_copy, true);
19665         return ret_ref;
19666 }
19667
19668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
19669         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
19670         *ret_copy = COption_CVec_u8ZZ_none();
19671         int64_t ret_ref = tag_ptr(ret_copy, true);
19672         return ret_ref;
19673 }
19674
19675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19676         if (!ptr_is_owned(_res)) return;
19677         void* _res_ptr = untag_ptr(_res);
19678         CHECK_ACCESS(_res_ptr);
19679         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
19680         FREE(untag_ptr(_res));
19681         COption_CVec_u8ZZ_free(_res_conv);
19682 }
19683
19684 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
19685         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
19686         *ret_copy = COption_CVec_u8ZZ_clone(arg);
19687         int64_t ret_ref = tag_ptr(ret_copy, true);
19688         return ret_ref;
19689 }
19690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19691         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
19692         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
19693         return ret_conv;
19694 }
19695
19696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19697         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
19698         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
19699         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
19700         int64_t ret_ref = tag_ptr(ret_copy, true);
19701         return ret_ref;
19702 }
19703
19704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19705         LDKRecipientOnionFields o_conv;
19706         o_conv.inner = untag_ptr(o);
19707         o_conv.is_owned = ptr_is_owned(o);
19708         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19709         o_conv = RecipientOnionFields_clone(&o_conv);
19710         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19711         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
19712         return tag_ptr(ret_conv, true);
19713 }
19714
19715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19716         void* e_ptr = untag_ptr(e);
19717         CHECK_ACCESS(e_ptr);
19718         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19719         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19720         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19721         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
19722         return tag_ptr(ret_conv, true);
19723 }
19724
19725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19726         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
19727         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
19728         return ret_conv;
19729 }
19730
19731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19732         if (!ptr_is_owned(_res)) return;
19733         void* _res_ptr = untag_ptr(_res);
19734         CHECK_ACCESS(_res_ptr);
19735         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
19736         FREE(untag_ptr(_res));
19737         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
19738 }
19739
19740 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
19741         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19742         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
19743         return tag_ptr(ret_conv, true);
19744 }
19745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19746         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
19747         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
19748         return ret_conv;
19749 }
19750
19751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19752         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
19753         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19754         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
19755         return tag_ptr(ret_conv, true);
19756 }
19757
19758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19759         LDKBlindedPayInfo o_conv;
19760         o_conv.inner = untag_ptr(o);
19761         o_conv.is_owned = ptr_is_owned(o);
19762         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19763         o_conv = BlindedPayInfo_clone(&o_conv);
19764         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19765         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
19766         return tag_ptr(ret_conv, true);
19767 }
19768
19769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19770         void* e_ptr = untag_ptr(e);
19771         CHECK_ACCESS(e_ptr);
19772         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19773         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19774         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19775         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
19776         return tag_ptr(ret_conv, true);
19777 }
19778
19779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19780         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
19781         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
19782         return ret_conv;
19783 }
19784
19785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19786         if (!ptr_is_owned(_res)) return;
19787         void* _res_ptr = untag_ptr(_res);
19788         CHECK_ACCESS(_res_ptr);
19789         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
19790         FREE(untag_ptr(_res));
19791         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
19792 }
19793
19794 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
19795         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19796         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
19797         return tag_ptr(ret_conv, true);
19798 }
19799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19800         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
19801         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
19802         return ret_conv;
19803 }
19804
19805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19806         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
19807         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19808         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
19809         return tag_ptr(ret_conv, true);
19810 }
19811
19812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19813         LDKDelayedPaymentOutputDescriptor o_conv;
19814         o_conv.inner = untag_ptr(o);
19815         o_conv.is_owned = ptr_is_owned(o);
19816         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19817         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
19818         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19819         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19820         return tag_ptr(ret_conv, true);
19821 }
19822
19823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19824         void* e_ptr = untag_ptr(e);
19825         CHECK_ACCESS(e_ptr);
19826         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19827         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19828         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19829         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19830         return tag_ptr(ret_conv, true);
19831 }
19832
19833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19834         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19835         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19836         return ret_conv;
19837 }
19838
19839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19840         if (!ptr_is_owned(_res)) return;
19841         void* _res_ptr = untag_ptr(_res);
19842         CHECK_ACCESS(_res_ptr);
19843         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19844         FREE(untag_ptr(_res));
19845         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19846 }
19847
19848 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19849         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19850         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19851         return tag_ptr(ret_conv, true);
19852 }
19853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19854         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19855         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19856         return ret_conv;
19857 }
19858
19859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19860         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19861         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19862         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19863         return tag_ptr(ret_conv, true);
19864 }
19865
19866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19867         LDKStaticPaymentOutputDescriptor o_conv;
19868         o_conv.inner = untag_ptr(o);
19869         o_conv.is_owned = ptr_is_owned(o);
19870         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19871         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
19872         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19873         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19874         return tag_ptr(ret_conv, true);
19875 }
19876
19877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19878         void* e_ptr = untag_ptr(e);
19879         CHECK_ACCESS(e_ptr);
19880         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19881         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19882         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19883         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19884         return tag_ptr(ret_conv, true);
19885 }
19886
19887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19888         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19889         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19890         return ret_conv;
19891 }
19892
19893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19894         if (!ptr_is_owned(_res)) return;
19895         void* _res_ptr = untag_ptr(_res);
19896         CHECK_ACCESS(_res_ptr);
19897         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19898         FREE(untag_ptr(_res));
19899         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19900 }
19901
19902 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19903         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19904         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19905         return tag_ptr(ret_conv, true);
19906 }
19907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19908         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19909         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19910         return ret_conv;
19911 }
19912
19913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19914         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19915         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19916         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19917         return tag_ptr(ret_conv, true);
19918 }
19919
19920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19921         void* o_ptr = untag_ptr(o);
19922         CHECK_ACCESS(o_ptr);
19923         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
19924         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
19925         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19926         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
19927         return tag_ptr(ret_conv, true);
19928 }
19929
19930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19931         void* e_ptr = untag_ptr(e);
19932         CHECK_ACCESS(e_ptr);
19933         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19934         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19935         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19936         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
19937         return tag_ptr(ret_conv, true);
19938 }
19939
19940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19941         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19942         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19943         return ret_conv;
19944 }
19945
19946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19947         if (!ptr_is_owned(_res)) return;
19948         void* _res_ptr = untag_ptr(_res);
19949         CHECK_ACCESS(_res_ptr);
19950         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
19951         FREE(untag_ptr(_res));
19952         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
19953 }
19954
19955 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19956         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19957         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
19958         return tag_ptr(ret_conv, true);
19959 }
19960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19961         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19962         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19963         return ret_conv;
19964 }
19965
19966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19967         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19968         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19969         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
19970         return tag_ptr(ret_conv, true);
19971 }
19972
19973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19974         LDKCVec_SpendableOutputDescriptorZ _res_constr;
19975         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19976         if (_res_constr.datalen > 0)
19977                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19978         else
19979                 _res_constr.data = NULL;
19980         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19981         for (size_t b = 0; b < _res_constr.datalen; b++) {
19982                 int64_t _res_conv_27 = _res_vals[b];
19983                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
19984                 CHECK_ACCESS(_res_conv_27_ptr);
19985                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
19986                 FREE(untag_ptr(_res_conv_27));
19987                 _res_constr.data[b] = _res_conv_27_conv;
19988         }
19989         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19990         CVec_SpendableOutputDescriptorZ_free(_res_constr);
19991 }
19992
19993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19994         LDKCVec_TxOutZ _res_constr;
19995         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19996         if (_res_constr.datalen > 0)
19997                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19998         else
19999                 _res_constr.data = NULL;
20000         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20001         for (size_t h = 0; h < _res_constr.datalen; h++) {
20002                 int64_t _res_conv_7 = _res_vals[h];
20003                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
20004                 CHECK_ACCESS(_res_conv_7_ptr);
20005                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
20006                 FREE(untag_ptr(_res_conv_7));
20007                 _res_constr.data[h] = _res_conv_7_conv;
20008         }
20009         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20010         CVec_TxOutZ_free(_res_constr);
20011 }
20012
20013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1some(JNIEnv *env, jclass clz, int32_t o) {
20014         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
20015         *ret_copy = COption_PackedLockTimeZ_some(o);
20016         int64_t ret_ref = tag_ptr(ret_copy, true);
20017         return ret_ref;
20018 }
20019
20020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1none(JNIEnv *env, jclass clz) {
20021         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
20022         *ret_copy = COption_PackedLockTimeZ_none();
20023         int64_t ret_ref = tag_ptr(ret_copy, true);
20024         return ret_ref;
20025 }
20026
20027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20028         if (!ptr_is_owned(_res)) return;
20029         void* _res_ptr = untag_ptr(_res);
20030         CHECK_ACCESS(_res_ptr);
20031         LDKCOption_PackedLockTimeZ _res_conv = *(LDKCOption_PackedLockTimeZ*)(_res_ptr);
20032         FREE(untag_ptr(_res));
20033         COption_PackedLockTimeZ_free(_res_conv);
20034 }
20035
20036 static inline uint64_t COption_PackedLockTimeZ_clone_ptr(LDKCOption_PackedLockTimeZ *NONNULL_PTR arg) {
20037         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
20038         *ret_copy = COption_PackedLockTimeZ_clone(arg);
20039         int64_t ret_ref = tag_ptr(ret_copy, true);
20040         return ret_ref;
20041 }
20042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20043         LDKCOption_PackedLockTimeZ* arg_conv = (LDKCOption_PackedLockTimeZ*)untag_ptr(arg);
20044         int64_t ret_conv = COption_PackedLockTimeZ_clone_ptr(arg_conv);
20045         return ret_conv;
20046 }
20047
20048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20049         LDKCOption_PackedLockTimeZ* orig_conv = (LDKCOption_PackedLockTimeZ*)untag_ptr(orig);
20050         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
20051         *ret_copy = COption_PackedLockTimeZ_clone(orig_conv);
20052         int64_t ret_ref = tag_ptr(ret_copy, true);
20053         return ret_ref;
20054 }
20055
20056 static inline uint64_t C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR arg) {
20057         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
20058         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone(arg);
20059         return tag_ptr(ret_conv, true);
20060 }
20061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20062         LDKC2Tuple_PartiallySignedTransactionusizeZ* arg_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(arg);
20063         int64_t ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(arg_conv);
20064         return ret_conv;
20065 }
20066
20067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20068         LDKC2Tuple_PartiallySignedTransactionusizeZ* orig_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(orig);
20069         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
20070         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone(orig_conv);
20071         return tag_ptr(ret_conv, true);
20072 }
20073
20074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20075         LDKCVec_u8Z a_ref;
20076         a_ref.datalen = (*env)->GetArrayLength(env, a);
20077         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
20078         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
20079         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
20080         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_new(a_ref, b);
20081         return tag_ptr(ret_conv, true);
20082 }
20083
20084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20085         if (!ptr_is_owned(_res)) return;
20086         void* _res_ptr = untag_ptr(_res);
20087         CHECK_ACCESS(_res_ptr);
20088         LDKC2Tuple_PartiallySignedTransactionusizeZ _res_conv = *(LDKC2Tuple_PartiallySignedTransactionusizeZ*)(_res_ptr);
20089         FREE(untag_ptr(_res));
20090         C2Tuple_PartiallySignedTransactionusizeZ_free(_res_conv);
20091 }
20092
20093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20094         void* o_ptr = untag_ptr(o);
20095         CHECK_ACCESS(o_ptr);
20096         LDKC2Tuple_PartiallySignedTransactionusizeZ o_conv = *(LDKC2Tuple_PartiallySignedTransactionusizeZ*)(o_ptr);
20097         o_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone((LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(o));
20098         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
20099         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(o_conv);
20100         return tag_ptr(ret_conv, true);
20101 }
20102
20103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1err(JNIEnv *env, jclass clz) {
20104         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
20105         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err();
20106         return tag_ptr(ret_conv, true);
20107 }
20108
20109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20110         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(o);
20111         jboolean ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(o_conv);
20112         return ret_conv;
20113 }
20114
20115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20116         if (!ptr_is_owned(_res)) return;
20117         void* _res_ptr = untag_ptr(_res);
20118         CHECK_ACCESS(_res_ptr);
20119         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)(_res_ptr);
20120         FREE(untag_ptr(_res));
20121         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(_res_conv);
20122 }
20123
20124 static inline uint64_t CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR arg) {
20125         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
20126         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(arg);
20127         return tag_ptr(ret_conv, true);
20128 }
20129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20130         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(arg);
20131         int64_t ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(arg_conv);
20132         return ret_conv;
20133 }
20134
20135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20136         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(orig);
20137         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
20138         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(orig_conv);
20139         return tag_ptr(ret_conv, true);
20140 }
20141
20142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20143         LDKCVec_PaymentPreimageZ _res_constr;
20144         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20145         if (_res_constr.datalen > 0)
20146                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
20147         else
20148                 _res_constr.data = NULL;
20149         for (size_t i = 0; i < _res_constr.datalen; i++) {
20150                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20151                 LDKThirtyTwoBytes _res_conv_8_ref;
20152                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
20153                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
20154                 _res_constr.data[i] = _res_conv_8_ref;
20155         }
20156         CVec_PaymentPreimageZ_free(_res_constr);
20157 }
20158
20159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
20160         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20161         *ret_conv = CResult_NoneNoneZ_ok();
20162         return tag_ptr(ret_conv, true);
20163 }
20164
20165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
20166         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20167         *ret_conv = CResult_NoneNoneZ_err();
20168         return tag_ptr(ret_conv, true);
20169 }
20170
20171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20172         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
20173         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
20174         return ret_conv;
20175 }
20176
20177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20178         if (!ptr_is_owned(_res)) return;
20179         void* _res_ptr = untag_ptr(_res);
20180         CHECK_ACCESS(_res_ptr);
20181         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
20182         FREE(untag_ptr(_res));
20183         CResult_NoneNoneZ_free(_res_conv);
20184 }
20185
20186 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
20187         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20188         *ret_conv = CResult_NoneNoneZ_clone(arg);
20189         return tag_ptr(ret_conv, true);
20190 }
20191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20192         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
20193         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
20194         return ret_conv;
20195 }
20196
20197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20198         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
20199         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20200         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
20201         return tag_ptr(ret_conv, true);
20202 }
20203
20204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20205         LDKCVec_SignatureZ _res_constr;
20206         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20207         if (_res_constr.datalen > 0)
20208                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20209         else
20210                 _res_constr.data = NULL;
20211         for (size_t i = 0; i < _res_constr.datalen; i++) {
20212                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20213                 LDKSignature _res_conv_8_ref;
20214                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
20215                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
20216                 _res_constr.data[i] = _res_conv_8_ref;
20217         }
20218         CVec_SignatureZ_free(_res_constr);
20219 }
20220
20221 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
20222         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
20223         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
20224         return tag_ptr(ret_conv, true);
20225 }
20226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20227         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
20228         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
20229         return ret_conv;
20230 }
20231
20232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20233         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
20234         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
20235         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
20236         return tag_ptr(ret_conv, true);
20237 }
20238
20239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
20240         LDKSignature a_ref;
20241         CHECK((*env)->GetArrayLength(env, a) == 64);
20242         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
20243         LDKCVec_SignatureZ b_constr;
20244         b_constr.datalen = (*env)->GetArrayLength(env, b);
20245         if (b_constr.datalen > 0)
20246                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20247         else
20248                 b_constr.data = NULL;
20249         for (size_t i = 0; i < b_constr.datalen; i++) {
20250                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
20251                 LDKSignature b_conv_8_ref;
20252                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
20253                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
20254                 b_constr.data[i] = b_conv_8_ref;
20255         }
20256         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
20257         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
20258         return tag_ptr(ret_conv, true);
20259 }
20260
20261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20262         if (!ptr_is_owned(_res)) return;
20263         void* _res_ptr = untag_ptr(_res);
20264         CHECK_ACCESS(_res_ptr);
20265         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
20266         FREE(untag_ptr(_res));
20267         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
20268 }
20269
20270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20271         void* o_ptr = untag_ptr(o);
20272         CHECK_ACCESS(o_ptr);
20273         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
20274         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
20275         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20276         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
20277         return tag_ptr(ret_conv, true);
20278 }
20279
20280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
20281         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20282         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
20283         return tag_ptr(ret_conv, true);
20284 }
20285
20286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20287         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
20288         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
20289         return ret_conv;
20290 }
20291
20292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20293         if (!ptr_is_owned(_res)) return;
20294         void* _res_ptr = untag_ptr(_res);
20295         CHECK_ACCESS(_res_ptr);
20296         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
20297         FREE(untag_ptr(_res));
20298         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
20299 }
20300
20301 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
20302         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20303         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
20304         return tag_ptr(ret_conv, true);
20305 }
20306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20307         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
20308         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
20309         return ret_conv;
20310 }
20311
20312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20313         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
20314         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20315         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
20316         return tag_ptr(ret_conv, true);
20317 }
20318
20319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20320         LDKSignature o_ref;
20321         CHECK((*env)->GetArrayLength(env, o) == 64);
20322         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
20323         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20324         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
20325         return tag_ptr(ret_conv, true);
20326 }
20327
20328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
20329         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20330         *ret_conv = CResult_SignatureNoneZ_err();
20331         return tag_ptr(ret_conv, true);
20332 }
20333
20334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20335         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
20336         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
20337         return ret_conv;
20338 }
20339
20340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20341         if (!ptr_is_owned(_res)) return;
20342         void* _res_ptr = untag_ptr(_res);
20343         CHECK_ACCESS(_res_ptr);
20344         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
20345         FREE(untag_ptr(_res));
20346         CResult_SignatureNoneZ_free(_res_conv);
20347 }
20348
20349 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
20350         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20351         *ret_conv = CResult_SignatureNoneZ_clone(arg);
20352         return tag_ptr(ret_conv, true);
20353 }
20354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20355         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
20356         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
20357         return ret_conv;
20358 }
20359
20360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20361         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
20362         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20363         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
20364         return tag_ptr(ret_conv, true);
20365 }
20366
20367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20368         LDKPublicKey o_ref;
20369         CHECK((*env)->GetArrayLength(env, o) == 33);
20370         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
20371         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20372         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
20373         return tag_ptr(ret_conv, true);
20374 }
20375
20376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
20377         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20378         *ret_conv = CResult_PublicKeyNoneZ_err();
20379         return tag_ptr(ret_conv, true);
20380 }
20381
20382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20383         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
20384         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
20385         return ret_conv;
20386 }
20387
20388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20389         if (!ptr_is_owned(_res)) return;
20390         void* _res_ptr = untag_ptr(_res);
20391         CHECK_ACCESS(_res_ptr);
20392         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
20393         FREE(untag_ptr(_res));
20394         CResult_PublicKeyNoneZ_free(_res_conv);
20395 }
20396
20397 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
20398         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20399         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
20400         return tag_ptr(ret_conv, true);
20401 }
20402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20403         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
20404         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
20405         return ret_conv;
20406 }
20407
20408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20409         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
20410         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20411         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
20412         return tag_ptr(ret_conv, true);
20413 }
20414
20415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20416         void* o_ptr = untag_ptr(o);
20417         CHECK_ACCESS(o_ptr);
20418         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
20419         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
20420         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20421         *ret_copy = COption_ScalarZ_some(o_conv);
20422         int64_t ret_ref = tag_ptr(ret_copy, true);
20423         return ret_ref;
20424 }
20425
20426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1none(JNIEnv *env, jclass clz) {
20427         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20428         *ret_copy = COption_ScalarZ_none();
20429         int64_t ret_ref = tag_ptr(ret_copy, true);
20430         return ret_ref;
20431 }
20432
20433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20434         if (!ptr_is_owned(_res)) return;
20435         void* _res_ptr = untag_ptr(_res);
20436         CHECK_ACCESS(_res_ptr);
20437         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
20438         FREE(untag_ptr(_res));
20439         COption_ScalarZ_free(_res_conv);
20440 }
20441
20442 static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) {
20443         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20444         *ret_copy = COption_ScalarZ_clone(arg);
20445         int64_t ret_ref = tag_ptr(ret_copy, true);
20446         return ret_ref;
20447 }
20448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20449         LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg);
20450         int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv);
20451         return ret_conv;
20452 }
20453
20454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20455         LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig);
20456         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20457         *ret_copy = COption_ScalarZ_clone(orig_conv);
20458         int64_t ret_ref = tag_ptr(ret_copy, true);
20459         return ret_ref;
20460 }
20461
20462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20463         LDKThirtyTwoBytes o_ref;
20464         CHECK((*env)->GetArrayLength(env, o) == 32);
20465         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20466         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20467         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
20468         return tag_ptr(ret_conv, true);
20469 }
20470
20471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1err(JNIEnv *env, jclass clz) {
20472         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20473         *ret_conv = CResult_SharedSecretNoneZ_err();
20474         return tag_ptr(ret_conv, true);
20475 }
20476
20477 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20478         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
20479         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
20480         return ret_conv;
20481 }
20482
20483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20484         if (!ptr_is_owned(_res)) return;
20485         void* _res_ptr = untag_ptr(_res);
20486         CHECK_ACCESS(_res_ptr);
20487         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
20488         FREE(untag_ptr(_res));
20489         CResult_SharedSecretNoneZ_free(_res_conv);
20490 }
20491
20492 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
20493         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20494         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
20495         return tag_ptr(ret_conv, true);
20496 }
20497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20498         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
20499         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
20500         return ret_conv;
20501 }
20502
20503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20504         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
20505         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20506         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
20507         return tag_ptr(ret_conv, true);
20508 }
20509
20510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20511         LDKCVec_U5Z _res_constr;
20512         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20513         if (_res_constr.datalen > 0)
20514                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
20515         else
20516                 _res_constr.data = NULL;
20517         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
20518         for (size_t h = 0; h < _res_constr.datalen; h++) {
20519                 int8_t _res_conv_7 = _res_vals[h];
20520                 
20521                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
20522         }
20523         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
20524         CVec_U5Z_free(_res_constr);
20525 }
20526
20527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20528         LDKRecoverableSignature o_ref;
20529         CHECK((*env)->GetArrayLength(env, o) == 68);
20530         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
20531         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20532         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
20533         return tag_ptr(ret_conv, true);
20534 }
20535
20536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
20537         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20538         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
20539         return tag_ptr(ret_conv, true);
20540 }
20541
20542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20543         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
20544         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
20545         return ret_conv;
20546 }
20547
20548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20549         if (!ptr_is_owned(_res)) return;
20550         void* _res_ptr = untag_ptr(_res);
20551         CHECK_ACCESS(_res_ptr);
20552         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
20553         FREE(untag_ptr(_res));
20554         CResult_RecoverableSignatureNoneZ_free(_res_conv);
20555 }
20556
20557 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
20558         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20559         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
20560         return tag_ptr(ret_conv, true);
20561 }
20562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20563         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
20564         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
20565         return ret_conv;
20566 }
20567
20568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20569         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
20570         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20571         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
20572         return tag_ptr(ret_conv, true);
20573 }
20574
20575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20576         void* o_ptr = untag_ptr(o);
20577         CHECK_ACCESS(o_ptr);
20578         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
20579         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
20580                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20581                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
20582         }
20583         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20584         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
20585         return tag_ptr(ret_conv, true);
20586 }
20587
20588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20589         void* e_ptr = untag_ptr(e);
20590         CHECK_ACCESS(e_ptr);
20591         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20592         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20593         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20594         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
20595         return tag_ptr(ret_conv, true);
20596 }
20597
20598 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20599         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
20600         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
20601         return ret_conv;
20602 }
20603
20604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20605         if (!ptr_is_owned(_res)) return;
20606         void* _res_ptr = untag_ptr(_res);
20607         CHECK_ACCESS(_res_ptr);
20608         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
20609         FREE(untag_ptr(_res));
20610         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
20611 }
20612
20613 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
20614         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20615         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
20616         return tag_ptr(ret_conv, true);
20617 }
20618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20619         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
20620         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
20621         return ret_conv;
20622 }
20623
20624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20625         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
20626         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20627         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
20628         return tag_ptr(ret_conv, true);
20629 }
20630
20631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20632         LDKCVec_u8Z o_ref;
20633         o_ref.datalen = (*env)->GetArrayLength(env, o);
20634         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20635         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20636         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
20637         *ret_conv = CResult_ScriptNoneZ_ok(o_ref);
20638         return tag_ptr(ret_conv, true);
20639 }
20640
20641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1err(JNIEnv *env, jclass clz) {
20642         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
20643         *ret_conv = CResult_ScriptNoneZ_err();
20644         return tag_ptr(ret_conv, true);
20645 }
20646
20647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20648         LDKCResult_ScriptNoneZ* o_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(o);
20649         jboolean ret_conv = CResult_ScriptNoneZ_is_ok(o_conv);
20650         return ret_conv;
20651 }
20652
20653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20654         if (!ptr_is_owned(_res)) return;
20655         void* _res_ptr = untag_ptr(_res);
20656         CHECK_ACCESS(_res_ptr);
20657         LDKCResult_ScriptNoneZ _res_conv = *(LDKCResult_ScriptNoneZ*)(_res_ptr);
20658         FREE(untag_ptr(_res));
20659         CResult_ScriptNoneZ_free(_res_conv);
20660 }
20661
20662 static inline uint64_t CResult_ScriptNoneZ_clone_ptr(LDKCResult_ScriptNoneZ *NONNULL_PTR arg) {
20663         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
20664         *ret_conv = CResult_ScriptNoneZ_clone(arg);
20665         return tag_ptr(ret_conv, true);
20666 }
20667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20668         LDKCResult_ScriptNoneZ* arg_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(arg);
20669         int64_t ret_conv = CResult_ScriptNoneZ_clone_ptr(arg_conv);
20670         return ret_conv;
20671 }
20672
20673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20674         LDKCResult_ScriptNoneZ* orig_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(orig);
20675         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
20676         *ret_conv = CResult_ScriptNoneZ_clone(orig_conv);
20677         return tag_ptr(ret_conv, true);
20678 }
20679
20680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20681         LDKShutdownScript o_conv;
20682         o_conv.inner = untag_ptr(o);
20683         o_conv.is_owned = ptr_is_owned(o);
20684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20685         o_conv = ShutdownScript_clone(&o_conv);
20686         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20687         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
20688         return tag_ptr(ret_conv, true);
20689 }
20690
20691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
20692         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20693         *ret_conv = CResult_ShutdownScriptNoneZ_err();
20694         return tag_ptr(ret_conv, true);
20695 }
20696
20697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20698         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
20699         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
20700         return ret_conv;
20701 }
20702
20703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20704         if (!ptr_is_owned(_res)) return;
20705         void* _res_ptr = untag_ptr(_res);
20706         CHECK_ACCESS(_res_ptr);
20707         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
20708         FREE(untag_ptr(_res));
20709         CResult_ShutdownScriptNoneZ_free(_res_conv);
20710 }
20711
20712 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
20713         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20714         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
20715         return tag_ptr(ret_conv, true);
20716 }
20717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20718         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
20719         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
20720         return ret_conv;
20721 }
20722
20723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20724         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
20725         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20726         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
20727         return tag_ptr(ret_conv, true);
20728 }
20729
20730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20731         LDKCVec_CVec_u8ZZ _res_constr;
20732         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20733         if (_res_constr.datalen > 0)
20734                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
20735         else
20736                 _res_constr.data = NULL;
20737         for (size_t i = 0; i < _res_constr.datalen; i++) {
20738                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20739                 LDKCVec_u8Z _res_conv_8_ref;
20740                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
20741                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
20742                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
20743                 _res_constr.data[i] = _res_conv_8_ref;
20744         }
20745         CVec_CVec_u8ZZ_free(_res_constr);
20746 }
20747
20748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
20749         LDKCVec_CVec_u8ZZ o_constr;
20750         o_constr.datalen = (*env)->GetArrayLength(env, o);
20751         if (o_constr.datalen > 0)
20752                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
20753         else
20754                 o_constr.data = NULL;
20755         for (size_t i = 0; i < o_constr.datalen; i++) {
20756                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
20757                 LDKCVec_u8Z o_conv_8_ref;
20758                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
20759                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
20760                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
20761                 o_constr.data[i] = o_conv_8_ref;
20762         }
20763         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20764         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
20765         return tag_ptr(ret_conv, true);
20766 }
20767
20768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
20769         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20770         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
20771         return tag_ptr(ret_conv, true);
20772 }
20773
20774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20775         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
20776         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
20777         return ret_conv;
20778 }
20779
20780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20781         if (!ptr_is_owned(_res)) return;
20782         void* _res_ptr = untag_ptr(_res);
20783         CHECK_ACCESS(_res_ptr);
20784         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
20785         FREE(untag_ptr(_res));
20786         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
20787 }
20788
20789 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
20790         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20791         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
20792         return tag_ptr(ret_conv, true);
20793 }
20794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20795         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
20796         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
20797         return ret_conv;
20798 }
20799
20800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20801         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
20802         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20803         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
20804         return tag_ptr(ret_conv, true);
20805 }
20806
20807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20808         LDKInMemorySigner o_conv;
20809         o_conv.inner = untag_ptr(o);
20810         o_conv.is_owned = ptr_is_owned(o);
20811         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20812         o_conv = InMemorySigner_clone(&o_conv);
20813         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20814         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
20815         return tag_ptr(ret_conv, true);
20816 }
20817
20818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20819         void* e_ptr = untag_ptr(e);
20820         CHECK_ACCESS(e_ptr);
20821         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20822         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20823         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20824         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
20825         return tag_ptr(ret_conv, true);
20826 }
20827
20828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20829         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
20830         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
20831         return ret_conv;
20832 }
20833
20834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20835         if (!ptr_is_owned(_res)) return;
20836         void* _res_ptr = untag_ptr(_res);
20837         CHECK_ACCESS(_res_ptr);
20838         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
20839         FREE(untag_ptr(_res));
20840         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
20841 }
20842
20843 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
20844         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20845         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
20846         return tag_ptr(ret_conv, true);
20847 }
20848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20849         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
20850         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
20851         return ret_conv;
20852 }
20853
20854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20855         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
20856         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20857         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
20858         return tag_ptr(ret_conv, true);
20859 }
20860
20861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20862         LDKCVec_u8Z o_ref;
20863         o_ref.datalen = (*env)->GetArrayLength(env, o);
20864         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20865         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20866         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
20867         *ret_conv = CResult_PartiallySignedTransactionNoneZ_ok(o_ref);
20868         return tag_ptr(ret_conv, true);
20869 }
20870
20871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
20872         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
20873         *ret_conv = CResult_PartiallySignedTransactionNoneZ_err();
20874         return tag_ptr(ret_conv, true);
20875 }
20876
20877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20878         LDKCResult_PartiallySignedTransactionNoneZ* o_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(o);
20879         jboolean ret_conv = CResult_PartiallySignedTransactionNoneZ_is_ok(o_conv);
20880         return ret_conv;
20881 }
20882
20883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20884         if (!ptr_is_owned(_res)) return;
20885         void* _res_ptr = untag_ptr(_res);
20886         CHECK_ACCESS(_res_ptr);
20887         LDKCResult_PartiallySignedTransactionNoneZ _res_conv = *(LDKCResult_PartiallySignedTransactionNoneZ*)(_res_ptr);
20888         FREE(untag_ptr(_res));
20889         CResult_PartiallySignedTransactionNoneZ_free(_res_conv);
20890 }
20891
20892 static inline uint64_t CResult_PartiallySignedTransactionNoneZ_clone_ptr(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR arg) {
20893         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
20894         *ret_conv = CResult_PartiallySignedTransactionNoneZ_clone(arg);
20895         return tag_ptr(ret_conv, true);
20896 }
20897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20898         LDKCResult_PartiallySignedTransactionNoneZ* arg_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(arg);
20899         int64_t ret_conv = CResult_PartiallySignedTransactionNoneZ_clone_ptr(arg_conv);
20900         return ret_conv;
20901 }
20902
20903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20904         LDKCResult_PartiallySignedTransactionNoneZ* orig_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(orig);
20905         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
20906         *ret_conv = CResult_PartiallySignedTransactionNoneZ_clone(orig_conv);
20907         return tag_ptr(ret_conv, true);
20908 }
20909
20910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20911         LDKTransaction o_ref;
20912         o_ref.datalen = (*env)->GetArrayLength(env, o);
20913         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
20914         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20915         o_ref.data_is_owned = true;
20916         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20917         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
20918         return tag_ptr(ret_conv, true);
20919 }
20920
20921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
20922         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20923         *ret_conv = CResult_TransactionNoneZ_err();
20924         return tag_ptr(ret_conv, true);
20925 }
20926
20927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20928         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
20929         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
20930         return ret_conv;
20931 }
20932
20933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20934         if (!ptr_is_owned(_res)) return;
20935         void* _res_ptr = untag_ptr(_res);
20936         CHECK_ACCESS(_res_ptr);
20937         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
20938         FREE(untag_ptr(_res));
20939         CResult_TransactionNoneZ_free(_res_conv);
20940 }
20941
20942 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
20943         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20944         *ret_conv = CResult_TransactionNoneZ_clone(arg);
20945         return tag_ptr(ret_conv, true);
20946 }
20947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20948         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
20949         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
20950         return ret_conv;
20951 }
20952
20953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20954         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
20955         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20956         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
20957         return tag_ptr(ret_conv, true);
20958 }
20959
20960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20961         void* o_ptr = untag_ptr(o);
20962         CHECK_ACCESS(o_ptr);
20963         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
20964         if (o_conv.free == LDKWriteableScore_JCalls_free) {
20965                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20966                 LDKWriteableScore_JCalls_cloned(&o_conv);
20967         }
20968         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
20969         *ret_copy = COption_WriteableScoreZ_some(o_conv);
20970         int64_t ret_ref = tag_ptr(ret_copy, true);
20971         return ret_ref;
20972 }
20973
20974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
20975         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
20976         *ret_copy = COption_WriteableScoreZ_none();
20977         int64_t ret_ref = tag_ptr(ret_copy, true);
20978         return ret_ref;
20979 }
20980
20981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20982         if (!ptr_is_owned(_res)) return;
20983         void* _res_ptr = untag_ptr(_res);
20984         CHECK_ACCESS(_res_ptr);
20985         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
20986         FREE(untag_ptr(_res));
20987         COption_WriteableScoreZ_free(_res_conv);
20988 }
20989
20990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
20991         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
20992         *ret_conv = CResult_NoneErrorZ_ok();
20993         return tag_ptr(ret_conv, true);
20994 }
20995
20996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20997         LDKIOError e_conv = LDKIOError_from_java(env, e);
20998         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
20999         *ret_conv = CResult_NoneErrorZ_err(e_conv);
21000         return tag_ptr(ret_conv, true);
21001 }
21002
21003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21004         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
21005         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
21006         return ret_conv;
21007 }
21008
21009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21010         if (!ptr_is_owned(_res)) return;
21011         void* _res_ptr = untag_ptr(_res);
21012         CHECK_ACCESS(_res_ptr);
21013         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
21014         FREE(untag_ptr(_res));
21015         CResult_NoneErrorZ_free(_res_conv);
21016 }
21017
21018 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
21019         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
21020         *ret_conv = CResult_NoneErrorZ_clone(arg);
21021         return tag_ptr(ret_conv, true);
21022 }
21023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21024         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
21025         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
21026         return ret_conv;
21027 }
21028
21029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21030         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
21031         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
21032         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
21033         return tag_ptr(ret_conv, true);
21034 }
21035
21036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21037         LDKCVec_ChannelDetailsZ _res_constr;
21038         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21039         if (_res_constr.datalen > 0)
21040                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
21041         else
21042                 _res_constr.data = NULL;
21043         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21044         for (size_t q = 0; q < _res_constr.datalen; q++) {
21045                 int64_t _res_conv_16 = _res_vals[q];
21046                 LDKChannelDetails _res_conv_16_conv;
21047                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21048                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21049                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21050                 _res_constr.data[q] = _res_conv_16_conv;
21051         }
21052         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21053         CVec_ChannelDetailsZ_free(_res_constr);
21054 }
21055
21056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21057         LDKRoute o_conv;
21058         o_conv.inner = untag_ptr(o);
21059         o_conv.is_owned = ptr_is_owned(o);
21060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21061         o_conv = Route_clone(&o_conv);
21062         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21063         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
21064         return tag_ptr(ret_conv, true);
21065 }
21066
21067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21068         LDKLightningError e_conv;
21069         e_conv.inner = untag_ptr(e);
21070         e_conv.is_owned = ptr_is_owned(e);
21071         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21072         e_conv = LightningError_clone(&e_conv);
21073         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21074         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
21075         return tag_ptr(ret_conv, true);
21076 }
21077
21078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21079         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
21080         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
21081         return ret_conv;
21082 }
21083
21084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21085         if (!ptr_is_owned(_res)) return;
21086         void* _res_ptr = untag_ptr(_res);
21087         CHECK_ACCESS(_res_ptr);
21088         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
21089         FREE(untag_ptr(_res));
21090         CResult_RouteLightningErrorZ_free(_res_conv);
21091 }
21092
21093 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
21094         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21095         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
21096         return tag_ptr(ret_conv, true);
21097 }
21098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21099         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
21100         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
21101         return ret_conv;
21102 }
21103
21104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21105         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
21106         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21107         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
21108         return tag_ptr(ret_conv, true);
21109 }
21110
21111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21112         LDKInFlightHtlcs o_conv;
21113         o_conv.inner = untag_ptr(o);
21114         o_conv.is_owned = ptr_is_owned(o);
21115         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21116         o_conv = InFlightHtlcs_clone(&o_conv);
21117         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21118         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
21119         return tag_ptr(ret_conv, true);
21120 }
21121
21122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21123         void* e_ptr = untag_ptr(e);
21124         CHECK_ACCESS(e_ptr);
21125         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21126         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21127         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21128         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
21129         return tag_ptr(ret_conv, true);
21130 }
21131
21132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21133         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
21134         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
21135         return ret_conv;
21136 }
21137
21138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21139         if (!ptr_is_owned(_res)) return;
21140         void* _res_ptr = untag_ptr(_res);
21141         CHECK_ACCESS(_res_ptr);
21142         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
21143         FREE(untag_ptr(_res));
21144         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
21145 }
21146
21147 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
21148         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21149         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
21150         return tag_ptr(ret_conv, true);
21151 }
21152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21153         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
21154         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
21155         return ret_conv;
21156 }
21157
21158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21159         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
21160         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21161         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
21162         return tag_ptr(ret_conv, true);
21163 }
21164
21165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21166         LDKRouteHop o_conv;
21167         o_conv.inner = untag_ptr(o);
21168         o_conv.is_owned = ptr_is_owned(o);
21169         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21170         o_conv = RouteHop_clone(&o_conv);
21171         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21172         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
21173         return tag_ptr(ret_conv, true);
21174 }
21175
21176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21177         void* e_ptr = untag_ptr(e);
21178         CHECK_ACCESS(e_ptr);
21179         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21180         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21181         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21182         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
21183         return tag_ptr(ret_conv, true);
21184 }
21185
21186 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21187         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
21188         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
21189         return ret_conv;
21190 }
21191
21192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21193         if (!ptr_is_owned(_res)) return;
21194         void* _res_ptr = untag_ptr(_res);
21195         CHECK_ACCESS(_res_ptr);
21196         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
21197         FREE(untag_ptr(_res));
21198         CResult_RouteHopDecodeErrorZ_free(_res_conv);
21199 }
21200
21201 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
21202         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21203         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
21204         return tag_ptr(ret_conv, true);
21205 }
21206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21207         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
21208         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
21209         return ret_conv;
21210 }
21211
21212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21213         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
21214         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21215         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
21216         return tag_ptr(ret_conv, true);
21217 }
21218
21219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21220         LDKCVec_BlindedHopZ _res_constr;
21221         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21222         if (_res_constr.datalen > 0)
21223                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
21224         else
21225                 _res_constr.data = NULL;
21226         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21227         for (size_t m = 0; m < _res_constr.datalen; m++) {
21228                 int64_t _res_conv_12 = _res_vals[m];
21229                 LDKBlindedHop _res_conv_12_conv;
21230                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
21231                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
21232                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
21233                 _res_constr.data[m] = _res_conv_12_conv;
21234         }
21235         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21236         CVec_BlindedHopZ_free(_res_constr);
21237 }
21238
21239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21240         LDKBlindedTail o_conv;
21241         o_conv.inner = untag_ptr(o);
21242         o_conv.is_owned = ptr_is_owned(o);
21243         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21244         o_conv = BlindedTail_clone(&o_conv);
21245         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21246         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
21247         return tag_ptr(ret_conv, true);
21248 }
21249
21250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21251         void* e_ptr = untag_ptr(e);
21252         CHECK_ACCESS(e_ptr);
21253         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21254         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21255         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21256         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
21257         return tag_ptr(ret_conv, true);
21258 }
21259
21260 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21261         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
21262         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
21263         return ret_conv;
21264 }
21265
21266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21267         if (!ptr_is_owned(_res)) return;
21268         void* _res_ptr = untag_ptr(_res);
21269         CHECK_ACCESS(_res_ptr);
21270         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
21271         FREE(untag_ptr(_res));
21272         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
21273 }
21274
21275 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
21276         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21277         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
21278         return tag_ptr(ret_conv, true);
21279 }
21280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21281         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
21282         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
21283         return ret_conv;
21284 }
21285
21286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21287         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
21288         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21289         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
21290         return tag_ptr(ret_conv, true);
21291 }
21292
21293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21294         LDKCVec_RouteHopZ _res_constr;
21295         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21296         if (_res_constr.datalen > 0)
21297                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21298         else
21299                 _res_constr.data = NULL;
21300         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21301         for (size_t k = 0; k < _res_constr.datalen; k++) {
21302                 int64_t _res_conv_10 = _res_vals[k];
21303                 LDKRouteHop _res_conv_10_conv;
21304                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21305                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21306                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21307                 _res_constr.data[k] = _res_conv_10_conv;
21308         }
21309         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21310         CVec_RouteHopZ_free(_res_constr);
21311 }
21312
21313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
21314         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21315         *ret_copy = COption_u32Z_some(o);
21316         int64_t ret_ref = tag_ptr(ret_copy, true);
21317         return ret_ref;
21318 }
21319
21320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
21321         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21322         *ret_copy = COption_u32Z_none();
21323         int64_t ret_ref = tag_ptr(ret_copy, true);
21324         return ret_ref;
21325 }
21326
21327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21328         if (!ptr_is_owned(_res)) return;
21329         void* _res_ptr = untag_ptr(_res);
21330         CHECK_ACCESS(_res_ptr);
21331         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
21332         FREE(untag_ptr(_res));
21333         COption_u32Z_free(_res_conv);
21334 }
21335
21336 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
21337         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21338         *ret_copy = COption_u32Z_clone(arg);
21339         int64_t ret_ref = tag_ptr(ret_copy, true);
21340         return ret_ref;
21341 }
21342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21343         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
21344         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
21345         return ret_conv;
21346 }
21347
21348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21349         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
21350         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21351         *ret_copy = COption_u32Z_clone(orig_conv);
21352         int64_t ret_ref = tag_ptr(ret_copy, true);
21353         return ret_ref;
21354 }
21355
21356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21357         LDKCVec_PathZ _res_constr;
21358         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21359         if (_res_constr.datalen > 0)
21360                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
21361         else
21362                 _res_constr.data = NULL;
21363         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21364         for (size_t g = 0; g < _res_constr.datalen; g++) {
21365                 int64_t _res_conv_6 = _res_vals[g];
21366                 LDKPath _res_conv_6_conv;
21367                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
21368                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
21369                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
21370                 _res_constr.data[g] = _res_conv_6_conv;
21371         }
21372         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21373         CVec_PathZ_free(_res_constr);
21374 }
21375
21376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21377         LDKRoute o_conv;
21378         o_conv.inner = untag_ptr(o);
21379         o_conv.is_owned = ptr_is_owned(o);
21380         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21381         o_conv = Route_clone(&o_conv);
21382         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21383         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
21384         return tag_ptr(ret_conv, true);
21385 }
21386
21387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21388         void* e_ptr = untag_ptr(e);
21389         CHECK_ACCESS(e_ptr);
21390         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21391         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21392         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21393         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
21394         return tag_ptr(ret_conv, true);
21395 }
21396
21397 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21398         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
21399         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
21400         return ret_conv;
21401 }
21402
21403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21404         if (!ptr_is_owned(_res)) return;
21405         void* _res_ptr = untag_ptr(_res);
21406         CHECK_ACCESS(_res_ptr);
21407         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
21408         FREE(untag_ptr(_res));
21409         CResult_RouteDecodeErrorZ_free(_res_conv);
21410 }
21411
21412 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
21413         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21414         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
21415         return tag_ptr(ret_conv, true);
21416 }
21417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21418         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
21419         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
21420         return ret_conv;
21421 }
21422
21423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21424         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
21425         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21426         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
21427         return tag_ptr(ret_conv, true);
21428 }
21429
21430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21431         LDKRouteParameters o_conv;
21432         o_conv.inner = untag_ptr(o);
21433         o_conv.is_owned = ptr_is_owned(o);
21434         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21435         o_conv = RouteParameters_clone(&o_conv);
21436         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21437         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
21438         return tag_ptr(ret_conv, true);
21439 }
21440
21441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21442         void* e_ptr = untag_ptr(e);
21443         CHECK_ACCESS(e_ptr);
21444         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21445         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21446         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21447         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
21448         return tag_ptr(ret_conv, true);
21449 }
21450
21451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21452         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
21453         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
21454         return ret_conv;
21455 }
21456
21457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21458         if (!ptr_is_owned(_res)) return;
21459         void* _res_ptr = untag_ptr(_res);
21460         CHECK_ACCESS(_res_ptr);
21461         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
21462         FREE(untag_ptr(_res));
21463         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
21464 }
21465
21466 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
21467         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21468         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
21469         return tag_ptr(ret_conv, true);
21470 }
21471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21472         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
21473         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
21474         return ret_conv;
21475 }
21476
21477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21478         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
21479         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21480         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
21481         return tag_ptr(ret_conv, true);
21482 }
21483
21484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21485         LDKCVec_u64Z _res_constr;
21486         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21487         if (_res_constr.datalen > 0)
21488                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21489         else
21490                 _res_constr.data = NULL;
21491         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21492         for (size_t g = 0; g < _res_constr.datalen; g++) {
21493                 int64_t _res_conv_6 = _res_vals[g];
21494                 _res_constr.data[g] = _res_conv_6;
21495         }
21496         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21497         CVec_u64Z_free(_res_constr);
21498 }
21499
21500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21501         LDKPaymentParameters o_conv;
21502         o_conv.inner = untag_ptr(o);
21503         o_conv.is_owned = ptr_is_owned(o);
21504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21505         o_conv = PaymentParameters_clone(&o_conv);
21506         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21507         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
21508         return tag_ptr(ret_conv, true);
21509 }
21510
21511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21512         void* e_ptr = untag_ptr(e);
21513         CHECK_ACCESS(e_ptr);
21514         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21515         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21516         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21517         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
21518         return tag_ptr(ret_conv, true);
21519 }
21520
21521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21522         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
21523         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
21524         return ret_conv;
21525 }
21526
21527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21528         if (!ptr_is_owned(_res)) return;
21529         void* _res_ptr = untag_ptr(_res);
21530         CHECK_ACCESS(_res_ptr);
21531         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
21532         FREE(untag_ptr(_res));
21533         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
21534 }
21535
21536 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
21537         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21538         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
21539         return tag_ptr(ret_conv, true);
21540 }
21541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21542         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
21543         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
21544         return ret_conv;
21545 }
21546
21547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21548         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
21549         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21550         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
21551         return tag_ptr(ret_conv, true);
21552 }
21553
21554 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
21555         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
21556         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
21557         return tag_ptr(ret_conv, true);
21558 }
21559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21560         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
21561         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
21562         return ret_conv;
21563 }
21564
21565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21566         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
21567         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
21568         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
21569         return tag_ptr(ret_conv, true);
21570 }
21571
21572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
21573         LDKBlindedPayInfo a_conv;
21574         a_conv.inner = untag_ptr(a);
21575         a_conv.is_owned = ptr_is_owned(a);
21576         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21577         a_conv = BlindedPayInfo_clone(&a_conv);
21578         LDKBlindedPath b_conv;
21579         b_conv.inner = untag_ptr(b);
21580         b_conv.is_owned = ptr_is_owned(b);
21581         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21582         b_conv = BlindedPath_clone(&b_conv);
21583         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
21584         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
21585         return tag_ptr(ret_conv, true);
21586 }
21587
21588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21589         if (!ptr_is_owned(_res)) return;
21590         void* _res_ptr = untag_ptr(_res);
21591         CHECK_ACCESS(_res_ptr);
21592         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
21593         FREE(untag_ptr(_res));
21594         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
21595 }
21596
21597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21598         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
21599         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21600         if (_res_constr.datalen > 0)
21601                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
21602         else
21603                 _res_constr.data = NULL;
21604         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21605         for (size_t l = 0; l < _res_constr.datalen; l++) {
21606                 int64_t _res_conv_37 = _res_vals[l];
21607                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
21608                 CHECK_ACCESS(_res_conv_37_ptr);
21609                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
21610                 FREE(untag_ptr(_res_conv_37));
21611                 _res_constr.data[l] = _res_conv_37_conv;
21612         }
21613         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21614         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
21615 }
21616
21617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21618         LDKCVec_RouteHintZ _res_constr;
21619         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21620         if (_res_constr.datalen > 0)
21621                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
21622         else
21623                 _res_constr.data = NULL;
21624         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21625         for (size_t l = 0; l < _res_constr.datalen; l++) {
21626                 int64_t _res_conv_11 = _res_vals[l];
21627                 LDKRouteHint _res_conv_11_conv;
21628                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
21629                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
21630                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
21631                 _res_constr.data[l] = _res_conv_11_conv;
21632         }
21633         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21634         CVec_RouteHintZ_free(_res_constr);
21635 }
21636
21637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21638         LDKCVec_RouteHintHopZ _res_constr;
21639         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21640         if (_res_constr.datalen > 0)
21641                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
21642         else
21643                 _res_constr.data = NULL;
21644         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21645         for (size_t o = 0; o < _res_constr.datalen; o++) {
21646                 int64_t _res_conv_14 = _res_vals[o];
21647                 LDKRouteHintHop _res_conv_14_conv;
21648                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
21649                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
21650                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
21651                 _res_constr.data[o] = _res_conv_14_conv;
21652         }
21653         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21654         CVec_RouteHintHopZ_free(_res_constr);
21655 }
21656
21657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21658         LDKRouteHint o_conv;
21659         o_conv.inner = untag_ptr(o);
21660         o_conv.is_owned = ptr_is_owned(o);
21661         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21662         o_conv = RouteHint_clone(&o_conv);
21663         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21664         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
21665         return tag_ptr(ret_conv, true);
21666 }
21667
21668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21669         void* e_ptr = untag_ptr(e);
21670         CHECK_ACCESS(e_ptr);
21671         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21672         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21673         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21674         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
21675         return tag_ptr(ret_conv, true);
21676 }
21677
21678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21679         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
21680         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
21681         return ret_conv;
21682 }
21683
21684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21685         if (!ptr_is_owned(_res)) return;
21686         void* _res_ptr = untag_ptr(_res);
21687         CHECK_ACCESS(_res_ptr);
21688         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
21689         FREE(untag_ptr(_res));
21690         CResult_RouteHintDecodeErrorZ_free(_res_conv);
21691 }
21692
21693 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
21694         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21695         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
21696         return tag_ptr(ret_conv, true);
21697 }
21698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21699         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
21700         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
21701         return ret_conv;
21702 }
21703
21704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21705         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
21706         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21707         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
21708         return tag_ptr(ret_conv, true);
21709 }
21710
21711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21712         LDKRouteHintHop o_conv;
21713         o_conv.inner = untag_ptr(o);
21714         o_conv.is_owned = ptr_is_owned(o);
21715         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21716         o_conv = RouteHintHop_clone(&o_conv);
21717         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21718         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
21719         return tag_ptr(ret_conv, true);
21720 }
21721
21722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21723         void* e_ptr = untag_ptr(e);
21724         CHECK_ACCESS(e_ptr);
21725         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21726         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21727         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21728         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
21729         return tag_ptr(ret_conv, true);
21730 }
21731
21732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21733         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
21734         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
21735         return ret_conv;
21736 }
21737
21738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21739         if (!ptr_is_owned(_res)) return;
21740         void* _res_ptr = untag_ptr(_res);
21741         CHECK_ACCESS(_res_ptr);
21742         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
21743         FREE(untag_ptr(_res));
21744         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
21745 }
21746
21747 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
21748         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21749         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
21750         return tag_ptr(ret_conv, true);
21751 }
21752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21753         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
21754         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
21755         return ret_conv;
21756 }
21757
21758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21759         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
21760         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21761         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
21762         return tag_ptr(ret_conv, true);
21763 }
21764
21765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21766         LDKCVec_PublicKeyZ _res_constr;
21767         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21768         if (_res_constr.datalen > 0)
21769                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
21770         else
21771                 _res_constr.data = NULL;
21772         for (size_t i = 0; i < _res_constr.datalen; i++) {
21773                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21774                 LDKPublicKey _res_conv_8_ref;
21775                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
21776                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
21777                 _res_constr.data[i] = _res_conv_8_ref;
21778         }
21779         CVec_PublicKeyZ_free(_res_constr);
21780 }
21781
21782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21783         LDKFixedPenaltyScorer o_conv;
21784         o_conv.inner = untag_ptr(o);
21785         o_conv.is_owned = ptr_is_owned(o);
21786         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21787         o_conv = FixedPenaltyScorer_clone(&o_conv);
21788         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21789         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
21790         return tag_ptr(ret_conv, true);
21791 }
21792
21793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21794         void* e_ptr = untag_ptr(e);
21795         CHECK_ACCESS(e_ptr);
21796         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21797         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21798         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21799         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
21800         return tag_ptr(ret_conv, true);
21801 }
21802
21803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21804         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
21805         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
21806         return ret_conv;
21807 }
21808
21809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21810         if (!ptr_is_owned(_res)) return;
21811         void* _res_ptr = untag_ptr(_res);
21812         CHECK_ACCESS(_res_ptr);
21813         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
21814         FREE(untag_ptr(_res));
21815         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
21816 }
21817
21818 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
21819         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21820         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
21821         return tag_ptr(ret_conv, true);
21822 }
21823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21824         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
21825         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
21826         return ret_conv;
21827 }
21828
21829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21830         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
21831         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21832         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
21833         return tag_ptr(ret_conv, true);
21834 }
21835
21836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21837         LDKCVec_NodeIdZ _res_constr;
21838         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21839         if (_res_constr.datalen > 0)
21840                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
21841         else
21842                 _res_constr.data = NULL;
21843         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21844         for (size_t i = 0; i < _res_constr.datalen; i++) {
21845                 int64_t _res_conv_8 = _res_vals[i];
21846                 LDKNodeId _res_conv_8_conv;
21847                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
21848                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
21849                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
21850                 _res_constr.data[i] = _res_conv_8_conv;
21851         }
21852         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21853         CVec_NodeIdZ_free(_res_constr);
21854 }
21855
21856 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
21857         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21858         *ret_conv = C2Tuple_u64u64Z_clone(arg);
21859         return tag_ptr(ret_conv, true);
21860 }
21861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21862         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
21863         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
21864         return ret_conv;
21865 }
21866
21867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21868         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
21869         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21870         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
21871         return tag_ptr(ret_conv, true);
21872 }
21873
21874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
21875         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21876         *ret_conv = C2Tuple_u64u64Z_new(a, b);
21877         return tag_ptr(ret_conv, true);
21878 }
21879
21880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21881         if (!ptr_is_owned(_res)) return;
21882         void* _res_ptr = untag_ptr(_res);
21883         CHECK_ACCESS(_res_ptr);
21884         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
21885         FREE(untag_ptr(_res));
21886         C2Tuple_u64u64Z_free(_res_conv);
21887 }
21888
21889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21890         void* o_ptr = untag_ptr(o);
21891         CHECK_ACCESS(o_ptr);
21892         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
21893         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
21894         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21895         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
21896         int64_t ret_ref = tag_ptr(ret_copy, true);
21897         return ret_ref;
21898 }
21899
21900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
21901         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21902         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
21903         int64_t ret_ref = tag_ptr(ret_copy, true);
21904         return ret_ref;
21905 }
21906
21907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21908         if (!ptr_is_owned(_res)) return;
21909         void* _res_ptr = untag_ptr(_res);
21910         CHECK_ACCESS(_res_ptr);
21911         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
21912         FREE(untag_ptr(_res));
21913         COption_C2Tuple_u64u64ZZ_free(_res_conv);
21914 }
21915
21916 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
21917         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21918         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
21919         int64_t ret_ref = tag_ptr(ret_copy, true);
21920         return ret_ref;
21921 }
21922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21923         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
21924         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
21925         return ret_conv;
21926 }
21927
21928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21929         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
21930         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21931         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
21932         int64_t ret_ref = tag_ptr(ret_copy, true);
21933         return ret_ref;
21934 }
21935
21936 static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) {
21937         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21938         *ret_conv = C2Tuple_Z_clone(arg);
21939         return tag_ptr(ret_conv, true);
21940 }
21941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21942         LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg);
21943         int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv);
21944         return ret_conv;
21945 }
21946
21947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21948         LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig);
21949         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21950         *ret_conv = C2Tuple_Z_clone(orig_conv);
21951         return tag_ptr(ret_conv, true);
21952 }
21953
21954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
21955         LDKEightU16s a_ref;
21956         CHECK((*env)->GetArrayLength(env, a) == 8);
21957         (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data);
21958         LDKEightU16s b_ref;
21959         CHECK((*env)->GetArrayLength(env, b) == 8);
21960         (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data);
21961         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21962         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
21963         return tag_ptr(ret_conv, true);
21964 }
21965
21966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21967         if (!ptr_is_owned(_res)) return;
21968         void* _res_ptr = untag_ptr(_res);
21969         CHECK_ACCESS(_res_ptr);
21970         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
21971         FREE(untag_ptr(_res));
21972         C2Tuple_Z_free(_res_conv);
21973 }
21974
21975 static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) {
21976         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
21977         *ret_conv = C2Tuple__u168_u168Z_clone(arg);
21978         return tag_ptr(ret_conv, true);
21979 }
21980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21981         LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg);
21982         int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv);
21983         return ret_conv;
21984 }
21985
21986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21987         LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig);
21988         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
21989         *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv);
21990         return tag_ptr(ret_conv, true);
21991 }
21992
21993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
21994         LDKEightU16s a_ref;
21995         CHECK((*env)->GetArrayLength(env, a) == 8);
21996         (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data);
21997         LDKEightU16s b_ref;
21998         CHECK((*env)->GetArrayLength(env, b) == 8);
21999         (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data);
22000         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
22001         *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref);
22002         return tag_ptr(ret_conv, true);
22003 }
22004
22005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
22006         if (!ptr_is_owned(_res)) return;
22007         void* _res_ptr = untag_ptr(_res);
22008         CHECK_ACCESS(_res_ptr);
22009         LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr);
22010         FREE(untag_ptr(_res));
22011         C2Tuple__u168_u168Z_free(_res_conv);
22012 }
22013
22014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22015         void* o_ptr = untag_ptr(o);
22016         CHECK_ACCESS(o_ptr);
22017         LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr);
22018         o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o));
22019         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
22020         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv);
22021         int64_t ret_ref = tag_ptr(ret_copy, true);
22022         return ret_ref;
22023 }
22024
22025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1none(JNIEnv *env, jclass clz) {
22026         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
22027         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none();
22028         int64_t ret_ref = tag_ptr(ret_copy, true);
22029         return ret_ref;
22030 }
22031
22032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22033         if (!ptr_is_owned(_res)) return;
22034         void* _res_ptr = untag_ptr(_res);
22035         CHECK_ACCESS(_res_ptr);
22036         LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr);
22037         FREE(untag_ptr(_res));
22038         COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv);
22039 }
22040
22041 static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) {
22042         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
22043         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg);
22044         int64_t ret_ref = tag_ptr(ret_copy, true);
22045         return ret_ref;
22046 }
22047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22048         LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg);
22049         int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv);
22050         return ret_conv;
22051 }
22052
22053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22054         LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig);
22055         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
22056         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv);
22057         int64_t ret_ref = tag_ptr(ret_copy, true);
22058         return ret_ref;
22059 }
22060
22061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22062         LDKProbabilisticScorer o_conv;
22063         o_conv.inner = untag_ptr(o);
22064         o_conv.is_owned = ptr_is_owned(o);
22065         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22066         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
22067         
22068         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
22069         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
22070         return tag_ptr(ret_conv, true);
22071 }
22072
22073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22074         void* e_ptr = untag_ptr(e);
22075         CHECK_ACCESS(e_ptr);
22076         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22077         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22078         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
22079         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
22080         return tag_ptr(ret_conv, true);
22081 }
22082
22083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22084         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
22085         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
22086         return ret_conv;
22087 }
22088
22089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22090         if (!ptr_is_owned(_res)) return;
22091         void* _res_ptr = untag_ptr(_res);
22092         CHECK_ACCESS(_res_ptr);
22093         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
22094         FREE(untag_ptr(_res));
22095         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
22096 }
22097
22098 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
22099         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
22100         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
22101         return tag_ptr(ret_conv, true);
22102 }
22103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22104         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
22105         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
22106         return ret_conv;
22107 }
22108
22109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22110         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
22111         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
22112         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
22113         return tag_ptr(ret_conv, true);
22114 }
22115
22116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
22117         LDKTransaction b_ref;
22118         b_ref.datalen = (*env)->GetArrayLength(env, b);
22119         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
22120         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
22121         b_ref.data_is_owned = true;
22122         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
22123         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
22124         return tag_ptr(ret_conv, true);
22125 }
22126
22127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22128         if (!ptr_is_owned(_res)) return;
22129         void* _res_ptr = untag_ptr(_res);
22130         CHECK_ACCESS(_res_ptr);
22131         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
22132         FREE(untag_ptr(_res));
22133         C2Tuple_usizeTransactionZ_free(_res_conv);
22134 }
22135
22136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22137         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
22138         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22139         if (_res_constr.datalen > 0)
22140                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22141         else
22142                 _res_constr.data = NULL;
22143         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22144         for (size_t c = 0; c < _res_constr.datalen; c++) {
22145                 int64_t _res_conv_28 = _res_vals[c];
22146                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
22147                 CHECK_ACCESS(_res_conv_28_ptr);
22148                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
22149                 FREE(untag_ptr(_res_conv_28));
22150                 _res_constr.data[c] = _res_conv_28_conv;
22151         }
22152         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22153         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
22154 }
22155
22156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
22157         LDKThirtyTwoBytes o_ref;
22158         CHECK((*env)->GetArrayLength(env, o) == 32);
22159         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
22160         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
22161         *ret_copy = COption_BlockHashZ_some(o_ref);
22162         int64_t ret_ref = tag_ptr(ret_copy, true);
22163         return ret_ref;
22164 }
22165
22166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1none(JNIEnv *env, jclass clz) {
22167         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
22168         *ret_copy = COption_BlockHashZ_none();
22169         int64_t ret_ref = tag_ptr(ret_copy, true);
22170         return ret_ref;
22171 }
22172
22173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22174         if (!ptr_is_owned(_res)) return;
22175         void* _res_ptr = untag_ptr(_res);
22176         CHECK_ACCESS(_res_ptr);
22177         LDKCOption_BlockHashZ _res_conv = *(LDKCOption_BlockHashZ*)(_res_ptr);
22178         FREE(untag_ptr(_res));
22179         COption_BlockHashZ_free(_res_conv);
22180 }
22181
22182 static inline uint64_t COption_BlockHashZ_clone_ptr(LDKCOption_BlockHashZ *NONNULL_PTR arg) {
22183         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
22184         *ret_copy = COption_BlockHashZ_clone(arg);
22185         int64_t ret_ref = tag_ptr(ret_copy, true);
22186         return ret_ref;
22187 }
22188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22189         LDKCOption_BlockHashZ* arg_conv = (LDKCOption_BlockHashZ*)untag_ptr(arg);
22190         int64_t ret_conv = COption_BlockHashZ_clone_ptr(arg_conv);
22191         return ret_conv;
22192 }
22193
22194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22195         LDKCOption_BlockHashZ* orig_conv = (LDKCOption_BlockHashZ*)untag_ptr(orig);
22196         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
22197         *ret_copy = COption_BlockHashZ_clone(orig_conv);
22198         int64_t ret_ref = tag_ptr(ret_copy, true);
22199         return ret_ref;
22200 }
22201
22202 static inline uint64_t C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR arg) {
22203         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
22204         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone(arg);
22205         return tag_ptr(ret_conv, true);
22206 }
22207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22208         LDKC2Tuple_TxidCOption_BlockHashZZ* arg_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(arg);
22209         int64_t ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(arg_conv);
22210         return ret_conv;
22211 }
22212
22213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22214         LDKC2Tuple_TxidCOption_BlockHashZZ* orig_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(orig);
22215         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
22216         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone(orig_conv);
22217         return tag_ptr(ret_conv, true);
22218 }
22219
22220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
22221         LDKThirtyTwoBytes a_ref;
22222         CHECK((*env)->GetArrayLength(env, a) == 32);
22223         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
22224         void* b_ptr = untag_ptr(b);
22225         CHECK_ACCESS(b_ptr);
22226         LDKCOption_BlockHashZ b_conv = *(LDKCOption_BlockHashZ*)(b_ptr);
22227         b_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(b));
22228         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
22229         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_new(a_ref, b_conv);
22230         return tag_ptr(ret_conv, true);
22231 }
22232
22233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22234         if (!ptr_is_owned(_res)) return;
22235         void* _res_ptr = untag_ptr(_res);
22236         CHECK_ACCESS(_res_ptr);
22237         LDKC2Tuple_TxidCOption_BlockHashZZ _res_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(_res_ptr);
22238         FREE(untag_ptr(_res));
22239         C2Tuple_TxidCOption_BlockHashZZ_free(_res_conv);
22240 }
22241
22242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCOption_1BlockHashZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22243         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ _res_constr;
22244         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22245         if (_res_constr.datalen > 0)
22246                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ Elements");
22247         else
22248                 _res_constr.data = NULL;
22249         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22250         for (size_t i = 0; i < _res_constr.datalen; i++) {
22251                 int64_t _res_conv_34 = _res_vals[i];
22252                 void* _res_conv_34_ptr = untag_ptr(_res_conv_34);
22253                 CHECK_ACCESS(_res_conv_34_ptr);
22254                 LDKC2Tuple_TxidCOption_BlockHashZZ _res_conv_34_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(_res_conv_34_ptr);
22255                 FREE(untag_ptr(_res_conv_34));
22256                 _res_constr.data[i] = _res_conv_34_conv;
22257         }
22258         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22259         CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(_res_constr);
22260 }
22261
22262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22263         LDKCVec_MonitorEventZ _res_constr;
22264         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22265         if (_res_constr.datalen > 0)
22266                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
22267         else
22268                 _res_constr.data = NULL;
22269         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22270         for (size_t o = 0; o < _res_constr.datalen; o++) {
22271                 int64_t _res_conv_14 = _res_vals[o];
22272                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
22273                 CHECK_ACCESS(_res_conv_14_ptr);
22274                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
22275                 FREE(untag_ptr(_res_conv_14));
22276                 _res_constr.data[o] = _res_conv_14_conv;
22277         }
22278         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22279         CVec_MonitorEventZ_free(_res_constr);
22280 }
22281
22282 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
22283         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
22284         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
22285         return tag_ptr(ret_conv, true);
22286 }
22287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22288         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
22289         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
22290         return ret_conv;
22291 }
22292
22293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22294         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
22295         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
22296         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
22297         return tag_ptr(ret_conv, true);
22298 }
22299
22300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b, int8_tArray c) {
22301         LDKOutPoint a_conv;
22302         a_conv.inner = untag_ptr(a);
22303         a_conv.is_owned = ptr_is_owned(a);
22304         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22305         a_conv = OutPoint_clone(&a_conv);
22306         LDKCVec_MonitorEventZ b_constr;
22307         b_constr.datalen = (*env)->GetArrayLength(env, b);
22308         if (b_constr.datalen > 0)
22309                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
22310         else
22311                 b_constr.data = NULL;
22312         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
22313         for (size_t o = 0; o < b_constr.datalen; o++) {
22314                 int64_t b_conv_14 = b_vals[o];
22315                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
22316                 CHECK_ACCESS(b_conv_14_ptr);
22317                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
22318                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
22319                 b_constr.data[o] = b_conv_14_conv;
22320         }
22321         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
22322         LDKPublicKey c_ref;
22323         CHECK((*env)->GetArrayLength(env, c) == 33);
22324         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
22325         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
22326         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
22327         return tag_ptr(ret_conv, true);
22328 }
22329
22330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22331         if (!ptr_is_owned(_res)) return;
22332         void* _res_ptr = untag_ptr(_res);
22333         CHECK_ACCESS(_res_ptr);
22334         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
22335         FREE(untag_ptr(_res));
22336         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
22337 }
22338
22339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22340         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
22341         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22342         if (_res_constr.datalen > 0)
22343                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
22344         else
22345                 _res_constr.data = NULL;
22346         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22347         for (size_t x = 0; x < _res_constr.datalen; x++) {
22348                 int64_t _res_conv_49 = _res_vals[x];
22349                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
22350                 CHECK_ACCESS(_res_conv_49_ptr);
22351                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
22352                 FREE(untag_ptr(_res_conv_49));
22353                 _res_constr.data[x] = _res_conv_49_conv;
22354         }
22355         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22356         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
22357 }
22358
22359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22360         LDKInitFeatures o_conv;
22361         o_conv.inner = untag_ptr(o);
22362         o_conv.is_owned = ptr_is_owned(o);
22363         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22364         o_conv = InitFeatures_clone(&o_conv);
22365         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22366         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
22367         return tag_ptr(ret_conv, true);
22368 }
22369
22370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22371         void* e_ptr = untag_ptr(e);
22372         CHECK_ACCESS(e_ptr);
22373         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22374         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22375         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22376         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
22377         return tag_ptr(ret_conv, true);
22378 }
22379
22380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22381         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
22382         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
22383         return ret_conv;
22384 }
22385
22386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22387         if (!ptr_is_owned(_res)) return;
22388         void* _res_ptr = untag_ptr(_res);
22389         CHECK_ACCESS(_res_ptr);
22390         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
22391         FREE(untag_ptr(_res));
22392         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
22393 }
22394
22395 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22396         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22397         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
22398         return tag_ptr(ret_conv, true);
22399 }
22400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22401         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
22402         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22403         return ret_conv;
22404 }
22405
22406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22407         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
22408         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22409         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
22410         return tag_ptr(ret_conv, true);
22411 }
22412
22413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22414         LDKChannelFeatures o_conv;
22415         o_conv.inner = untag_ptr(o);
22416         o_conv.is_owned = ptr_is_owned(o);
22417         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22418         o_conv = ChannelFeatures_clone(&o_conv);
22419         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22420         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
22421         return tag_ptr(ret_conv, true);
22422 }
22423
22424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22425         void* e_ptr = untag_ptr(e);
22426         CHECK_ACCESS(e_ptr);
22427         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22428         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22429         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22430         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
22431         return tag_ptr(ret_conv, true);
22432 }
22433
22434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22435         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
22436         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
22437         return ret_conv;
22438 }
22439
22440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22441         if (!ptr_is_owned(_res)) return;
22442         void* _res_ptr = untag_ptr(_res);
22443         CHECK_ACCESS(_res_ptr);
22444         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
22445         FREE(untag_ptr(_res));
22446         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
22447 }
22448
22449 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22450         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22451         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
22452         return tag_ptr(ret_conv, true);
22453 }
22454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22455         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
22456         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22457         return ret_conv;
22458 }
22459
22460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22461         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
22462         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22463         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
22464         return tag_ptr(ret_conv, true);
22465 }
22466
22467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22468         LDKNodeFeatures o_conv;
22469         o_conv.inner = untag_ptr(o);
22470         o_conv.is_owned = ptr_is_owned(o);
22471         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22472         o_conv = NodeFeatures_clone(&o_conv);
22473         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22474         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
22475         return tag_ptr(ret_conv, true);
22476 }
22477
22478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22479         void* e_ptr = untag_ptr(e);
22480         CHECK_ACCESS(e_ptr);
22481         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22482         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22483         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22484         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
22485         return tag_ptr(ret_conv, true);
22486 }
22487
22488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22489         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
22490         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
22491         return ret_conv;
22492 }
22493
22494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22495         if (!ptr_is_owned(_res)) return;
22496         void* _res_ptr = untag_ptr(_res);
22497         CHECK_ACCESS(_res_ptr);
22498         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
22499         FREE(untag_ptr(_res));
22500         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
22501 }
22502
22503 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22504         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22505         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
22506         return tag_ptr(ret_conv, true);
22507 }
22508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22509         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
22510         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22511         return ret_conv;
22512 }
22513
22514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22515         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
22516         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22517         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
22518         return tag_ptr(ret_conv, true);
22519 }
22520
22521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22522         LDKBolt11InvoiceFeatures o_conv;
22523         o_conv.inner = untag_ptr(o);
22524         o_conv.is_owned = ptr_is_owned(o);
22525         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22526         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
22527         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22528         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22529         return tag_ptr(ret_conv, true);
22530 }
22531
22532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22533         void* e_ptr = untag_ptr(e);
22534         CHECK_ACCESS(e_ptr);
22535         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22536         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22537         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22538         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
22539         return tag_ptr(ret_conv, true);
22540 }
22541
22542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22543         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22544         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22545         return ret_conv;
22546 }
22547
22548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22549         if (!ptr_is_owned(_res)) return;
22550         void* _res_ptr = untag_ptr(_res);
22551         CHECK_ACCESS(_res_ptr);
22552         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22553         FREE(untag_ptr(_res));
22554         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22555 }
22556
22557 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22558         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22559         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
22560         return tag_ptr(ret_conv, true);
22561 }
22562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22563         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22564         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22565         return ret_conv;
22566 }
22567
22568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22569         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22570         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22571         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22572         return tag_ptr(ret_conv, true);
22573 }
22574
22575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22576         LDKBolt12InvoiceFeatures o_conv;
22577         o_conv.inner = untag_ptr(o);
22578         o_conv.is_owned = ptr_is_owned(o);
22579         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22580         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
22581         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22582         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22583         return tag_ptr(ret_conv, true);
22584 }
22585
22586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22587         void* e_ptr = untag_ptr(e);
22588         CHECK_ACCESS(e_ptr);
22589         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22590         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22591         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22592         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
22593         return tag_ptr(ret_conv, true);
22594 }
22595
22596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22597         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22598         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22599         return ret_conv;
22600 }
22601
22602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22603         if (!ptr_is_owned(_res)) return;
22604         void* _res_ptr = untag_ptr(_res);
22605         CHECK_ACCESS(_res_ptr);
22606         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22607         FREE(untag_ptr(_res));
22608         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22609 }
22610
22611 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22612         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22613         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
22614         return tag_ptr(ret_conv, true);
22615 }
22616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22617         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22618         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22619         return ret_conv;
22620 }
22621
22622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22623         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22624         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22625         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22626         return tag_ptr(ret_conv, true);
22627 }
22628
22629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22630         LDKBlindedHopFeatures o_conv;
22631         o_conv.inner = untag_ptr(o);
22632         o_conv.is_owned = ptr_is_owned(o);
22633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22634         o_conv = BlindedHopFeatures_clone(&o_conv);
22635         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22636         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
22637         return tag_ptr(ret_conv, true);
22638 }
22639
22640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22641         void* e_ptr = untag_ptr(e);
22642         CHECK_ACCESS(e_ptr);
22643         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22644         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22645         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22646         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
22647         return tag_ptr(ret_conv, true);
22648 }
22649
22650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22651         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
22652         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
22653         return ret_conv;
22654 }
22655
22656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22657         if (!ptr_is_owned(_res)) return;
22658         void* _res_ptr = untag_ptr(_res);
22659         CHECK_ACCESS(_res_ptr);
22660         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
22661         FREE(untag_ptr(_res));
22662         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
22663 }
22664
22665 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22666         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22667         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
22668         return tag_ptr(ret_conv, true);
22669 }
22670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22671         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
22672         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22673         return ret_conv;
22674 }
22675
22676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22677         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
22678         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22679         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
22680         return tag_ptr(ret_conv, true);
22681 }
22682
22683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22684         LDKChannelTypeFeatures o_conv;
22685         o_conv.inner = untag_ptr(o);
22686         o_conv.is_owned = ptr_is_owned(o);
22687         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22688         o_conv = ChannelTypeFeatures_clone(&o_conv);
22689         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22690         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
22691         return tag_ptr(ret_conv, true);
22692 }
22693
22694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22695         void* e_ptr = untag_ptr(e);
22696         CHECK_ACCESS(e_ptr);
22697         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22698         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22699         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22700         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
22701         return tag_ptr(ret_conv, true);
22702 }
22703
22704 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22705         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
22706         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
22707         return ret_conv;
22708 }
22709
22710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22711         if (!ptr_is_owned(_res)) return;
22712         void* _res_ptr = untag_ptr(_res);
22713         CHECK_ACCESS(_res_ptr);
22714         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
22715         FREE(untag_ptr(_res));
22716         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
22717 }
22718
22719 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22720         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22721         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
22722         return tag_ptr(ret_conv, true);
22723 }
22724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22725         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
22726         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22727         return ret_conv;
22728 }
22729
22730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22731         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
22732         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22733         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
22734         return tag_ptr(ret_conv, true);
22735 }
22736
22737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChainHashZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22738         LDKCVec_ChainHashZ _res_constr;
22739         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22740         if (_res_constr.datalen > 0)
22741                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
22742         else
22743                 _res_constr.data = NULL;
22744         for (size_t i = 0; i < _res_constr.datalen; i++) {
22745                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22746                 LDKThirtyTwoBytes _res_conv_8_ref;
22747                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
22748                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
22749                 _res_constr.data[i] = _res_conv_8_ref;
22750         }
22751         CVec_ChainHashZ_free(_res_constr);
22752 }
22753
22754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22755         LDKOffer o_conv;
22756         o_conv.inner = untag_ptr(o);
22757         o_conv.is_owned = ptr_is_owned(o);
22758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22759         o_conv = Offer_clone(&o_conv);
22760         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22761         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
22762         return tag_ptr(ret_conv, true);
22763 }
22764
22765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22766         LDKBolt12ParseError e_conv;
22767         e_conv.inner = untag_ptr(e);
22768         e_conv.is_owned = ptr_is_owned(e);
22769         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22770         e_conv = Bolt12ParseError_clone(&e_conv);
22771         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22772         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
22773         return tag_ptr(ret_conv, true);
22774 }
22775
22776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22777         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
22778         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
22779         return ret_conv;
22780 }
22781
22782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22783         if (!ptr_is_owned(_res)) return;
22784         void* _res_ptr = untag_ptr(_res);
22785         CHECK_ACCESS(_res_ptr);
22786         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
22787         FREE(untag_ptr(_res));
22788         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
22789 }
22790
22791 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
22792         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22793         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
22794         return tag_ptr(ret_conv, true);
22795 }
22796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22797         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
22798         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
22799         return ret_conv;
22800 }
22801
22802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22803         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
22804         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22805         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
22806         return tag_ptr(ret_conv, true);
22807 }
22808
22809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22810         LDKPublicKey o_ref;
22811         CHECK((*env)->GetArrayLength(env, o) == 33);
22812         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
22813         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22814         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
22815         return tag_ptr(ret_conv, true);
22816 }
22817
22818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
22819         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
22820         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22821         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
22822         return tag_ptr(ret_conv, true);
22823 }
22824
22825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22826         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
22827         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
22828         return ret_conv;
22829 }
22830
22831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22832         if (!ptr_is_owned(_res)) return;
22833         void* _res_ptr = untag_ptr(_res);
22834         CHECK_ACCESS(_res_ptr);
22835         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
22836         FREE(untag_ptr(_res));
22837         CResult_PublicKeyErrorZ_free(_res_conv);
22838 }
22839
22840 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
22841         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22842         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
22843         return tag_ptr(ret_conv, true);
22844 }
22845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22846         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
22847         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
22848         return ret_conv;
22849 }
22850
22851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22852         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
22853         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22854         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
22855         return tag_ptr(ret_conv, true);
22856 }
22857
22858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22859         LDKNodeId o_conv;
22860         o_conv.inner = untag_ptr(o);
22861         o_conv.is_owned = ptr_is_owned(o);
22862         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22863         o_conv = NodeId_clone(&o_conv);
22864         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22865         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
22866         return tag_ptr(ret_conv, true);
22867 }
22868
22869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22870         void* e_ptr = untag_ptr(e);
22871         CHECK_ACCESS(e_ptr);
22872         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22873         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22874         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22875         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
22876         return tag_ptr(ret_conv, true);
22877 }
22878
22879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22880         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
22881         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
22882         return ret_conv;
22883 }
22884
22885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22886         if (!ptr_is_owned(_res)) return;
22887         void* _res_ptr = untag_ptr(_res);
22888         CHECK_ACCESS(_res_ptr);
22889         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
22890         FREE(untag_ptr(_res));
22891         CResult_NodeIdDecodeErrorZ_free(_res_conv);
22892 }
22893
22894 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
22895         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22896         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
22897         return tag_ptr(ret_conv, true);
22898 }
22899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22900         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
22901         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
22902         return ret_conv;
22903 }
22904
22905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22906         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
22907         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22908         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
22909         return tag_ptr(ret_conv, true);
22910 }
22911
22912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22913         void* o_ptr = untag_ptr(o);
22914         CHECK_ACCESS(o_ptr);
22915         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
22916         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
22917         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22918         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
22919         int64_t ret_ref = tag_ptr(ret_copy, true);
22920         return ret_ref;
22921 }
22922
22923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
22924         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22925         *ret_copy = COption_NetworkUpdateZ_none();
22926         int64_t ret_ref = tag_ptr(ret_copy, true);
22927         return ret_ref;
22928 }
22929
22930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22931         if (!ptr_is_owned(_res)) return;
22932         void* _res_ptr = untag_ptr(_res);
22933         CHECK_ACCESS(_res_ptr);
22934         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
22935         FREE(untag_ptr(_res));
22936         COption_NetworkUpdateZ_free(_res_conv);
22937 }
22938
22939 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
22940         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22941         *ret_copy = COption_NetworkUpdateZ_clone(arg);
22942         int64_t ret_ref = tag_ptr(ret_copy, true);
22943         return ret_ref;
22944 }
22945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22946         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
22947         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
22948         return ret_conv;
22949 }
22950
22951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22952         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
22953         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22954         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
22955         int64_t ret_ref = tag_ptr(ret_copy, true);
22956         return ret_ref;
22957 }
22958
22959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22960         void* o_ptr = untag_ptr(o);
22961         CHECK_ACCESS(o_ptr);
22962         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
22963         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
22964         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22965         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
22966         return tag_ptr(ret_conv, true);
22967 }
22968
22969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22970         void* e_ptr = untag_ptr(e);
22971         CHECK_ACCESS(e_ptr);
22972         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22973         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22974         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22975         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
22976         return tag_ptr(ret_conv, true);
22977 }
22978
22979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22980         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
22981         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
22982         return ret_conv;
22983 }
22984
22985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22986         if (!ptr_is_owned(_res)) return;
22987         void* _res_ptr = untag_ptr(_res);
22988         CHECK_ACCESS(_res_ptr);
22989         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
22990         FREE(untag_ptr(_res));
22991         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
22992 }
22993
22994 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
22995         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22996         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
22997         return tag_ptr(ret_conv, true);
22998 }
22999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23000         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
23001         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
23002         return ret_conv;
23003 }
23004
23005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23006         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
23007         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
23008         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
23009         return tag_ptr(ret_conv, true);
23010 }
23011
23012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23013         void* o_ptr = untag_ptr(o);
23014         CHECK_ACCESS(o_ptr);
23015         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
23016         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
23017                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23018                 LDKUtxoLookup_JCalls_cloned(&o_conv);
23019         }
23020         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
23021         *ret_copy = COption_UtxoLookupZ_some(o_conv);
23022         int64_t ret_ref = tag_ptr(ret_copy, true);
23023         return ret_ref;
23024 }
23025
23026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
23027         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
23028         *ret_copy = COption_UtxoLookupZ_none();
23029         int64_t ret_ref = tag_ptr(ret_copy, true);
23030         return ret_ref;
23031 }
23032
23033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23034         if (!ptr_is_owned(_res)) return;
23035         void* _res_ptr = untag_ptr(_res);
23036         CHECK_ACCESS(_res_ptr);
23037         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
23038         FREE(untag_ptr(_res));
23039         COption_UtxoLookupZ_free(_res_conv);
23040 }
23041
23042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
23043         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23044         *ret_conv = CResult_NoneLightningErrorZ_ok();
23045         return tag_ptr(ret_conv, true);
23046 }
23047
23048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23049         LDKLightningError e_conv;
23050         e_conv.inner = untag_ptr(e);
23051         e_conv.is_owned = ptr_is_owned(e);
23052         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23053         e_conv = LightningError_clone(&e_conv);
23054         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23055         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
23056         return tag_ptr(ret_conv, true);
23057 }
23058
23059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23060         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
23061         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
23062         return ret_conv;
23063 }
23064
23065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23066         if (!ptr_is_owned(_res)) return;
23067         void* _res_ptr = untag_ptr(_res);
23068         CHECK_ACCESS(_res_ptr);
23069         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
23070         FREE(untag_ptr(_res));
23071         CResult_NoneLightningErrorZ_free(_res_conv);
23072 }
23073
23074 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
23075         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23076         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
23077         return tag_ptr(ret_conv, true);
23078 }
23079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23080         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
23081         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
23082         return ret_conv;
23083 }
23084
23085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23086         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
23087         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23088         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
23089         return tag_ptr(ret_conv, true);
23090 }
23091
23092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
23093         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23094         *ret_conv = CResult_boolLightningErrorZ_ok(o);
23095         return tag_ptr(ret_conv, true);
23096 }
23097
23098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23099         LDKLightningError e_conv;
23100         e_conv.inner = untag_ptr(e);
23101         e_conv.is_owned = ptr_is_owned(e);
23102         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23103         e_conv = LightningError_clone(&e_conv);
23104         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23105         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
23106         return tag_ptr(ret_conv, true);
23107 }
23108
23109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23110         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
23111         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
23112         return ret_conv;
23113 }
23114
23115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23116         if (!ptr_is_owned(_res)) return;
23117         void* _res_ptr = untag_ptr(_res);
23118         CHECK_ACCESS(_res_ptr);
23119         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
23120         FREE(untag_ptr(_res));
23121         CResult_boolLightningErrorZ_free(_res_conv);
23122 }
23123
23124 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
23125         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23126         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
23127         return tag_ptr(ret_conv, true);
23128 }
23129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23130         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
23131         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
23132         return ret_conv;
23133 }
23134
23135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23136         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
23137         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23138         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
23139         return tag_ptr(ret_conv, true);
23140 }
23141
23142 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
23143         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23144         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
23145         return tag_ptr(ret_conv, true);
23146 }
23147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23148         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
23149         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
23150         return ret_conv;
23151 }
23152
23153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23154         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
23155         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23156         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
23157         return tag_ptr(ret_conv, true);
23158 }
23159
23160 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) {
23161         LDKChannelAnnouncement a_conv;
23162         a_conv.inner = untag_ptr(a);
23163         a_conv.is_owned = ptr_is_owned(a);
23164         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23165         a_conv = ChannelAnnouncement_clone(&a_conv);
23166         LDKChannelUpdate b_conv;
23167         b_conv.inner = untag_ptr(b);
23168         b_conv.is_owned = ptr_is_owned(b);
23169         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23170         b_conv = ChannelUpdate_clone(&b_conv);
23171         LDKChannelUpdate c_conv;
23172         c_conv.inner = untag_ptr(c);
23173         c_conv.is_owned = ptr_is_owned(c);
23174         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
23175         c_conv = ChannelUpdate_clone(&c_conv);
23176         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23177         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
23178         return tag_ptr(ret_conv, true);
23179 }
23180
23181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23182         if (!ptr_is_owned(_res)) return;
23183         void* _res_ptr = untag_ptr(_res);
23184         CHECK_ACCESS(_res_ptr);
23185         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
23186         FREE(untag_ptr(_res));
23187         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
23188 }
23189
23190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23191         void* o_ptr = untag_ptr(o);
23192         CHECK_ACCESS(o_ptr);
23193         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
23194         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
23195         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23196         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
23197         int64_t ret_ref = tag_ptr(ret_copy, true);
23198         return ret_ref;
23199 }
23200
23201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
23202         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23203         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
23204         int64_t ret_ref = tag_ptr(ret_copy, true);
23205         return ret_ref;
23206 }
23207
23208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23209         if (!ptr_is_owned(_res)) return;
23210         void* _res_ptr = untag_ptr(_res);
23211         CHECK_ACCESS(_res_ptr);
23212         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
23213         FREE(untag_ptr(_res));
23214         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
23215 }
23216
23217 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
23218         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23219         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
23220         int64_t ret_ref = tag_ptr(ret_copy, true);
23221         return ret_ref;
23222 }
23223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23224         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
23225         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
23226         return ret_conv;
23227 }
23228
23229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23230         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
23231         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23232         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
23233         int64_t ret_ref = tag_ptr(ret_copy, true);
23234         return ret_ref;
23235 }
23236
23237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23238         LDKCVec_MessageSendEventZ _res_constr;
23239         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23240         if (_res_constr.datalen > 0)
23241                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
23242         else
23243                 _res_constr.data = NULL;
23244         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23245         for (size_t s = 0; s < _res_constr.datalen; s++) {
23246                 int64_t _res_conv_18 = _res_vals[s];
23247                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
23248                 CHECK_ACCESS(_res_conv_18_ptr);
23249                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
23250                 FREE(untag_ptr(_res_conv_18));
23251                 _res_constr.data[s] = _res_conv_18_conv;
23252         }
23253         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23254         CVec_MessageSendEventZ_free(_res_constr);
23255 }
23256
23257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23258         LDKChannelUpdateInfo o_conv;
23259         o_conv.inner = untag_ptr(o);
23260         o_conv.is_owned = ptr_is_owned(o);
23261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23262         o_conv = ChannelUpdateInfo_clone(&o_conv);
23263         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23264         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
23265         return tag_ptr(ret_conv, true);
23266 }
23267
23268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23269         void* e_ptr = untag_ptr(e);
23270         CHECK_ACCESS(e_ptr);
23271         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23272         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23273         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23274         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
23275         return tag_ptr(ret_conv, true);
23276 }
23277
23278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23279         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
23280         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
23281         return ret_conv;
23282 }
23283
23284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23285         if (!ptr_is_owned(_res)) return;
23286         void* _res_ptr = untag_ptr(_res);
23287         CHECK_ACCESS(_res_ptr);
23288         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
23289         FREE(untag_ptr(_res));
23290         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
23291 }
23292
23293 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
23294         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23295         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
23296         return tag_ptr(ret_conv, true);
23297 }
23298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23299         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
23300         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
23301         return ret_conv;
23302 }
23303
23304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23305         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
23306         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23307         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
23308         return tag_ptr(ret_conv, true);
23309 }
23310
23311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23312         LDKChannelInfo o_conv;
23313         o_conv.inner = untag_ptr(o);
23314         o_conv.is_owned = ptr_is_owned(o);
23315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23316         o_conv = ChannelInfo_clone(&o_conv);
23317         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23318         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
23319         return tag_ptr(ret_conv, true);
23320 }
23321
23322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23323         void* e_ptr = untag_ptr(e);
23324         CHECK_ACCESS(e_ptr);
23325         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23326         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23327         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23328         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
23329         return tag_ptr(ret_conv, true);
23330 }
23331
23332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23333         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
23334         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
23335         return ret_conv;
23336 }
23337
23338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23339         if (!ptr_is_owned(_res)) return;
23340         void* _res_ptr = untag_ptr(_res);
23341         CHECK_ACCESS(_res_ptr);
23342         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
23343         FREE(untag_ptr(_res));
23344         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
23345 }
23346
23347 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
23348         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23349         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
23350         return tag_ptr(ret_conv, true);
23351 }
23352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23353         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
23354         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
23355         return ret_conv;
23356 }
23357
23358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23359         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
23360         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23361         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
23362         return tag_ptr(ret_conv, true);
23363 }
23364
23365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23366         LDKRoutingFees o_conv;
23367         o_conv.inner = untag_ptr(o);
23368         o_conv.is_owned = ptr_is_owned(o);
23369         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23370         o_conv = RoutingFees_clone(&o_conv);
23371         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23372         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
23373         return tag_ptr(ret_conv, true);
23374 }
23375
23376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23377         void* e_ptr = untag_ptr(e);
23378         CHECK_ACCESS(e_ptr);
23379         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23380         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23381         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23382         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
23383         return tag_ptr(ret_conv, true);
23384 }
23385
23386 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23387         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
23388         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
23389         return ret_conv;
23390 }
23391
23392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23393         if (!ptr_is_owned(_res)) return;
23394         void* _res_ptr = untag_ptr(_res);
23395         CHECK_ACCESS(_res_ptr);
23396         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
23397         FREE(untag_ptr(_res));
23398         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
23399 }
23400
23401 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
23402         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23403         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
23404         return tag_ptr(ret_conv, true);
23405 }
23406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23407         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
23408         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
23409         return ret_conv;
23410 }
23411
23412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23413         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
23414         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23415         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
23416         return tag_ptr(ret_conv, true);
23417 }
23418
23419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23420         LDKCVec_NetAddressZ _res_constr;
23421         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23422         if (_res_constr.datalen > 0)
23423                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23424         else
23425                 _res_constr.data = NULL;
23426         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23427         for (size_t m = 0; m < _res_constr.datalen; m++) {
23428                 int64_t _res_conv_12 = _res_vals[m];
23429                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
23430                 CHECK_ACCESS(_res_conv_12_ptr);
23431                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
23432                 FREE(untag_ptr(_res_conv_12));
23433                 _res_constr.data[m] = _res_conv_12_conv;
23434         }
23435         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23436         CVec_NetAddressZ_free(_res_constr);
23437 }
23438
23439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23440         LDKNodeAnnouncementInfo o_conv;
23441         o_conv.inner = untag_ptr(o);
23442         o_conv.is_owned = ptr_is_owned(o);
23443         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23444         o_conv = NodeAnnouncementInfo_clone(&o_conv);
23445         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23446         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
23447         return tag_ptr(ret_conv, true);
23448 }
23449
23450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23451         void* e_ptr = untag_ptr(e);
23452         CHECK_ACCESS(e_ptr);
23453         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23454         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23455         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23456         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
23457         return tag_ptr(ret_conv, true);
23458 }
23459
23460 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23461         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
23462         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
23463         return ret_conv;
23464 }
23465
23466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23467         if (!ptr_is_owned(_res)) return;
23468         void* _res_ptr = untag_ptr(_res);
23469         CHECK_ACCESS(_res_ptr);
23470         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
23471         FREE(untag_ptr(_res));
23472         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
23473 }
23474
23475 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
23476         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23477         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
23478         return tag_ptr(ret_conv, true);
23479 }
23480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23481         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
23482         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
23483         return ret_conv;
23484 }
23485
23486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23487         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
23488         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23489         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
23490         return tag_ptr(ret_conv, true);
23491 }
23492
23493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23494         LDKNodeAlias o_conv;
23495         o_conv.inner = untag_ptr(o);
23496         o_conv.is_owned = ptr_is_owned(o);
23497         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23498         o_conv = NodeAlias_clone(&o_conv);
23499         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23500         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
23501         return tag_ptr(ret_conv, true);
23502 }
23503
23504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23505         void* e_ptr = untag_ptr(e);
23506         CHECK_ACCESS(e_ptr);
23507         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23508         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23509         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23510         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
23511         return tag_ptr(ret_conv, true);
23512 }
23513
23514 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23515         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
23516         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
23517         return ret_conv;
23518 }
23519
23520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23521         if (!ptr_is_owned(_res)) return;
23522         void* _res_ptr = untag_ptr(_res);
23523         CHECK_ACCESS(_res_ptr);
23524         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
23525         FREE(untag_ptr(_res));
23526         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
23527 }
23528
23529 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
23530         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23531         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
23532         return tag_ptr(ret_conv, true);
23533 }
23534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23535         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
23536         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
23537         return ret_conv;
23538 }
23539
23540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23541         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
23542         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23543         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
23544         return tag_ptr(ret_conv, true);
23545 }
23546
23547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23548         LDKNodeInfo o_conv;
23549         o_conv.inner = untag_ptr(o);
23550         o_conv.is_owned = ptr_is_owned(o);
23551         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23552         o_conv = NodeInfo_clone(&o_conv);
23553         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23554         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
23555         return tag_ptr(ret_conv, true);
23556 }
23557
23558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23559         void* e_ptr = untag_ptr(e);
23560         CHECK_ACCESS(e_ptr);
23561         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23562         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23563         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23564         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
23565         return tag_ptr(ret_conv, true);
23566 }
23567
23568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23569         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
23570         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
23571         return ret_conv;
23572 }
23573
23574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23575         if (!ptr_is_owned(_res)) return;
23576         void* _res_ptr = untag_ptr(_res);
23577         CHECK_ACCESS(_res_ptr);
23578         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
23579         FREE(untag_ptr(_res));
23580         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
23581 }
23582
23583 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
23584         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23585         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
23586         return tag_ptr(ret_conv, true);
23587 }
23588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23589         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
23590         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
23591         return ret_conv;
23592 }
23593
23594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23595         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
23596         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23597         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
23598         return tag_ptr(ret_conv, true);
23599 }
23600
23601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23602         LDKNetworkGraph o_conv;
23603         o_conv.inner = untag_ptr(o);
23604         o_conv.is_owned = ptr_is_owned(o);
23605         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23606         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
23607         
23608         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23609         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
23610         return tag_ptr(ret_conv, true);
23611 }
23612
23613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23614         void* e_ptr = untag_ptr(e);
23615         CHECK_ACCESS(e_ptr);
23616         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23617         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23618         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23619         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
23620         return tag_ptr(ret_conv, true);
23621 }
23622
23623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23624         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
23625         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
23626         return ret_conv;
23627 }
23628
23629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23630         if (!ptr_is_owned(_res)) return;
23631         void* _res_ptr = untag_ptr(_res);
23632         CHECK_ACCESS(_res_ptr);
23633         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
23634         FREE(untag_ptr(_res));
23635         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
23636 }
23637
23638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
23639         LDKCVec_NetAddressZ o_constr;
23640         o_constr.datalen = (*env)->GetArrayLength(env, o);
23641         if (o_constr.datalen > 0)
23642                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23643         else
23644                 o_constr.data = NULL;
23645         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
23646         for (size_t m = 0; m < o_constr.datalen; m++) {
23647                 int64_t o_conv_12 = o_vals[m];
23648                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
23649                 CHECK_ACCESS(o_conv_12_ptr);
23650                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
23651                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
23652                 o_constr.data[m] = o_conv_12_conv;
23653         }
23654         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
23655         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
23656         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
23657         int64_t ret_ref = tag_ptr(ret_copy, true);
23658         return ret_ref;
23659 }
23660
23661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
23662         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
23663         *ret_copy = COption_CVec_NetAddressZZ_none();
23664         int64_t ret_ref = tag_ptr(ret_copy, true);
23665         return ret_ref;
23666 }
23667
23668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23669         if (!ptr_is_owned(_res)) return;
23670         void* _res_ptr = untag_ptr(_res);
23671         CHECK_ACCESS(_res_ptr);
23672         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
23673         FREE(untag_ptr(_res));
23674         COption_CVec_NetAddressZZ_free(_res_conv);
23675 }
23676
23677 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
23678         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
23679         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
23680         int64_t ret_ref = tag_ptr(ret_copy, true);
23681         return ret_ref;
23682 }
23683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23684         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
23685         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
23686         return ret_conv;
23687 }
23688
23689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23690         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
23691         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
23692         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
23693         int64_t ret_ref = tag_ptr(ret_copy, true);
23694         return ret_ref;
23695 }
23696
23697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
23698         LDKThirtyTwoBytes o_ref;
23699         CHECK((*env)->GetArrayLength(env, o) == 32);
23700         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
23701         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
23702         *ret_copy = COption_PaymentPreimageZ_some(o_ref);
23703         int64_t ret_ref = tag_ptr(ret_copy, true);
23704         return ret_ref;
23705 }
23706
23707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1none(JNIEnv *env, jclass clz) {
23708         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
23709         *ret_copy = COption_PaymentPreimageZ_none();
23710         int64_t ret_ref = tag_ptr(ret_copy, true);
23711         return ret_ref;
23712 }
23713
23714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23715         if (!ptr_is_owned(_res)) return;
23716         void* _res_ptr = untag_ptr(_res);
23717         CHECK_ACCESS(_res_ptr);
23718         LDKCOption_PaymentPreimageZ _res_conv = *(LDKCOption_PaymentPreimageZ*)(_res_ptr);
23719         FREE(untag_ptr(_res));
23720         COption_PaymentPreimageZ_free(_res_conv);
23721 }
23722
23723 static inline uint64_t COption_PaymentPreimageZ_clone_ptr(LDKCOption_PaymentPreimageZ *NONNULL_PTR arg) {
23724         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
23725         *ret_copy = COption_PaymentPreimageZ_clone(arg);
23726         int64_t ret_ref = tag_ptr(ret_copy, true);
23727         return ret_ref;
23728 }
23729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23730         LDKCOption_PaymentPreimageZ* arg_conv = (LDKCOption_PaymentPreimageZ*)untag_ptr(arg);
23731         int64_t ret_conv = COption_PaymentPreimageZ_clone_ptr(arg_conv);
23732         return ret_conv;
23733 }
23734
23735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23736         LDKCOption_PaymentPreimageZ* orig_conv = (LDKCOption_PaymentPreimageZ*)untag_ptr(orig);
23737         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
23738         *ret_copy = COption_PaymentPreimageZ_clone(orig_conv);
23739         int64_t ret_ref = tag_ptr(ret_copy, true);
23740         return ret_ref;
23741 }
23742
23743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23744         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
23745         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23746         if (_res_constr.datalen > 0)
23747                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
23748         else
23749                 _res_constr.data = NULL;
23750         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23751         for (size_t y = 0; y < _res_constr.datalen; y++) {
23752                 int64_t _res_conv_24 = _res_vals[y];
23753                 LDKHTLCOutputInCommitment _res_conv_24_conv;
23754                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
23755                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
23756                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
23757                 _res_constr.data[y] = _res_conv_24_conv;
23758         }
23759         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23760         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
23761 }
23762
23763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23764         LDKCVec_HTLCDescriptorZ _res_constr;
23765         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23766         if (_res_constr.datalen > 0)
23767                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
23768         else
23769                 _res_constr.data = NULL;
23770         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23771         for (size_t q = 0; q < _res_constr.datalen; q++) {
23772                 int64_t _res_conv_16 = _res_vals[q];
23773                 LDKHTLCDescriptor _res_conv_16_conv;
23774                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23775                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23776                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23777                 _res_constr.data[q] = _res_conv_16_conv;
23778         }
23779         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23780         CVec_HTLCDescriptorZ_free(_res_constr);
23781 }
23782
23783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23784         LDKCVec_UtxoZ _res_constr;
23785         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23786         if (_res_constr.datalen > 0)
23787                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23788         else
23789                 _res_constr.data = NULL;
23790         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23791         for (size_t g = 0; g < _res_constr.datalen; g++) {
23792                 int64_t _res_conv_6 = _res_vals[g];
23793                 LDKUtxo _res_conv_6_conv;
23794                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
23795                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
23796                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
23797                 _res_constr.data[g] = _res_conv_6_conv;
23798         }
23799         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23800         CVec_UtxoZ_free(_res_constr);
23801 }
23802
23803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23804         void* o_ptr = untag_ptr(o);
23805         CHECK_ACCESS(o_ptr);
23806         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
23807         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
23808         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23809         *ret_copy = COption_TxOutZ_some(o_conv);
23810         int64_t ret_ref = tag_ptr(ret_copy, true);
23811         return ret_ref;
23812 }
23813
23814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
23815         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23816         *ret_copy = COption_TxOutZ_none();
23817         int64_t ret_ref = tag_ptr(ret_copy, true);
23818         return ret_ref;
23819 }
23820
23821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23822         if (!ptr_is_owned(_res)) return;
23823         void* _res_ptr = untag_ptr(_res);
23824         CHECK_ACCESS(_res_ptr);
23825         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
23826         FREE(untag_ptr(_res));
23827         COption_TxOutZ_free(_res_conv);
23828 }
23829
23830 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
23831         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23832         *ret_copy = COption_TxOutZ_clone(arg);
23833         int64_t ret_ref = tag_ptr(ret_copy, true);
23834         return ret_ref;
23835 }
23836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23837         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
23838         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
23839         return ret_conv;
23840 }
23841
23842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23843         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
23844         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23845         *ret_copy = COption_TxOutZ_clone(orig_conv);
23846         int64_t ret_ref = tag_ptr(ret_copy, true);
23847         return ret_ref;
23848 }
23849
23850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23851         LDKCVec_InputZ _res_constr;
23852         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23853         if (_res_constr.datalen > 0)
23854                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
23855         else
23856                 _res_constr.data = NULL;
23857         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23858         for (size_t h = 0; h < _res_constr.datalen; h++) {
23859                 int64_t _res_conv_7 = _res_vals[h];
23860                 LDKInput _res_conv_7_conv;
23861                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
23862                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
23863                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
23864                 _res_constr.data[h] = _res_conv_7_conv;
23865         }
23866         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23867         CVec_InputZ_free(_res_constr);
23868 }
23869
23870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23871         LDKCoinSelection o_conv;
23872         o_conv.inner = untag_ptr(o);
23873         o_conv.is_owned = ptr_is_owned(o);
23874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23875         o_conv = CoinSelection_clone(&o_conv);
23876         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23877         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
23878         return tag_ptr(ret_conv, true);
23879 }
23880
23881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
23882         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23883         *ret_conv = CResult_CoinSelectionNoneZ_err();
23884         return tag_ptr(ret_conv, true);
23885 }
23886
23887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23888         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
23889         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
23890         return ret_conv;
23891 }
23892
23893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23894         if (!ptr_is_owned(_res)) return;
23895         void* _res_ptr = untag_ptr(_res);
23896         CHECK_ACCESS(_res_ptr);
23897         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
23898         FREE(untag_ptr(_res));
23899         CResult_CoinSelectionNoneZ_free(_res_conv);
23900 }
23901
23902 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
23903         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23904         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
23905         return tag_ptr(ret_conv, true);
23906 }
23907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23908         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
23909         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
23910         return ret_conv;
23911 }
23912
23913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23914         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
23915         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23916         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
23917         return tag_ptr(ret_conv, true);
23918 }
23919
23920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
23921         LDKCVec_UtxoZ o_constr;
23922         o_constr.datalen = (*env)->GetArrayLength(env, o);
23923         if (o_constr.datalen > 0)
23924                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23925         else
23926                 o_constr.data = NULL;
23927         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
23928         for (size_t g = 0; g < o_constr.datalen; g++) {
23929                 int64_t o_conv_6 = o_vals[g];
23930                 LDKUtxo o_conv_6_conv;
23931                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
23932                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
23933                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
23934                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
23935                 o_constr.data[g] = o_conv_6_conv;
23936         }
23937         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
23938         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23939         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
23940         return tag_ptr(ret_conv, true);
23941 }
23942
23943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
23944         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23945         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
23946         return tag_ptr(ret_conv, true);
23947 }
23948
23949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23950         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
23951         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
23952         return ret_conv;
23953 }
23954
23955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23956         if (!ptr_is_owned(_res)) return;
23957         void* _res_ptr = untag_ptr(_res);
23958         CHECK_ACCESS(_res_ptr);
23959         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
23960         FREE(untag_ptr(_res));
23961         CResult_CVec_UtxoZNoneZ_free(_res_conv);
23962 }
23963
23964 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
23965         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23966         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
23967         return tag_ptr(ret_conv, true);
23968 }
23969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23970         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
23971         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
23972         return ret_conv;
23973 }
23974
23975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23976         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
23977         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23978         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
23979         return tag_ptr(ret_conv, true);
23980 }
23981
23982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
23983         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23984         *ret_copy = COption_u16Z_some(o);
23985         int64_t ret_ref = tag_ptr(ret_copy, true);
23986         return ret_ref;
23987 }
23988
23989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
23990         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23991         *ret_copy = COption_u16Z_none();
23992         int64_t ret_ref = tag_ptr(ret_copy, true);
23993         return ret_ref;
23994 }
23995
23996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23997         if (!ptr_is_owned(_res)) return;
23998         void* _res_ptr = untag_ptr(_res);
23999         CHECK_ACCESS(_res_ptr);
24000         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
24001         FREE(untag_ptr(_res));
24002         COption_u16Z_free(_res_conv);
24003 }
24004
24005 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
24006         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
24007         *ret_copy = COption_u16Z_clone(arg);
24008         int64_t ret_ref = tag_ptr(ret_copy, true);
24009         return ret_ref;
24010 }
24011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24012         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
24013         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
24014         return ret_conv;
24015 }
24016
24017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24018         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
24019         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
24020         *ret_copy = COption_u16Z_clone(orig_conv);
24021         int64_t ret_ref = tag_ptr(ret_copy, true);
24022         return ret_ref;
24023 }
24024
24025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
24026         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
24027         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24028         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
24029         int64_t ret_ref = tag_ptr(ret_copy, true);
24030         return ret_ref;
24031 }
24032
24033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
24034         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24035         *ret_copy = COption_ChannelShutdownStateZ_none();
24036         int64_t ret_ref = tag_ptr(ret_copy, true);
24037         return ret_ref;
24038 }
24039
24040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24041         if (!ptr_is_owned(_res)) return;
24042         void* _res_ptr = untag_ptr(_res);
24043         CHECK_ACCESS(_res_ptr);
24044         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
24045         FREE(untag_ptr(_res));
24046         COption_ChannelShutdownStateZ_free(_res_conv);
24047 }
24048
24049 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
24050         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24051         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
24052         int64_t ret_ref = tag_ptr(ret_copy, true);
24053         return ret_ref;
24054 }
24055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24056         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
24057         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
24058         return ret_conv;
24059 }
24060
24061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24062         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
24063         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24064         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
24065         int64_t ret_ref = tag_ptr(ret_copy, true);
24066         return ret_ref;
24067 }
24068
24069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
24070         LDKThirtyTwoBytes o_ref;
24071         CHECK((*env)->GetArrayLength(env, o) == 32);
24072         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24073         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
24074         *ret_copy = COption_PaymentHashZ_some(o_ref);
24075         int64_t ret_ref = tag_ptr(ret_copy, true);
24076         return ret_ref;
24077 }
24078
24079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1none(JNIEnv *env, jclass clz) {
24080         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
24081         *ret_copy = COption_PaymentHashZ_none();
24082         int64_t ret_ref = tag_ptr(ret_copy, true);
24083         return ret_ref;
24084 }
24085
24086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24087         if (!ptr_is_owned(_res)) return;
24088         void* _res_ptr = untag_ptr(_res);
24089         CHECK_ACCESS(_res_ptr);
24090         LDKCOption_PaymentHashZ _res_conv = *(LDKCOption_PaymentHashZ*)(_res_ptr);
24091         FREE(untag_ptr(_res));
24092         COption_PaymentHashZ_free(_res_conv);
24093 }
24094
24095 static inline uint64_t COption_PaymentHashZ_clone_ptr(LDKCOption_PaymentHashZ *NONNULL_PTR arg) {
24096         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
24097         *ret_copy = COption_PaymentHashZ_clone(arg);
24098         int64_t ret_ref = tag_ptr(ret_copy, true);
24099         return ret_ref;
24100 }
24101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24102         LDKCOption_PaymentHashZ* arg_conv = (LDKCOption_PaymentHashZ*)untag_ptr(arg);
24103         int64_t ret_conv = COption_PaymentHashZ_clone_ptr(arg_conv);
24104         return ret_conv;
24105 }
24106
24107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24108         LDKCOption_PaymentHashZ* orig_conv = (LDKCOption_PaymentHashZ*)untag_ptr(orig);
24109         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
24110         *ret_copy = COption_PaymentHashZ_clone(orig_conv);
24111         int64_t ret_ref = tag_ptr(ret_copy, true);
24112         return ret_ref;
24113 }
24114
24115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24116         LDKThirtyTwoBytes o_ref;
24117         CHECK((*env)->GetArrayLength(env, o) == 32);
24118         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24119         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24120         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
24121         return tag_ptr(ret_conv, true);
24122 }
24123
24124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24125         void* e_ptr = untag_ptr(e);
24126         CHECK_ACCESS(e_ptr);
24127         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24128         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24129         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24130         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
24131         return tag_ptr(ret_conv, true);
24132 }
24133
24134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24135         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
24136         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
24137         return ret_conv;
24138 }
24139
24140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24141         if (!ptr_is_owned(_res)) return;
24142         void* _res_ptr = untag_ptr(_res);
24143         CHECK_ACCESS(_res_ptr);
24144         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
24145         FREE(untag_ptr(_res));
24146         CResult__u832APIErrorZ_free(_res_conv);
24147 }
24148
24149 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
24150         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24151         *ret_conv = CResult__u832APIErrorZ_clone(arg);
24152         return tag_ptr(ret_conv, true);
24153 }
24154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24155         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
24156         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
24157         return ret_conv;
24158 }
24159
24160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24161         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
24162         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24163         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
24164         return tag_ptr(ret_conv, true);
24165 }
24166
24167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24168         LDKCVec_RecentPaymentDetailsZ _res_constr;
24169         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24170         if (_res_constr.datalen > 0)
24171                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
24172         else
24173                 _res_constr.data = NULL;
24174         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24175         for (size_t w = 0; w < _res_constr.datalen; w++) {
24176                 int64_t _res_conv_22 = _res_vals[w];
24177                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
24178                 CHECK_ACCESS(_res_conv_22_ptr);
24179                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
24180                 FREE(untag_ptr(_res_conv_22));
24181                 _res_constr.data[w] = _res_conv_22_conv;
24182         }
24183         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24184         CVec_RecentPaymentDetailsZ_free(_res_constr);
24185 }
24186
24187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
24188         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24189         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
24190         return tag_ptr(ret_conv, true);
24191 }
24192
24193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24194         void* e_ptr = untag_ptr(e);
24195         CHECK_ACCESS(e_ptr);
24196         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24197         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24198         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24199         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
24200         return tag_ptr(ret_conv, true);
24201 }
24202
24203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24204         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
24205         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
24206         return ret_conv;
24207 }
24208
24209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24210         if (!ptr_is_owned(_res)) return;
24211         void* _res_ptr = untag_ptr(_res);
24212         CHECK_ACCESS(_res_ptr);
24213         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
24214         FREE(untag_ptr(_res));
24215         CResult_NonePaymentSendFailureZ_free(_res_conv);
24216 }
24217
24218 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
24219         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24220         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
24221         return tag_ptr(ret_conv, true);
24222 }
24223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24224         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
24225         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
24226         return ret_conv;
24227 }
24228
24229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24230         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
24231         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24232         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
24233         return tag_ptr(ret_conv, true);
24234 }
24235
24236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
24237         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24238         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
24239         return tag_ptr(ret_conv, true);
24240 }
24241
24242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
24243         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
24244         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24245         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
24246         return tag_ptr(ret_conv, true);
24247 }
24248
24249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24250         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
24251         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
24252         return ret_conv;
24253 }
24254
24255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24256         if (!ptr_is_owned(_res)) return;
24257         void* _res_ptr = untag_ptr(_res);
24258         CHECK_ACCESS(_res_ptr);
24259         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
24260         FREE(untag_ptr(_res));
24261         CResult_NoneRetryableSendFailureZ_free(_res_conv);
24262 }
24263
24264 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
24265         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24266         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
24267         return tag_ptr(ret_conv, true);
24268 }
24269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24270         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
24271         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
24272         return ret_conv;
24273 }
24274
24275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24276         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
24277         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24278         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
24279         return tag_ptr(ret_conv, true);
24280 }
24281
24282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24283         LDKThirtyTwoBytes o_ref;
24284         CHECK((*env)->GetArrayLength(env, o) == 32);
24285         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24286         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
24287         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
24288         return tag_ptr(ret_conv, true);
24289 }
24290
24291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24292         void* e_ptr = untag_ptr(e);
24293         CHECK_ACCESS(e_ptr);
24294         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24295         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24296         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
24297         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
24298         return tag_ptr(ret_conv, true);
24299 }
24300
24301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24302         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
24303         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
24304         return ret_conv;
24305 }
24306
24307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24308         if (!ptr_is_owned(_res)) return;
24309         void* _res_ptr = untag_ptr(_res);
24310         CHECK_ACCESS(_res_ptr);
24311         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
24312         FREE(untag_ptr(_res));
24313         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
24314 }
24315
24316 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
24317         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
24318         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
24319         return tag_ptr(ret_conv, true);
24320 }
24321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24322         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
24323         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
24324         return ret_conv;
24325 }
24326
24327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24328         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
24329         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
24330         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
24331         return tag_ptr(ret_conv, true);
24332 }
24333
24334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24335         LDKThirtyTwoBytes o_ref;
24336         CHECK((*env)->GetArrayLength(env, o) == 32);
24337         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24338         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
24339         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
24340         return tag_ptr(ret_conv, true);
24341 }
24342
24343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
24344         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
24345         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
24346         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
24347         return tag_ptr(ret_conv, true);
24348 }
24349
24350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24351         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
24352         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
24353         return ret_conv;
24354 }
24355
24356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24357         if (!ptr_is_owned(_res)) return;
24358         void* _res_ptr = untag_ptr(_res);
24359         CHECK_ACCESS(_res_ptr);
24360         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
24361         FREE(untag_ptr(_res));
24362         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
24363 }
24364
24365 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
24366         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
24367         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
24368         return tag_ptr(ret_conv, true);
24369 }
24370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24371         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
24372         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
24373         return ret_conv;
24374 }
24375
24376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24377         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
24378         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
24379         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
24380         return tag_ptr(ret_conv, true);
24381 }
24382
24383 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
24384         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
24385         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
24386         return tag_ptr(ret_conv, true);
24387 }
24388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24389         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
24390         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
24391         return ret_conv;
24392 }
24393
24394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24395         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
24396         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
24397         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
24398         return tag_ptr(ret_conv, true);
24399 }
24400
24401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
24402         LDKThirtyTwoBytes a_ref;
24403         CHECK((*env)->GetArrayLength(env, a) == 32);
24404         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
24405         LDKThirtyTwoBytes b_ref;
24406         CHECK((*env)->GetArrayLength(env, b) == 32);
24407         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
24408         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
24409         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
24410         return tag_ptr(ret_conv, true);
24411 }
24412
24413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24414         if (!ptr_is_owned(_res)) return;
24415         void* _res_ptr = untag_ptr(_res);
24416         CHECK_ACCESS(_res_ptr);
24417         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
24418         FREE(untag_ptr(_res));
24419         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
24420 }
24421
24422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24423         void* o_ptr = untag_ptr(o);
24424         CHECK_ACCESS(o_ptr);
24425         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
24426         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
24427         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
24428         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
24429         return tag_ptr(ret_conv, true);
24430 }
24431
24432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24433         void* e_ptr = untag_ptr(e);
24434         CHECK_ACCESS(e_ptr);
24435         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24436         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24437         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
24438         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
24439         return tag_ptr(ret_conv, true);
24440 }
24441
24442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24443         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
24444         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
24445         return ret_conv;
24446 }
24447
24448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24449         if (!ptr_is_owned(_res)) return;
24450         void* _res_ptr = untag_ptr(_res);
24451         CHECK_ACCESS(_res_ptr);
24452         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
24453         FREE(untag_ptr(_res));
24454         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
24455 }
24456
24457 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
24458         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
24459         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
24460         return tag_ptr(ret_conv, true);
24461 }
24462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24463         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
24464         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
24465         return ret_conv;
24466 }
24467
24468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24469         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
24470         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
24471         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
24472         return tag_ptr(ret_conv, true);
24473 }
24474
24475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
24476         LDKCVec_ThirtyTwoBytesZ _res_constr;
24477         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24478         if (_res_constr.datalen > 0)
24479                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
24480         else
24481                 _res_constr.data = NULL;
24482         for (size_t i = 0; i < _res_constr.datalen; i++) {
24483                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
24484                 LDKThirtyTwoBytes _res_conv_8_ref;
24485                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
24486                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
24487                 _res_constr.data[i] = _res_conv_8_ref;
24488         }
24489         CVec_ThirtyTwoBytesZ_free(_res_constr);
24490 }
24491
24492 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
24493         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
24494         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
24495         return tag_ptr(ret_conv, true);
24496 }
24497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24498         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
24499         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
24500         return ret_conv;
24501 }
24502
24503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24504         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
24505         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
24506         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
24507         return tag_ptr(ret_conv, true);
24508 }
24509
24510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
24511         LDKThirtyTwoBytes a_ref;
24512         CHECK((*env)->GetArrayLength(env, a) == 32);
24513         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
24514         LDKThirtyTwoBytes b_ref;
24515         CHECK((*env)->GetArrayLength(env, b) == 32);
24516         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
24517         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
24518         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
24519         return tag_ptr(ret_conv, true);
24520 }
24521
24522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24523         if (!ptr_is_owned(_res)) return;
24524         void* _res_ptr = untag_ptr(_res);
24525         CHECK_ACCESS(_res_ptr);
24526         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
24527         FREE(untag_ptr(_res));
24528         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
24529 }
24530
24531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24532         void* o_ptr = untag_ptr(o);
24533         CHECK_ACCESS(o_ptr);
24534         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
24535         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
24536         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
24537         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
24538         return tag_ptr(ret_conv, true);
24539 }
24540
24541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
24542         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
24543         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
24544         return tag_ptr(ret_conv, true);
24545 }
24546
24547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24548         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
24549         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
24550         return ret_conv;
24551 }
24552
24553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24554         if (!ptr_is_owned(_res)) return;
24555         void* _res_ptr = untag_ptr(_res);
24556         CHECK_ACCESS(_res_ptr);
24557         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
24558         FREE(untag_ptr(_res));
24559         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
24560 }
24561
24562 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
24563         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
24564         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
24565         return tag_ptr(ret_conv, true);
24566 }
24567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24568         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
24569         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
24570         return ret_conv;
24571 }
24572
24573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24574         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
24575         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
24576         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
24577         return tag_ptr(ret_conv, true);
24578 }
24579
24580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24581         LDKThirtyTwoBytes o_ref;
24582         CHECK((*env)->GetArrayLength(env, o) == 32);
24583         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24584         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
24585         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
24586         return tag_ptr(ret_conv, true);
24587 }
24588
24589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
24590         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
24591         *ret_conv = CResult_PaymentSecretNoneZ_err();
24592         return tag_ptr(ret_conv, true);
24593 }
24594
24595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24596         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
24597         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
24598         return ret_conv;
24599 }
24600
24601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24602         if (!ptr_is_owned(_res)) return;
24603         void* _res_ptr = untag_ptr(_res);
24604         CHECK_ACCESS(_res_ptr);
24605         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
24606         FREE(untag_ptr(_res));
24607         CResult_PaymentSecretNoneZ_free(_res_conv);
24608 }
24609
24610 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
24611         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
24612         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
24613         return tag_ptr(ret_conv, true);
24614 }
24615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24616         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
24617         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
24618         return ret_conv;
24619 }
24620
24621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24622         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
24623         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
24624         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
24625         return tag_ptr(ret_conv, true);
24626 }
24627
24628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24629         LDKThirtyTwoBytes o_ref;
24630         CHECK((*env)->GetArrayLength(env, o) == 32);
24631         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24632         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
24633         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
24634         return tag_ptr(ret_conv, true);
24635 }
24636
24637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24638         void* e_ptr = untag_ptr(e);
24639         CHECK_ACCESS(e_ptr);
24640         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24641         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24642         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
24643         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
24644         return tag_ptr(ret_conv, true);
24645 }
24646
24647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24648         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
24649         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
24650         return ret_conv;
24651 }
24652
24653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24654         if (!ptr_is_owned(_res)) return;
24655         void* _res_ptr = untag_ptr(_res);
24656         CHECK_ACCESS(_res_ptr);
24657         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
24658         FREE(untag_ptr(_res));
24659         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
24660 }
24661
24662 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
24663         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
24664         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
24665         return tag_ptr(ret_conv, true);
24666 }
24667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24668         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
24669         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
24670         return ret_conv;
24671 }
24672
24673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24674         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
24675         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
24676         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
24677         return tag_ptr(ret_conv, true);
24678 }
24679
24680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
24681         LDKCVec_ChainHashZ o_constr;
24682         o_constr.datalen = (*env)->GetArrayLength(env, o);
24683         if (o_constr.datalen > 0)
24684                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
24685         else
24686                 o_constr.data = NULL;
24687         for (size_t i = 0; i < o_constr.datalen; i++) {
24688                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
24689                 LDKThirtyTwoBytes o_conv_8_ref;
24690                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
24691                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
24692                 o_constr.data[i] = o_conv_8_ref;
24693         }
24694         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
24695         *ret_copy = COption_CVec_ChainHashZZ_some(o_constr);
24696         int64_t ret_ref = tag_ptr(ret_copy, true);
24697         return ret_ref;
24698 }
24699
24700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1none(JNIEnv *env, jclass clz) {
24701         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
24702         *ret_copy = COption_CVec_ChainHashZZ_none();
24703         int64_t ret_ref = tag_ptr(ret_copy, true);
24704         return ret_ref;
24705 }
24706
24707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24708         if (!ptr_is_owned(_res)) return;
24709         void* _res_ptr = untag_ptr(_res);
24710         CHECK_ACCESS(_res_ptr);
24711         LDKCOption_CVec_ChainHashZZ _res_conv = *(LDKCOption_CVec_ChainHashZZ*)(_res_ptr);
24712         FREE(untag_ptr(_res));
24713         COption_CVec_ChainHashZZ_free(_res_conv);
24714 }
24715
24716 static inline uint64_t COption_CVec_ChainHashZZ_clone_ptr(LDKCOption_CVec_ChainHashZZ *NONNULL_PTR arg) {
24717         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
24718         *ret_copy = COption_CVec_ChainHashZZ_clone(arg);
24719         int64_t ret_ref = tag_ptr(ret_copy, true);
24720         return ret_ref;
24721 }
24722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24723         LDKCOption_CVec_ChainHashZZ* arg_conv = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(arg);
24724         int64_t ret_conv = COption_CVec_ChainHashZZ_clone_ptr(arg_conv);
24725         return ret_conv;
24726 }
24727
24728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24729         LDKCOption_CVec_ChainHashZZ* orig_conv = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(orig);
24730         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
24731         *ret_copy = COption_CVec_ChainHashZZ_clone(orig_conv);
24732         int64_t ret_ref = tag_ptr(ret_copy, true);
24733         return ret_ref;
24734 }
24735
24736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24737         LDKCounterpartyForwardingInfo o_conv;
24738         o_conv.inner = untag_ptr(o);
24739         o_conv.is_owned = ptr_is_owned(o);
24740         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24741         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
24742         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24743         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
24744         return tag_ptr(ret_conv, true);
24745 }
24746
24747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24748         void* e_ptr = untag_ptr(e);
24749         CHECK_ACCESS(e_ptr);
24750         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24751         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24752         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24753         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
24754         return tag_ptr(ret_conv, true);
24755 }
24756
24757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24758         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
24759         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
24760         return ret_conv;
24761 }
24762
24763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24764         if (!ptr_is_owned(_res)) return;
24765         void* _res_ptr = untag_ptr(_res);
24766         CHECK_ACCESS(_res_ptr);
24767         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
24768         FREE(untag_ptr(_res));
24769         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
24770 }
24771
24772 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
24773         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24774         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
24775         return tag_ptr(ret_conv, true);
24776 }
24777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24778         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
24779         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
24780         return ret_conv;
24781 }
24782
24783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24784         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
24785         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24786         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
24787         return tag_ptr(ret_conv, true);
24788 }
24789
24790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24791         LDKChannelCounterparty o_conv;
24792         o_conv.inner = untag_ptr(o);
24793         o_conv.is_owned = ptr_is_owned(o);
24794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24795         o_conv = ChannelCounterparty_clone(&o_conv);
24796         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24797         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
24798         return tag_ptr(ret_conv, true);
24799 }
24800
24801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24802         void* e_ptr = untag_ptr(e);
24803         CHECK_ACCESS(e_ptr);
24804         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24805         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24806         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24807         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
24808         return tag_ptr(ret_conv, true);
24809 }
24810
24811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24812         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
24813         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
24814         return ret_conv;
24815 }
24816
24817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24818         if (!ptr_is_owned(_res)) return;
24819         void* _res_ptr = untag_ptr(_res);
24820         CHECK_ACCESS(_res_ptr);
24821         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
24822         FREE(untag_ptr(_res));
24823         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
24824 }
24825
24826 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
24827         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24828         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
24829         return tag_ptr(ret_conv, true);
24830 }
24831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24832         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
24833         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
24834         return ret_conv;
24835 }
24836
24837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24838         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
24839         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24840         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
24841         return tag_ptr(ret_conv, true);
24842 }
24843
24844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24845         LDKChannelDetails o_conv;
24846         o_conv.inner = untag_ptr(o);
24847         o_conv.is_owned = ptr_is_owned(o);
24848         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24849         o_conv = ChannelDetails_clone(&o_conv);
24850         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24851         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
24852         return tag_ptr(ret_conv, true);
24853 }
24854
24855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24856         void* e_ptr = untag_ptr(e);
24857         CHECK_ACCESS(e_ptr);
24858         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24859         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24860         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24861         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
24862         return tag_ptr(ret_conv, true);
24863 }
24864
24865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24866         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
24867         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
24868         return ret_conv;
24869 }
24870
24871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24872         if (!ptr_is_owned(_res)) return;
24873         void* _res_ptr = untag_ptr(_res);
24874         CHECK_ACCESS(_res_ptr);
24875         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
24876         FREE(untag_ptr(_res));
24877         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
24878 }
24879
24880 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
24881         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24882         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
24883         return tag_ptr(ret_conv, true);
24884 }
24885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24886         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
24887         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
24888         return ret_conv;
24889 }
24890
24891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24892         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
24893         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24894         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
24895         return tag_ptr(ret_conv, true);
24896 }
24897
24898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24899         LDKPhantomRouteHints o_conv;
24900         o_conv.inner = untag_ptr(o);
24901         o_conv.is_owned = ptr_is_owned(o);
24902         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24903         o_conv = PhantomRouteHints_clone(&o_conv);
24904         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24905         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
24906         return tag_ptr(ret_conv, true);
24907 }
24908
24909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24910         void* e_ptr = untag_ptr(e);
24911         CHECK_ACCESS(e_ptr);
24912         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24913         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24914         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24915         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
24916         return tag_ptr(ret_conv, true);
24917 }
24918
24919 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24920         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
24921         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
24922         return ret_conv;
24923 }
24924
24925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24926         if (!ptr_is_owned(_res)) return;
24927         void* _res_ptr = untag_ptr(_res);
24928         CHECK_ACCESS(_res_ptr);
24929         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
24930         FREE(untag_ptr(_res));
24931         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
24932 }
24933
24934 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
24935         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24936         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
24937         return tag_ptr(ret_conv, true);
24938 }
24939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24940         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
24941         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
24942         return ret_conv;
24943 }
24944
24945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24946         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
24947         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24948         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
24949         return tag_ptr(ret_conv, true);
24950 }
24951
24952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
24953         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
24954         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
24955         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
24956         return tag_ptr(ret_conv, true);
24957 }
24958
24959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24960         void* e_ptr = untag_ptr(e);
24961         CHECK_ACCESS(e_ptr);
24962         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24963         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24964         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
24965         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
24966         return tag_ptr(ret_conv, true);
24967 }
24968
24969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24970         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
24971         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
24972         return ret_conv;
24973 }
24974
24975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24976         if (!ptr_is_owned(_res)) return;
24977         void* _res_ptr = untag_ptr(_res);
24978         CHECK_ACCESS(_res_ptr);
24979         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
24980         FREE(untag_ptr(_res));
24981         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
24982 }
24983
24984 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
24985         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
24986         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
24987         return tag_ptr(ret_conv, true);
24988 }
24989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24990         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
24991         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
24992         return ret_conv;
24993 }
24994
24995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24996         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
24997         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
24998         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
24999         return tag_ptr(ret_conv, true);
25000 }
25001
25002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25003         LDKCVec_ChannelMonitorZ _res_constr;
25004         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25005         if (_res_constr.datalen > 0)
25006                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
25007         else
25008                 _res_constr.data = NULL;
25009         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25010         for (size_t q = 0; q < _res_constr.datalen; q++) {
25011                 int64_t _res_conv_16 = _res_vals[q];
25012                 LDKChannelMonitor _res_conv_16_conv;
25013                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25014                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25015                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25016                 _res_constr.data[q] = _res_conv_16_conv;
25017         }
25018         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25019         CVec_ChannelMonitorZ_free(_res_constr);
25020 }
25021
25022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
25023         LDKThirtyTwoBytes a_ref;
25024         CHECK((*env)->GetArrayLength(env, a) == 32);
25025         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25026         LDKChannelManager b_conv;
25027         b_conv.inner = untag_ptr(b);
25028         b_conv.is_owned = ptr_is_owned(b);
25029         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25030         // WARNING: we need a move here but no clone is available for LDKChannelManager
25031         
25032         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
25033         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
25034         return tag_ptr(ret_conv, true);
25035 }
25036
25037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25038         if (!ptr_is_owned(_res)) return;
25039         void* _res_ptr = untag_ptr(_res);
25040         CHECK_ACCESS(_res_ptr);
25041         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
25042         FREE(untag_ptr(_res));
25043         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
25044 }
25045
25046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25047         void* o_ptr = untag_ptr(o);
25048         CHECK_ACCESS(o_ptr);
25049         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
25050         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
25051         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
25052         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
25053         return tag_ptr(ret_conv, true);
25054 }
25055
25056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25057         void* e_ptr = untag_ptr(e);
25058         CHECK_ACCESS(e_ptr);
25059         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25060         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25061         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
25062         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
25063         return tag_ptr(ret_conv, true);
25064 }
25065
25066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25067         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
25068         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
25069         return ret_conv;
25070 }
25071
25072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25073         if (!ptr_is_owned(_res)) return;
25074         void* _res_ptr = untag_ptr(_res);
25075         CHECK_ACCESS(_res_ptr);
25076         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
25077         FREE(untag_ptr(_res));
25078         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
25079 }
25080
25081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25082         void* o_ptr = untag_ptr(o);
25083         CHECK_ACCESS(o_ptr);
25084         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25085         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25086         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25087         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
25088         return tag_ptr(ret_conv, true);
25089 }
25090
25091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25092         void* e_ptr = untag_ptr(e);
25093         CHECK_ACCESS(e_ptr);
25094         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25095         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25096         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25097         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
25098         return tag_ptr(ret_conv, true);
25099 }
25100
25101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25102         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
25103         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
25104         return ret_conv;
25105 }
25106
25107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25108         if (!ptr_is_owned(_res)) return;
25109         void* _res_ptr = untag_ptr(_res);
25110         CHECK_ACCESS(_res_ptr);
25111         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
25112         FREE(untag_ptr(_res));
25113         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
25114 }
25115
25116 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
25117         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25118         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
25119         return tag_ptr(ret_conv, true);
25120 }
25121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25122         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
25123         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
25124         return ret_conv;
25125 }
25126
25127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25128         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
25129         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25130         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
25131         return tag_ptr(ret_conv, true);
25132 }
25133
25134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25135         LDKChannelConfig o_conv;
25136         o_conv.inner = untag_ptr(o);
25137         o_conv.is_owned = ptr_is_owned(o);
25138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25139         o_conv = ChannelConfig_clone(&o_conv);
25140         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25141         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
25142         return tag_ptr(ret_conv, true);
25143 }
25144
25145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25146         void* e_ptr = untag_ptr(e);
25147         CHECK_ACCESS(e_ptr);
25148         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25149         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25150         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25151         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
25152         return tag_ptr(ret_conv, true);
25153 }
25154
25155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25156         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
25157         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
25158         return ret_conv;
25159 }
25160
25161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25162         if (!ptr_is_owned(_res)) return;
25163         void* _res_ptr = untag_ptr(_res);
25164         CHECK_ACCESS(_res_ptr);
25165         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
25166         FREE(untag_ptr(_res));
25167         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
25168 }
25169
25170 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
25171         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25172         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
25173         return tag_ptr(ret_conv, true);
25174 }
25175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25176         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
25177         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
25178         return ret_conv;
25179 }
25180
25181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25182         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
25183         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25184         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
25185         return tag_ptr(ret_conv, true);
25186 }
25187
25188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25189         void* o_ptr = untag_ptr(o);
25190         CHECK_ACCESS(o_ptr);
25191         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25192         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25193         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25194         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
25195         int64_t ret_ref = tag_ptr(ret_copy, true);
25196         return ret_ref;
25197 }
25198
25199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
25200         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25201         *ret_copy = COption_MaxDustHTLCExposureZ_none();
25202         int64_t ret_ref = tag_ptr(ret_copy, true);
25203         return ret_ref;
25204 }
25205
25206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25207         if (!ptr_is_owned(_res)) return;
25208         void* _res_ptr = untag_ptr(_res);
25209         CHECK_ACCESS(_res_ptr);
25210         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
25211         FREE(untag_ptr(_res));
25212         COption_MaxDustHTLCExposureZ_free(_res_conv);
25213 }
25214
25215 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
25216         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25217         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
25218         int64_t ret_ref = tag_ptr(ret_copy, true);
25219         return ret_ref;
25220 }
25221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25222         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
25223         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
25224         return ret_conv;
25225 }
25226
25227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25228         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
25229         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25230         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
25231         int64_t ret_ref = tag_ptr(ret_copy, true);
25232         return ret_ref;
25233 }
25234
25235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25236         void* o_ptr = untag_ptr(o);
25237         CHECK_ACCESS(o_ptr);
25238         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
25239         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
25240         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25241         *ret_copy = COption_APIErrorZ_some(o_conv);
25242         int64_t ret_ref = tag_ptr(ret_copy, true);
25243         return ret_ref;
25244 }
25245
25246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
25247         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25248         *ret_copy = COption_APIErrorZ_none();
25249         int64_t ret_ref = tag_ptr(ret_copy, true);
25250         return ret_ref;
25251 }
25252
25253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25254         if (!ptr_is_owned(_res)) return;
25255         void* _res_ptr = untag_ptr(_res);
25256         CHECK_ACCESS(_res_ptr);
25257         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
25258         FREE(untag_ptr(_res));
25259         COption_APIErrorZ_free(_res_conv);
25260 }
25261
25262 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
25263         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25264         *ret_copy = COption_APIErrorZ_clone(arg);
25265         int64_t ret_ref = tag_ptr(ret_copy, true);
25266         return ret_ref;
25267 }
25268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25269         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
25270         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
25271         return ret_conv;
25272 }
25273
25274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25275         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
25276         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25277         *ret_copy = COption_APIErrorZ_clone(orig_conv);
25278         int64_t ret_ref = tag_ptr(ret_copy, true);
25279         return ret_ref;
25280 }
25281
25282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25283         void* o_ptr = untag_ptr(o);
25284         CHECK_ACCESS(o_ptr);
25285         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
25286         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
25287         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25288         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
25289         return tag_ptr(ret_conv, true);
25290 }
25291
25292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25293         void* e_ptr = untag_ptr(e);
25294         CHECK_ACCESS(e_ptr);
25295         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25296         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25297         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25298         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
25299         return tag_ptr(ret_conv, true);
25300 }
25301
25302 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25303         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
25304         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
25305         return ret_conv;
25306 }
25307
25308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25309         if (!ptr_is_owned(_res)) return;
25310         void* _res_ptr = untag_ptr(_res);
25311         CHECK_ACCESS(_res_ptr);
25312         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
25313         FREE(untag_ptr(_res));
25314         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
25315 }
25316
25317 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
25318         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25319         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
25320         return tag_ptr(ret_conv, true);
25321 }
25322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25323         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
25324         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
25325         return ret_conv;
25326 }
25327
25328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25329         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
25330         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25331         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
25332         return tag_ptr(ret_conv, true);
25333 }
25334
25335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25336         LDKChannelMonitorUpdate o_conv;
25337         o_conv.inner = untag_ptr(o);
25338         o_conv.is_owned = ptr_is_owned(o);
25339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25340         o_conv = ChannelMonitorUpdate_clone(&o_conv);
25341         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25342         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
25343         return tag_ptr(ret_conv, true);
25344 }
25345
25346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25347         void* e_ptr = untag_ptr(e);
25348         CHECK_ACCESS(e_ptr);
25349         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25350         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25351         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25352         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
25353         return tag_ptr(ret_conv, true);
25354 }
25355
25356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25357         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
25358         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
25359         return ret_conv;
25360 }
25361
25362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25363         if (!ptr_is_owned(_res)) return;
25364         void* _res_ptr = untag_ptr(_res);
25365         CHECK_ACCESS(_res_ptr);
25366         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
25367         FREE(untag_ptr(_res));
25368         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
25369 }
25370
25371 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
25372         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25373         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
25374         return tag_ptr(ret_conv, true);
25375 }
25376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25377         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
25378         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
25379         return ret_conv;
25380 }
25381
25382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25383         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
25384         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25385         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
25386         return tag_ptr(ret_conv, true);
25387 }
25388
25389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25390         void* o_ptr = untag_ptr(o);
25391         CHECK_ACCESS(o_ptr);
25392         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
25393         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
25394         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25395         *ret_copy = COption_MonitorEventZ_some(o_conv);
25396         int64_t ret_ref = tag_ptr(ret_copy, true);
25397         return ret_ref;
25398 }
25399
25400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
25401         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25402         *ret_copy = COption_MonitorEventZ_none();
25403         int64_t ret_ref = tag_ptr(ret_copy, true);
25404         return ret_ref;
25405 }
25406
25407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25408         if (!ptr_is_owned(_res)) return;
25409         void* _res_ptr = untag_ptr(_res);
25410         CHECK_ACCESS(_res_ptr);
25411         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
25412         FREE(untag_ptr(_res));
25413         COption_MonitorEventZ_free(_res_conv);
25414 }
25415
25416 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
25417         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25418         *ret_copy = COption_MonitorEventZ_clone(arg);
25419         int64_t ret_ref = tag_ptr(ret_copy, true);
25420         return ret_ref;
25421 }
25422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25423         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
25424         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
25425         return ret_conv;
25426 }
25427
25428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25429         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
25430         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25431         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
25432         int64_t ret_ref = tag_ptr(ret_copy, true);
25433         return ret_ref;
25434 }
25435
25436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25437         void* o_ptr = untag_ptr(o);
25438         CHECK_ACCESS(o_ptr);
25439         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
25440         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
25441         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25442         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
25443         return tag_ptr(ret_conv, true);
25444 }
25445
25446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25447         void* e_ptr = untag_ptr(e);
25448         CHECK_ACCESS(e_ptr);
25449         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25450         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25451         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25452         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
25453         return tag_ptr(ret_conv, true);
25454 }
25455
25456 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25457         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
25458         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
25459         return ret_conv;
25460 }
25461
25462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25463         if (!ptr_is_owned(_res)) return;
25464         void* _res_ptr = untag_ptr(_res);
25465         CHECK_ACCESS(_res_ptr);
25466         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
25467         FREE(untag_ptr(_res));
25468         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
25469 }
25470
25471 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
25472         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25473         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
25474         return tag_ptr(ret_conv, true);
25475 }
25476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25477         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
25478         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
25479         return ret_conv;
25480 }
25481
25482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25483         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
25484         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25485         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
25486         return tag_ptr(ret_conv, true);
25487 }
25488
25489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25490         LDKHTLCUpdate o_conv;
25491         o_conv.inner = untag_ptr(o);
25492         o_conv.is_owned = ptr_is_owned(o);
25493         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25494         o_conv = HTLCUpdate_clone(&o_conv);
25495         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25496         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
25497         return tag_ptr(ret_conv, true);
25498 }
25499
25500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25501         void* e_ptr = untag_ptr(e);
25502         CHECK_ACCESS(e_ptr);
25503         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25504         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25505         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25506         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
25507         return tag_ptr(ret_conv, true);
25508 }
25509
25510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25511         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
25512         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
25513         return ret_conv;
25514 }
25515
25516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25517         if (!ptr_is_owned(_res)) return;
25518         void* _res_ptr = untag_ptr(_res);
25519         CHECK_ACCESS(_res_ptr);
25520         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
25521         FREE(untag_ptr(_res));
25522         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
25523 }
25524
25525 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
25526         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25527         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
25528         return tag_ptr(ret_conv, true);
25529 }
25530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25531         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
25532         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
25533         return ret_conv;
25534 }
25535
25536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25537         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
25538         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25539         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
25540         return tag_ptr(ret_conv, true);
25541 }
25542
25543 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
25544         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25545         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
25546         return tag_ptr(ret_conv, true);
25547 }
25548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25549         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
25550         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
25551         return ret_conv;
25552 }
25553
25554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25555         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
25556         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25557         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
25558         return tag_ptr(ret_conv, true);
25559 }
25560
25561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
25562         LDKOutPoint a_conv;
25563         a_conv.inner = untag_ptr(a);
25564         a_conv.is_owned = ptr_is_owned(a);
25565         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25566         a_conv = OutPoint_clone(&a_conv);
25567         LDKCVec_u8Z b_ref;
25568         b_ref.datalen = (*env)->GetArrayLength(env, b);
25569         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25570         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
25571         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25572         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
25573         return tag_ptr(ret_conv, true);
25574 }
25575
25576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25577         if (!ptr_is_owned(_res)) return;
25578         void* _res_ptr = untag_ptr(_res);
25579         CHECK_ACCESS(_res_ptr);
25580         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
25581         FREE(untag_ptr(_res));
25582         C2Tuple_OutPointScriptZ_free(_res_conv);
25583 }
25584
25585 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
25586         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
25587         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
25588         return tag_ptr(ret_conv, true);
25589 }
25590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25591         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
25592         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
25593         return ret_conv;
25594 }
25595
25596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25597         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
25598         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
25599         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
25600         return tag_ptr(ret_conv, true);
25601 }
25602
25603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
25604         LDKCVec_u8Z b_ref;
25605         b_ref.datalen = (*env)->GetArrayLength(env, b);
25606         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25607         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
25608         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
25609         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
25610         return tag_ptr(ret_conv, true);
25611 }
25612
25613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25614         if (!ptr_is_owned(_res)) return;
25615         void* _res_ptr = untag_ptr(_res);
25616         CHECK_ACCESS(_res_ptr);
25617         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
25618         FREE(untag_ptr(_res));
25619         C2Tuple_u32ScriptZ_free(_res_conv);
25620 }
25621
25622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25623         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
25624         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25625         if (_res_constr.datalen > 0)
25626                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
25627         else
25628                 _res_constr.data = NULL;
25629         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25630         for (size_t v = 0; v < _res_constr.datalen; v++) {
25631                 int64_t _res_conv_21 = _res_vals[v];
25632                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
25633                 CHECK_ACCESS(_res_conv_21_ptr);
25634                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
25635                 FREE(untag_ptr(_res_conv_21));
25636                 _res_constr.data[v] = _res_conv_21_conv;
25637         }
25638         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25639         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
25640 }
25641
25642 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
25643         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25644         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
25645         return tag_ptr(ret_conv, true);
25646 }
25647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25648         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
25649         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
25650         return ret_conv;
25651 }
25652
25653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25654         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
25655         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25656         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
25657         return tag_ptr(ret_conv, true);
25658 }
25659
25660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
25661         LDKThirtyTwoBytes a_ref;
25662         CHECK((*env)->GetArrayLength(env, a) == 32);
25663         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25664         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
25665         b_constr.datalen = (*env)->GetArrayLength(env, b);
25666         if (b_constr.datalen > 0)
25667                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
25668         else
25669                 b_constr.data = NULL;
25670         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
25671         for (size_t v = 0; v < b_constr.datalen; v++) {
25672                 int64_t b_conv_21 = b_vals[v];
25673                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
25674                 CHECK_ACCESS(b_conv_21_ptr);
25675                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
25676                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
25677                 b_constr.data[v] = b_conv_21_conv;
25678         }
25679         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
25680         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25681         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
25682         return tag_ptr(ret_conv, true);
25683 }
25684
25685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25686         if (!ptr_is_owned(_res)) return;
25687         void* _res_ptr = untag_ptr(_res);
25688         CHECK_ACCESS(_res_ptr);
25689         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
25690         FREE(untag_ptr(_res));
25691         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
25692 }
25693
25694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25695         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
25696         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25697         if (_res_constr.datalen > 0)
25698                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
25699         else
25700                 _res_constr.data = NULL;
25701         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25702         for (size_t o = 0; o < _res_constr.datalen; o++) {
25703                 int64_t _res_conv_40 = _res_vals[o];
25704                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
25705                 CHECK_ACCESS(_res_conv_40_ptr);
25706                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
25707                 FREE(untag_ptr(_res_conv_40));
25708                 _res_constr.data[o] = _res_conv_40_conv;
25709         }
25710         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25711         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
25712 }
25713
25714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
25715         LDKCVec_TransactionZ _res_constr;
25716         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25717         if (_res_constr.datalen > 0)
25718                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
25719         else
25720                 _res_constr.data = NULL;
25721         for (size_t i = 0; i < _res_constr.datalen; i++) {
25722                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
25723                 LDKTransaction _res_conv_8_ref;
25724                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
25725                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
25726                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
25727                 _res_conv_8_ref.data_is_owned = true;
25728                 _res_constr.data[i] = _res_conv_8_ref;
25729         }
25730         CVec_TransactionZ_free(_res_constr);
25731 }
25732
25733 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
25734         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25735         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
25736         return tag_ptr(ret_conv, true);
25737 }
25738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25739         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
25740         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
25741         return ret_conv;
25742 }
25743
25744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25745         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
25746         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25747         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
25748         return tag_ptr(ret_conv, true);
25749 }
25750
25751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
25752         void* b_ptr = untag_ptr(b);
25753         CHECK_ACCESS(b_ptr);
25754         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
25755         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
25756         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25757         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
25758         return tag_ptr(ret_conv, true);
25759 }
25760
25761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25762         if (!ptr_is_owned(_res)) return;
25763         void* _res_ptr = untag_ptr(_res);
25764         CHECK_ACCESS(_res_ptr);
25765         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
25766         FREE(untag_ptr(_res));
25767         C2Tuple_u32TxOutZ_free(_res_conv);
25768 }
25769
25770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25771         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
25772         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25773         if (_res_constr.datalen > 0)
25774                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25775         else
25776                 _res_constr.data = NULL;
25777         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25778         for (size_t u = 0; u < _res_constr.datalen; u++) {
25779                 int64_t _res_conv_20 = _res_vals[u];
25780                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
25781                 CHECK_ACCESS(_res_conv_20_ptr);
25782                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
25783                 FREE(untag_ptr(_res_conv_20));
25784                 _res_constr.data[u] = _res_conv_20_conv;
25785         }
25786         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25787         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
25788 }
25789
25790 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
25791         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25792         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
25793         return tag_ptr(ret_conv, true);
25794 }
25795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25796         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
25797         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
25798         return ret_conv;
25799 }
25800
25801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25802         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
25803         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25804         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
25805         return tag_ptr(ret_conv, true);
25806 }
25807
25808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
25809         LDKThirtyTwoBytes a_ref;
25810         CHECK((*env)->GetArrayLength(env, a) == 32);
25811         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25812         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
25813         b_constr.datalen = (*env)->GetArrayLength(env, b);
25814         if (b_constr.datalen > 0)
25815                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25816         else
25817                 b_constr.data = NULL;
25818         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
25819         for (size_t u = 0; u < b_constr.datalen; u++) {
25820                 int64_t b_conv_20 = b_vals[u];
25821                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
25822                 CHECK_ACCESS(b_conv_20_ptr);
25823                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
25824                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
25825                 b_constr.data[u] = b_conv_20_conv;
25826         }
25827         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
25828         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25829         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
25830         return tag_ptr(ret_conv, true);
25831 }
25832
25833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25834         if (!ptr_is_owned(_res)) return;
25835         void* _res_ptr = untag_ptr(_res);
25836         CHECK_ACCESS(_res_ptr);
25837         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
25838         FREE(untag_ptr(_res));
25839         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
25840 }
25841
25842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25843         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
25844         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25845         if (_res_constr.datalen > 0)
25846                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
25847         else
25848                 _res_constr.data = NULL;
25849         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25850         for (size_t n = 0; n < _res_constr.datalen; n++) {
25851                 int64_t _res_conv_39 = _res_vals[n];
25852                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
25853                 CHECK_ACCESS(_res_conv_39_ptr);
25854                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
25855                 FREE(untag_ptr(_res_conv_39));
25856                 _res_constr.data[n] = _res_conv_39_conv;
25857         }
25858         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25859         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
25860 }
25861
25862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25863         LDKCVec_BalanceZ _res_constr;
25864         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25865         if (_res_constr.datalen > 0)
25866                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
25867         else
25868                 _res_constr.data = NULL;
25869         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25870         for (size_t j = 0; j < _res_constr.datalen; j++) {
25871                 int64_t _res_conv_9 = _res_vals[j];
25872                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
25873                 CHECK_ACCESS(_res_conv_9_ptr);
25874                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
25875                 FREE(untag_ptr(_res_conv_9));
25876                 _res_constr.data[j] = _res_conv_9_conv;
25877         }
25878         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25879         CVec_BalanceZ_free(_res_constr);
25880 }
25881
25882 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
25883         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
25884         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
25885         return tag_ptr(ret_conv, true);
25886 }
25887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25888         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
25889         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
25890         return ret_conv;
25891 }
25892
25893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25894         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
25895         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
25896         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
25897         return tag_ptr(ret_conv, true);
25898 }
25899
25900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
25901         LDKThirtyTwoBytes a_ref;
25902         CHECK((*env)->GetArrayLength(env, a) == 32);
25903         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25904         LDKChannelMonitor b_conv;
25905         b_conv.inner = untag_ptr(b);
25906         b_conv.is_owned = ptr_is_owned(b);
25907         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25908         b_conv = ChannelMonitor_clone(&b_conv);
25909         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
25910         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
25911         return tag_ptr(ret_conv, true);
25912 }
25913
25914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25915         if (!ptr_is_owned(_res)) return;
25916         void* _res_ptr = untag_ptr(_res);
25917         CHECK_ACCESS(_res_ptr);
25918         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
25919         FREE(untag_ptr(_res));
25920         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
25921 }
25922
25923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25924         void* o_ptr = untag_ptr(o);
25925         CHECK_ACCESS(o_ptr);
25926         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
25927         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
25928         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25929         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
25930         return tag_ptr(ret_conv, true);
25931 }
25932
25933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25934         void* e_ptr = untag_ptr(e);
25935         CHECK_ACCESS(e_ptr);
25936         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25937         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25938         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25939         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
25940         return tag_ptr(ret_conv, true);
25941 }
25942
25943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25944         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
25945         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
25946         return ret_conv;
25947 }
25948
25949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25950         if (!ptr_is_owned(_res)) return;
25951         void* _res_ptr = untag_ptr(_res);
25952         CHECK_ACCESS(_res_ptr);
25953         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
25954         FREE(untag_ptr(_res));
25955         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
25956 }
25957
25958 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
25959         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25960         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
25961         return tag_ptr(ret_conv, true);
25962 }
25963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25964         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
25965         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
25966         return ret_conv;
25967 }
25968
25969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25970         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
25971         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25972         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
25973         return tag_ptr(ret_conv, true);
25974 }
25975
25976 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
25977         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
25978         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
25979         return tag_ptr(ret_conv, true);
25980 }
25981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25982         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
25983         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
25984         return ret_conv;
25985 }
25986
25987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25988         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
25989         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
25990         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
25991         return tag_ptr(ret_conv, true);
25992 }
25993
25994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
25995         LDKPublicKey a_ref;
25996         CHECK((*env)->GetArrayLength(env, a) == 33);
25997         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
25998         void* b_ptr = untag_ptr(b);
25999         CHECK_ACCESS(b_ptr);
26000         LDKType b_conv = *(LDKType*)(b_ptr);
26001         if (b_conv.free == LDKType_JCalls_free) {
26002                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26003                 LDKType_JCalls_cloned(&b_conv);
26004         }
26005         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26006         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
26007         return tag_ptr(ret_conv, true);
26008 }
26009
26010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26011         if (!ptr_is_owned(_res)) return;
26012         void* _res_ptr = untag_ptr(_res);
26013         CHECK_ACCESS(_res_ptr);
26014         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
26015         FREE(untag_ptr(_res));
26016         C2Tuple_PublicKeyTypeZ_free(_res_conv);
26017 }
26018
26019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26020         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
26021         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26022         if (_res_constr.datalen > 0)
26023                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
26024         else
26025                 _res_constr.data = NULL;
26026         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26027         for (size_t z = 0; z < _res_constr.datalen; z++) {
26028                 int64_t _res_conv_25 = _res_vals[z];
26029                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
26030                 CHECK_ACCESS(_res_conv_25_ptr);
26031                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
26032                 FREE(untag_ptr(_res_conv_25));
26033                 _res_constr.data[z] = _res_conv_25_conv;
26034         }
26035         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26036         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
26037 }
26038
26039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26040         void* o_ptr = untag_ptr(o);
26041         CHECK_ACCESS(o_ptr);
26042         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
26043         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
26044         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26045         *ret_copy = COption_OffersMessageZ_some(o_conv);
26046         int64_t ret_ref = tag_ptr(ret_copy, true);
26047         return ret_ref;
26048 }
26049
26050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
26051         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26052         *ret_copy = COption_OffersMessageZ_none();
26053         int64_t ret_ref = tag_ptr(ret_copy, true);
26054         return ret_ref;
26055 }
26056
26057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26058         if (!ptr_is_owned(_res)) return;
26059         void* _res_ptr = untag_ptr(_res);
26060         CHECK_ACCESS(_res_ptr);
26061         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
26062         FREE(untag_ptr(_res));
26063         COption_OffersMessageZ_free(_res_conv);
26064 }
26065
26066 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
26067         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26068         *ret_copy = COption_OffersMessageZ_clone(arg);
26069         int64_t ret_ref = tag_ptr(ret_copy, true);
26070         return ret_ref;
26071 }
26072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26073         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
26074         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
26075         return ret_conv;
26076 }
26077
26078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26079         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
26080         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26081         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
26082         int64_t ret_ref = tag_ptr(ret_copy, true);
26083         return ret_ref;
26084 }
26085
26086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26087         void* o_ptr = untag_ptr(o);
26088         CHECK_ACCESS(o_ptr);
26089         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
26090         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
26091                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26092                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
26093         }
26094         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
26095         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
26096         int64_t ret_ref = tag_ptr(ret_copy, true);
26097         return ret_ref;
26098 }
26099
26100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
26101         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
26102         *ret_copy = COption_CustomOnionMessageContentsZ_none();
26103         int64_t ret_ref = tag_ptr(ret_copy, true);
26104         return ret_ref;
26105 }
26106
26107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26108         if (!ptr_is_owned(_res)) return;
26109         void* _res_ptr = untag_ptr(_res);
26110         CHECK_ACCESS(_res_ptr);
26111         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
26112         FREE(untag_ptr(_res));
26113         COption_CustomOnionMessageContentsZ_free(_res_conv);
26114 }
26115
26116 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
26117         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
26118         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
26119         int64_t ret_ref = tag_ptr(ret_copy, true);
26120         return ret_ref;
26121 }
26122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26123         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
26124         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
26125         return ret_conv;
26126 }
26127
26128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26129         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
26130         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
26131         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
26132         int64_t ret_ref = tag_ptr(ret_copy, true);
26133         return ret_ref;
26134 }
26135
26136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26137         void* o_ptr = untag_ptr(o);
26138         CHECK_ACCESS(o_ptr);
26139         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
26140         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
26141         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
26142         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
26143         return tag_ptr(ret_conv, true);
26144 }
26145
26146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26147         void* e_ptr = untag_ptr(e);
26148         CHECK_ACCESS(e_ptr);
26149         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26150         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26151         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
26152         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
26153         return tag_ptr(ret_conv, true);
26154 }
26155
26156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26157         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
26158         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
26159         return ret_conv;
26160 }
26161
26162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26163         if (!ptr_is_owned(_res)) return;
26164         void* _res_ptr = untag_ptr(_res);
26165         CHECK_ACCESS(_res_ptr);
26166         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
26167         FREE(untag_ptr(_res));
26168         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
26169 }
26170
26171 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
26172         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
26173         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
26174         return tag_ptr(ret_conv, true);
26175 }
26176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26177         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
26178         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
26179         return ret_conv;
26180 }
26181
26182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26183         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
26184         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
26185         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
26186         return tag_ptr(ret_conv, true);
26187 }
26188
26189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26190         void* o_ptr = untag_ptr(o);
26191         CHECK_ACCESS(o_ptr);
26192         LDKType o_conv = *(LDKType*)(o_ptr);
26193         if (o_conv.free == LDKType_JCalls_free) {
26194                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26195                 LDKType_JCalls_cloned(&o_conv);
26196         }
26197         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26198         *ret_copy = COption_TypeZ_some(o_conv);
26199         int64_t ret_ref = tag_ptr(ret_copy, true);
26200         return ret_ref;
26201 }
26202
26203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
26204         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26205         *ret_copy = COption_TypeZ_none();
26206         int64_t ret_ref = tag_ptr(ret_copy, true);
26207         return ret_ref;
26208 }
26209
26210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26211         if (!ptr_is_owned(_res)) return;
26212         void* _res_ptr = untag_ptr(_res);
26213         CHECK_ACCESS(_res_ptr);
26214         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
26215         FREE(untag_ptr(_res));
26216         COption_TypeZ_free(_res_conv);
26217 }
26218
26219 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
26220         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26221         *ret_copy = COption_TypeZ_clone(arg);
26222         int64_t ret_ref = tag_ptr(ret_copy, true);
26223         return ret_ref;
26224 }
26225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26226         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
26227         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
26228         return ret_conv;
26229 }
26230
26231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26232         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
26233         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26234         *ret_copy = COption_TypeZ_clone(orig_conv);
26235         int64_t ret_ref = tag_ptr(ret_copy, true);
26236         return ret_ref;
26237 }
26238
26239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26240         void* o_ptr = untag_ptr(o);
26241         CHECK_ACCESS(o_ptr);
26242         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
26243         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
26244         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26245         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
26246         return tag_ptr(ret_conv, true);
26247 }
26248
26249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26250         void* e_ptr = untag_ptr(e);
26251         CHECK_ACCESS(e_ptr);
26252         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26253         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26254         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26255         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
26256         return tag_ptr(ret_conv, true);
26257 }
26258
26259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26260         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
26261         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
26262         return ret_conv;
26263 }
26264
26265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26266         if (!ptr_is_owned(_res)) return;
26267         void* _res_ptr = untag_ptr(_res);
26268         CHECK_ACCESS(_res_ptr);
26269         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
26270         FREE(untag_ptr(_res));
26271         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
26272 }
26273
26274 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
26275         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26276         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
26277         return tag_ptr(ret_conv, true);
26278 }
26279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26280         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
26281         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
26282         return ret_conv;
26283 }
26284
26285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26286         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
26287         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26288         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
26289         return tag_ptr(ret_conv, true);
26290 }
26291
26292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26293         void* o_ptr = untag_ptr(o);
26294         CHECK_ACCESS(o_ptr);
26295         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
26296         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
26297         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
26298         *ret_copy = COption_NetAddressZ_some(o_conv);
26299         int64_t ret_ref = tag_ptr(ret_copy, true);
26300         return ret_ref;
26301 }
26302
26303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
26304         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
26305         *ret_copy = COption_NetAddressZ_none();
26306         int64_t ret_ref = tag_ptr(ret_copy, true);
26307         return ret_ref;
26308 }
26309
26310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26311         if (!ptr_is_owned(_res)) return;
26312         void* _res_ptr = untag_ptr(_res);
26313         CHECK_ACCESS(_res_ptr);
26314         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
26315         FREE(untag_ptr(_res));
26316         COption_NetAddressZ_free(_res_conv);
26317 }
26318
26319 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
26320         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
26321         *ret_copy = COption_NetAddressZ_clone(arg);
26322         int64_t ret_ref = tag_ptr(ret_copy, true);
26323         return ret_ref;
26324 }
26325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26326         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
26327         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
26328         return ret_conv;
26329 }
26330
26331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26332         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
26333         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
26334         *ret_copy = COption_NetAddressZ_clone(orig_conv);
26335         int64_t ret_ref = tag_ptr(ret_copy, true);
26336         return ret_ref;
26337 }
26338
26339 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
26340         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
26341         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
26342         return tag_ptr(ret_conv, true);
26343 }
26344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26345         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
26346         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
26347         return ret_conv;
26348 }
26349
26350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26351         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
26352         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
26353         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
26354         return tag_ptr(ret_conv, true);
26355 }
26356
26357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
26358         LDKPublicKey a_ref;
26359         CHECK((*env)->GetArrayLength(env, a) == 33);
26360         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
26361         void* b_ptr = untag_ptr(b);
26362         CHECK_ACCESS(b_ptr);
26363         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
26364         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
26365         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
26366         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
26367         return tag_ptr(ret_conv, true);
26368 }
26369
26370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26371         if (!ptr_is_owned(_res)) return;
26372         void* _res_ptr = untag_ptr(_res);
26373         CHECK_ACCESS(_res_ptr);
26374         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
26375         FREE(untag_ptr(_res));
26376         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
26377 }
26378
26379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1NetAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26380         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
26381         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26382         if (_res_constr.datalen > 0)
26383                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
26384         else
26385                 _res_constr.data = NULL;
26386         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26387         for (size_t o = 0; o < _res_constr.datalen; o++) {
26388                 int64_t _res_conv_40 = _res_vals[o];
26389                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26390                 CHECK_ACCESS(_res_conv_40_ptr);
26391                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
26392                 FREE(untag_ptr(_res_conv_40));
26393                 _res_constr.data[o] = _res_conv_40_conv;
26394         }
26395         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26396         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
26397 }
26398
26399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
26400         LDKCVec_u8Z o_ref;
26401         o_ref.datalen = (*env)->GetArrayLength(env, o);
26402         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26403         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
26404         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26405         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
26406         return tag_ptr(ret_conv, true);
26407 }
26408
26409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26410         LDKPeerHandleError e_conv;
26411         e_conv.inner = untag_ptr(e);
26412         e_conv.is_owned = ptr_is_owned(e);
26413         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26414         e_conv = PeerHandleError_clone(&e_conv);
26415         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26416         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
26417         return tag_ptr(ret_conv, true);
26418 }
26419
26420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26421         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
26422         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
26423         return ret_conv;
26424 }
26425
26426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26427         if (!ptr_is_owned(_res)) return;
26428         void* _res_ptr = untag_ptr(_res);
26429         CHECK_ACCESS(_res_ptr);
26430         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
26431         FREE(untag_ptr(_res));
26432         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
26433 }
26434
26435 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
26436         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26437         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
26438         return tag_ptr(ret_conv, true);
26439 }
26440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26441         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
26442         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
26443         return ret_conv;
26444 }
26445
26446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26447         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
26448         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26449         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
26450         return tag_ptr(ret_conv, true);
26451 }
26452
26453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
26454         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26455         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
26456         return tag_ptr(ret_conv, true);
26457 }
26458
26459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26460         LDKPeerHandleError e_conv;
26461         e_conv.inner = untag_ptr(e);
26462         e_conv.is_owned = ptr_is_owned(e);
26463         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26464         e_conv = PeerHandleError_clone(&e_conv);
26465         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26466         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
26467         return tag_ptr(ret_conv, true);
26468 }
26469
26470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26471         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
26472         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
26473         return ret_conv;
26474 }
26475
26476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26477         if (!ptr_is_owned(_res)) return;
26478         void* _res_ptr = untag_ptr(_res);
26479         CHECK_ACCESS(_res_ptr);
26480         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
26481         FREE(untag_ptr(_res));
26482         CResult_NonePeerHandleErrorZ_free(_res_conv);
26483 }
26484
26485 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
26486         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26487         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
26488         return tag_ptr(ret_conv, true);
26489 }
26490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26491         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
26492         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
26493         return ret_conv;
26494 }
26495
26496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26497         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
26498         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26499         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
26500         return tag_ptr(ret_conv, true);
26501 }
26502
26503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
26504         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26505         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
26506         return tag_ptr(ret_conv, true);
26507 }
26508
26509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26510         LDKPeerHandleError e_conv;
26511         e_conv.inner = untag_ptr(e);
26512         e_conv.is_owned = ptr_is_owned(e);
26513         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26514         e_conv = PeerHandleError_clone(&e_conv);
26515         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26516         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
26517         return tag_ptr(ret_conv, true);
26518 }
26519
26520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26521         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
26522         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
26523         return ret_conv;
26524 }
26525
26526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26527         if (!ptr_is_owned(_res)) return;
26528         void* _res_ptr = untag_ptr(_res);
26529         CHECK_ACCESS(_res_ptr);
26530         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
26531         FREE(untag_ptr(_res));
26532         CResult_boolPeerHandleErrorZ_free(_res_conv);
26533 }
26534
26535 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
26536         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26537         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
26538         return tag_ptr(ret_conv, true);
26539 }
26540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26541         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
26542         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
26543         return ret_conv;
26544 }
26545
26546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26547         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
26548         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26549         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
26550         return tag_ptr(ret_conv, true);
26551 }
26552
26553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
26554         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26555         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
26556         return tag_ptr(ret_conv, true);
26557 }
26558
26559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26560         void* e_ptr = untag_ptr(e);
26561         CHECK_ACCESS(e_ptr);
26562         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
26563         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
26564         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26565         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
26566         return tag_ptr(ret_conv, true);
26567 }
26568
26569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26570         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
26571         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
26572         return ret_conv;
26573 }
26574
26575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26576         if (!ptr_is_owned(_res)) return;
26577         void* _res_ptr = untag_ptr(_res);
26578         CHECK_ACCESS(_res_ptr);
26579         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
26580         FREE(untag_ptr(_res));
26581         CResult_u32GraphSyncErrorZ_free(_res_conv);
26582 }
26583
26584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
26585         LDKSecretKey o_ref;
26586         CHECK((*env)->GetArrayLength(env, o) == 32);
26587         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
26588         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26589         *ret_copy = COption_KeyPairZ_some(o_ref);
26590         int64_t ret_ref = tag_ptr(ret_copy, true);
26591         return ret_ref;
26592 }
26593
26594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1none(JNIEnv *env, jclass clz) {
26595         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26596         *ret_copy = COption_KeyPairZ_none();
26597         int64_t ret_ref = tag_ptr(ret_copy, true);
26598         return ret_ref;
26599 }
26600
26601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26602         if (!ptr_is_owned(_res)) return;
26603         void* _res_ptr = untag_ptr(_res);
26604         CHECK_ACCESS(_res_ptr);
26605         LDKCOption_KeyPairZ _res_conv = *(LDKCOption_KeyPairZ*)(_res_ptr);
26606         FREE(untag_ptr(_res));
26607         COption_KeyPairZ_free(_res_conv);
26608 }
26609
26610 static inline uint64_t COption_KeyPairZ_clone_ptr(LDKCOption_KeyPairZ *NONNULL_PTR arg) {
26611         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26612         *ret_copy = COption_KeyPairZ_clone(arg);
26613         int64_t ret_ref = tag_ptr(ret_copy, true);
26614         return ret_ref;
26615 }
26616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26617         LDKCOption_KeyPairZ* arg_conv = (LDKCOption_KeyPairZ*)untag_ptr(arg);
26618         int64_t ret_conv = COption_KeyPairZ_clone_ptr(arg_conv);
26619         return ret_conv;
26620 }
26621
26622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26623         LDKCOption_KeyPairZ* orig_conv = (LDKCOption_KeyPairZ*)untag_ptr(orig);
26624         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26625         *ret_copy = COption_KeyPairZ_clone(orig_conv);
26626         int64_t ret_ref = tag_ptr(ret_copy, true);
26627         return ret_ref;
26628 }
26629
26630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26631         void* o_ptr = untag_ptr(o);
26632         CHECK_ACCESS(o_ptr);
26633         LDKCOption_KeyPairZ o_conv = *(LDKCOption_KeyPairZ*)(o_ptr);
26634         o_conv = COption_KeyPairZ_clone((LDKCOption_KeyPairZ*)untag_ptr(o));
26635         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26636         *ret_conv = CResult_COption_KeyPairZNoneZ_ok(o_conv);
26637         return tag_ptr(ret_conv, true);
26638 }
26639
26640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1err(JNIEnv *env, jclass clz) {
26641         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26642         *ret_conv = CResult_COption_KeyPairZNoneZ_err();
26643         return tag_ptr(ret_conv, true);
26644 }
26645
26646 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26647         LDKCResult_COption_KeyPairZNoneZ* o_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(o);
26648         jboolean ret_conv = CResult_COption_KeyPairZNoneZ_is_ok(o_conv);
26649         return ret_conv;
26650 }
26651
26652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26653         if (!ptr_is_owned(_res)) return;
26654         void* _res_ptr = untag_ptr(_res);
26655         CHECK_ACCESS(_res_ptr);
26656         LDKCResult_COption_KeyPairZNoneZ _res_conv = *(LDKCResult_COption_KeyPairZNoneZ*)(_res_ptr);
26657         FREE(untag_ptr(_res));
26658         CResult_COption_KeyPairZNoneZ_free(_res_conv);
26659 }
26660
26661 static inline uint64_t CResult_COption_KeyPairZNoneZ_clone_ptr(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR arg) {
26662         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26663         *ret_conv = CResult_COption_KeyPairZNoneZ_clone(arg);
26664         return tag_ptr(ret_conv, true);
26665 }
26666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26667         LDKCResult_COption_KeyPairZNoneZ* arg_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(arg);
26668         int64_t ret_conv = CResult_COption_KeyPairZNoneZ_clone_ptr(arg_conv);
26669         return ret_conv;
26670 }
26671
26672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26673         LDKCResult_COption_KeyPairZNoneZ* orig_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(orig);
26674         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26675         *ret_conv = CResult_COption_KeyPairZNoneZ_clone(orig_conv);
26676         return tag_ptr(ret_conv, true);
26677 }
26678
26679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
26680         LDKCVec_u8Z o_ref;
26681         o_ref.datalen = (*env)->GetArrayLength(env, o);
26682         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26683         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
26684         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
26685         *ret_copy = COption_ScriptZ_some(o_ref);
26686         int64_t ret_ref = tag_ptr(ret_copy, true);
26687         return ret_ref;
26688 }
26689
26690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1none(JNIEnv *env, jclass clz) {
26691         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
26692         *ret_copy = COption_ScriptZ_none();
26693         int64_t ret_ref = tag_ptr(ret_copy, true);
26694         return ret_ref;
26695 }
26696
26697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26698         if (!ptr_is_owned(_res)) return;
26699         void* _res_ptr = untag_ptr(_res);
26700         CHECK_ACCESS(_res_ptr);
26701         LDKCOption_ScriptZ _res_conv = *(LDKCOption_ScriptZ*)(_res_ptr);
26702         FREE(untag_ptr(_res));
26703         COption_ScriptZ_free(_res_conv);
26704 }
26705
26706 static inline uint64_t COption_ScriptZ_clone_ptr(LDKCOption_ScriptZ *NONNULL_PTR arg) {
26707         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
26708         *ret_copy = COption_ScriptZ_clone(arg);
26709         int64_t ret_ref = tag_ptr(ret_copy, true);
26710         return ret_ref;
26711 }
26712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26713         LDKCOption_ScriptZ* arg_conv = (LDKCOption_ScriptZ*)untag_ptr(arg);
26714         int64_t ret_conv = COption_ScriptZ_clone_ptr(arg_conv);
26715         return ret_conv;
26716 }
26717
26718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26719         LDKCOption_ScriptZ* orig_conv = (LDKCOption_ScriptZ*)untag_ptr(orig);
26720         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
26721         *ret_copy = COption_ScriptZ_clone(orig_conv);
26722         int64_t ret_ref = tag_ptr(ret_copy, true);
26723         return ret_ref;
26724 }
26725
26726 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
26727         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
26728         return ret_conv;
26729 }
26730
26731 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
26732         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
26733         return ret_conv;
26734 }
26735
26736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
26737         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
26738         COption_NoneZ_free(_res_conv);
26739 }
26740
26741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
26742         LDKCVec_WitnessZ _res_constr;
26743         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26744         if (_res_constr.datalen > 0)
26745                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
26746         else
26747                 _res_constr.data = NULL;
26748         for (size_t i = 0; i < _res_constr.datalen; i++) {
26749                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
26750                 LDKWitness _res_conv_8_ref;
26751                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
26752                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
26753                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
26754                 _res_conv_8_ref.data_is_owned = true;
26755                 _res_constr.data[i] = _res_conv_8_ref;
26756         }
26757         CVec_WitnessZ_free(_res_constr);
26758 }
26759
26760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
26761         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
26762         *ret_copy = COption_i64Z_some(o);
26763         int64_t ret_ref = tag_ptr(ret_copy, true);
26764         return ret_ref;
26765 }
26766
26767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
26768         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
26769         *ret_copy = COption_i64Z_none();
26770         int64_t ret_ref = tag_ptr(ret_copy, true);
26771         return ret_ref;
26772 }
26773
26774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
26775         if (!ptr_is_owned(_res)) return;
26776         void* _res_ptr = untag_ptr(_res);
26777         CHECK_ACCESS(_res_ptr);
26778         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
26779         FREE(untag_ptr(_res));
26780         COption_i64Z_free(_res_conv);
26781 }
26782
26783 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
26784         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
26785         *ret_copy = COption_i64Z_clone(arg);
26786         int64_t ret_ref = tag_ptr(ret_copy, true);
26787         return ret_ref;
26788 }
26789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26790         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
26791         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
26792         return ret_conv;
26793 }
26794
26795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26796         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
26797         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
26798         *ret_copy = COption_i64Z_clone(orig_conv);
26799         int64_t ret_ref = tag_ptr(ret_copy, true);
26800         return ret_ref;
26801 }
26802
26803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
26804         LDKThirtyTwoBytes o_ref;
26805         CHECK((*env)->GetArrayLength(env, o) == 32);
26806         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
26807         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
26808         *ret_copy = COption_TxidZ_some(o_ref);
26809         int64_t ret_ref = tag_ptr(ret_copy, true);
26810         return ret_ref;
26811 }
26812
26813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1none(JNIEnv *env, jclass clz) {
26814         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
26815         *ret_copy = COption_TxidZ_none();
26816         int64_t ret_ref = tag_ptr(ret_copy, true);
26817         return ret_ref;
26818 }
26819
26820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26821         if (!ptr_is_owned(_res)) return;
26822         void* _res_ptr = untag_ptr(_res);
26823         CHECK_ACCESS(_res_ptr);
26824         LDKCOption_TxidZ _res_conv = *(LDKCOption_TxidZ*)(_res_ptr);
26825         FREE(untag_ptr(_res));
26826         COption_TxidZ_free(_res_conv);
26827 }
26828
26829 static inline uint64_t COption_TxidZ_clone_ptr(LDKCOption_TxidZ *NONNULL_PTR arg) {
26830         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
26831         *ret_copy = COption_TxidZ_clone(arg);
26832         int64_t ret_ref = tag_ptr(ret_copy, true);
26833         return ret_ref;
26834 }
26835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26836         LDKCOption_TxidZ* arg_conv = (LDKCOption_TxidZ*)untag_ptr(arg);
26837         int64_t ret_conv = COption_TxidZ_clone_ptr(arg_conv);
26838         return ret_conv;
26839 }
26840
26841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26842         LDKCOption_TxidZ* orig_conv = (LDKCOption_TxidZ*)untag_ptr(orig);
26843         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
26844         *ret_copy = COption_TxidZ_clone(orig_conv);
26845         int64_t ret_ref = tag_ptr(ret_copy, true);
26846         return ret_ref;
26847 }
26848
26849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26850         void* o_ptr = untag_ptr(o);
26851         CHECK_ACCESS(o_ptr);
26852         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
26853         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
26854         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
26855         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
26856         return tag_ptr(ret_conv, true);
26857 }
26858
26859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26860         void* e_ptr = untag_ptr(e);
26861         CHECK_ACCESS(e_ptr);
26862         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26863         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26864         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
26865         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
26866         return tag_ptr(ret_conv, true);
26867 }
26868
26869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26870         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
26871         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
26872         return ret_conv;
26873 }
26874
26875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26876         if (!ptr_is_owned(_res)) return;
26877         void* _res_ptr = untag_ptr(_res);
26878         CHECK_ACCESS(_res_ptr);
26879         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
26880         FREE(untag_ptr(_res));
26881         CResult_NetAddressDecodeErrorZ_free(_res_conv);
26882 }
26883
26884 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
26885         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
26886         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
26887         return tag_ptr(ret_conv, true);
26888 }
26889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26890         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
26891         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
26892         return ret_conv;
26893 }
26894
26895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26896         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
26897         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
26898         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
26899         return tag_ptr(ret_conv, true);
26900 }
26901
26902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26903         LDKCVec_UpdateAddHTLCZ _res_constr;
26904         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26905         if (_res_constr.datalen > 0)
26906                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
26907         else
26908                 _res_constr.data = NULL;
26909         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26910         for (size_t p = 0; p < _res_constr.datalen; p++) {
26911                 int64_t _res_conv_15 = _res_vals[p];
26912                 LDKUpdateAddHTLC _res_conv_15_conv;
26913                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
26914                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
26915                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
26916                 _res_constr.data[p] = _res_conv_15_conv;
26917         }
26918         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26919         CVec_UpdateAddHTLCZ_free(_res_constr);
26920 }
26921
26922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26923         LDKCVec_UpdateFulfillHTLCZ _res_constr;
26924         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26925         if (_res_constr.datalen > 0)
26926                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
26927         else
26928                 _res_constr.data = NULL;
26929         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26930         for (size_t t = 0; t < _res_constr.datalen; t++) {
26931                 int64_t _res_conv_19 = _res_vals[t];
26932                 LDKUpdateFulfillHTLC _res_conv_19_conv;
26933                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
26934                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
26935                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
26936                 _res_constr.data[t] = _res_conv_19_conv;
26937         }
26938         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26939         CVec_UpdateFulfillHTLCZ_free(_res_constr);
26940 }
26941
26942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26943         LDKCVec_UpdateFailHTLCZ _res_constr;
26944         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26945         if (_res_constr.datalen > 0)
26946                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
26947         else
26948                 _res_constr.data = NULL;
26949         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26950         for (size_t q = 0; q < _res_constr.datalen; q++) {
26951                 int64_t _res_conv_16 = _res_vals[q];
26952                 LDKUpdateFailHTLC _res_conv_16_conv;
26953                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26954                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26955                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26956                 _res_constr.data[q] = _res_conv_16_conv;
26957         }
26958         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26959         CVec_UpdateFailHTLCZ_free(_res_constr);
26960 }
26961
26962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26963         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
26964         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26965         if (_res_constr.datalen > 0)
26966                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
26967         else
26968                 _res_constr.data = NULL;
26969         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26970         for (size_t z = 0; z < _res_constr.datalen; z++) {
26971                 int64_t _res_conv_25 = _res_vals[z];
26972                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
26973                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
26974                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
26975                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
26976                 _res_constr.data[z] = _res_conv_25_conv;
26977         }
26978         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26979         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
26980 }
26981
26982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26983         LDKAcceptChannel o_conv;
26984         o_conv.inner = untag_ptr(o);
26985         o_conv.is_owned = ptr_is_owned(o);
26986         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26987         o_conv = AcceptChannel_clone(&o_conv);
26988         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
26989         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
26990         return tag_ptr(ret_conv, true);
26991 }
26992
26993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26994         void* e_ptr = untag_ptr(e);
26995         CHECK_ACCESS(e_ptr);
26996         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26997         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26998         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
26999         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
27000         return tag_ptr(ret_conv, true);
27001 }
27002
27003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27004         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
27005         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
27006         return ret_conv;
27007 }
27008
27009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27010         if (!ptr_is_owned(_res)) return;
27011         void* _res_ptr = untag_ptr(_res);
27012         CHECK_ACCESS(_res_ptr);
27013         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
27014         FREE(untag_ptr(_res));
27015         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
27016 }
27017
27018 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
27019         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27020         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
27021         return tag_ptr(ret_conv, true);
27022 }
27023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27024         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
27025         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
27026         return ret_conv;
27027 }
27028
27029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27030         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
27031         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27032         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
27033         return tag_ptr(ret_conv, true);
27034 }
27035
27036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27037         LDKAcceptChannelV2 o_conv;
27038         o_conv.inner = untag_ptr(o);
27039         o_conv.is_owned = ptr_is_owned(o);
27040         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27041         o_conv = AcceptChannelV2_clone(&o_conv);
27042         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27043         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
27044         return tag_ptr(ret_conv, true);
27045 }
27046
27047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27048         void* e_ptr = untag_ptr(e);
27049         CHECK_ACCESS(e_ptr);
27050         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27051         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27052         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27053         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
27054         return tag_ptr(ret_conv, true);
27055 }
27056
27057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27058         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
27059         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
27060         return ret_conv;
27061 }
27062
27063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27064         if (!ptr_is_owned(_res)) return;
27065         void* _res_ptr = untag_ptr(_res);
27066         CHECK_ACCESS(_res_ptr);
27067         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
27068         FREE(untag_ptr(_res));
27069         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
27070 }
27071
27072 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
27073         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27074         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
27075         return tag_ptr(ret_conv, true);
27076 }
27077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27078         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
27079         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
27080         return ret_conv;
27081 }
27082
27083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27084         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
27085         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27086         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
27087         return tag_ptr(ret_conv, true);
27088 }
27089
27090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27091         LDKTxAddInput o_conv;
27092         o_conv.inner = untag_ptr(o);
27093         o_conv.is_owned = ptr_is_owned(o);
27094         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27095         o_conv = TxAddInput_clone(&o_conv);
27096         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
27097         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
27098         return tag_ptr(ret_conv, true);
27099 }
27100
27101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27102         void* e_ptr = untag_ptr(e);
27103         CHECK_ACCESS(e_ptr);
27104         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27105         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27106         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
27107         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
27108         return tag_ptr(ret_conv, true);
27109 }
27110
27111 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27112         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
27113         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
27114         return ret_conv;
27115 }
27116
27117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27118         if (!ptr_is_owned(_res)) return;
27119         void* _res_ptr = untag_ptr(_res);
27120         CHECK_ACCESS(_res_ptr);
27121         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
27122         FREE(untag_ptr(_res));
27123         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
27124 }
27125
27126 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
27127         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
27128         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
27129         return tag_ptr(ret_conv, true);
27130 }
27131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27132         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
27133         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
27134         return ret_conv;
27135 }
27136
27137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27138         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
27139         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
27140         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
27141         return tag_ptr(ret_conv, true);
27142 }
27143
27144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27145         LDKTxAddOutput o_conv;
27146         o_conv.inner = untag_ptr(o);
27147         o_conv.is_owned = ptr_is_owned(o);
27148         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27149         o_conv = TxAddOutput_clone(&o_conv);
27150         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
27151         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
27152         return tag_ptr(ret_conv, true);
27153 }
27154
27155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27156         void* e_ptr = untag_ptr(e);
27157         CHECK_ACCESS(e_ptr);
27158         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27159         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27160         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
27161         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
27162         return tag_ptr(ret_conv, true);
27163 }
27164
27165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27166         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
27167         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
27168         return ret_conv;
27169 }
27170
27171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27172         if (!ptr_is_owned(_res)) return;
27173         void* _res_ptr = untag_ptr(_res);
27174         CHECK_ACCESS(_res_ptr);
27175         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
27176         FREE(untag_ptr(_res));
27177         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
27178 }
27179
27180 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
27181         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
27182         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
27183         return tag_ptr(ret_conv, true);
27184 }
27185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27186         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
27187         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
27188         return ret_conv;
27189 }
27190
27191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27192         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
27193         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
27194         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
27195         return tag_ptr(ret_conv, true);
27196 }
27197
27198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27199         LDKTxRemoveInput o_conv;
27200         o_conv.inner = untag_ptr(o);
27201         o_conv.is_owned = ptr_is_owned(o);
27202         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27203         o_conv = TxRemoveInput_clone(&o_conv);
27204         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
27205         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
27206         return tag_ptr(ret_conv, true);
27207 }
27208
27209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27210         void* e_ptr = untag_ptr(e);
27211         CHECK_ACCESS(e_ptr);
27212         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27213         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27214         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
27215         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
27216         return tag_ptr(ret_conv, true);
27217 }
27218
27219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27220         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
27221         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
27222         return ret_conv;
27223 }
27224
27225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27226         if (!ptr_is_owned(_res)) return;
27227         void* _res_ptr = untag_ptr(_res);
27228         CHECK_ACCESS(_res_ptr);
27229         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
27230         FREE(untag_ptr(_res));
27231         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
27232 }
27233
27234 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
27235         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
27236         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
27237         return tag_ptr(ret_conv, true);
27238 }
27239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27240         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
27241         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
27242         return ret_conv;
27243 }
27244
27245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27246         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
27247         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
27248         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
27249         return tag_ptr(ret_conv, true);
27250 }
27251
27252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27253         LDKTxRemoveOutput o_conv;
27254         o_conv.inner = untag_ptr(o);
27255         o_conv.is_owned = ptr_is_owned(o);
27256         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27257         o_conv = TxRemoveOutput_clone(&o_conv);
27258         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
27259         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
27260         return tag_ptr(ret_conv, true);
27261 }
27262
27263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27264         void* e_ptr = untag_ptr(e);
27265         CHECK_ACCESS(e_ptr);
27266         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27267         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27268         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
27269         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
27270         return tag_ptr(ret_conv, true);
27271 }
27272
27273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27274         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
27275         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
27276         return ret_conv;
27277 }
27278
27279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27280         if (!ptr_is_owned(_res)) return;
27281         void* _res_ptr = untag_ptr(_res);
27282         CHECK_ACCESS(_res_ptr);
27283         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
27284         FREE(untag_ptr(_res));
27285         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
27286 }
27287
27288 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
27289         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
27290         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
27291         return tag_ptr(ret_conv, true);
27292 }
27293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27294         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
27295         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
27296         return ret_conv;
27297 }
27298
27299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27300         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
27301         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
27302         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
27303         return tag_ptr(ret_conv, true);
27304 }
27305
27306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27307         LDKTxComplete o_conv;
27308         o_conv.inner = untag_ptr(o);
27309         o_conv.is_owned = ptr_is_owned(o);
27310         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27311         o_conv = TxComplete_clone(&o_conv);
27312         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
27313         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
27314         return tag_ptr(ret_conv, true);
27315 }
27316
27317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27318         void* e_ptr = untag_ptr(e);
27319         CHECK_ACCESS(e_ptr);
27320         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27321         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27322         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
27323         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
27324         return tag_ptr(ret_conv, true);
27325 }
27326
27327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27328         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
27329         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
27330         return ret_conv;
27331 }
27332
27333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27334         if (!ptr_is_owned(_res)) return;
27335         void* _res_ptr = untag_ptr(_res);
27336         CHECK_ACCESS(_res_ptr);
27337         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
27338         FREE(untag_ptr(_res));
27339         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
27340 }
27341
27342 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
27343         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
27344         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
27345         return tag_ptr(ret_conv, true);
27346 }
27347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27348         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
27349         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
27350         return ret_conv;
27351 }
27352
27353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27354         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
27355         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
27356         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
27357         return tag_ptr(ret_conv, true);
27358 }
27359
27360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27361         LDKTxSignatures o_conv;
27362         o_conv.inner = untag_ptr(o);
27363         o_conv.is_owned = ptr_is_owned(o);
27364         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27365         o_conv = TxSignatures_clone(&o_conv);
27366         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
27367         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
27368         return tag_ptr(ret_conv, true);
27369 }
27370
27371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27372         void* e_ptr = untag_ptr(e);
27373         CHECK_ACCESS(e_ptr);
27374         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27375         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27376         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
27377         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
27378         return tag_ptr(ret_conv, true);
27379 }
27380
27381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27382         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
27383         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
27384         return ret_conv;
27385 }
27386
27387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27388         if (!ptr_is_owned(_res)) return;
27389         void* _res_ptr = untag_ptr(_res);
27390         CHECK_ACCESS(_res_ptr);
27391         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
27392         FREE(untag_ptr(_res));
27393         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
27394 }
27395
27396 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
27397         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
27398         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
27399         return tag_ptr(ret_conv, true);
27400 }
27401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27402         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
27403         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
27404         return ret_conv;
27405 }
27406
27407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27408         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
27409         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
27410         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
27411         return tag_ptr(ret_conv, true);
27412 }
27413
27414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27415         LDKTxInitRbf o_conv;
27416         o_conv.inner = untag_ptr(o);
27417         o_conv.is_owned = ptr_is_owned(o);
27418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27419         o_conv = TxInitRbf_clone(&o_conv);
27420         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
27421         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
27422         return tag_ptr(ret_conv, true);
27423 }
27424
27425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27426         void* e_ptr = untag_ptr(e);
27427         CHECK_ACCESS(e_ptr);
27428         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27429         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27430         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
27431         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
27432         return tag_ptr(ret_conv, true);
27433 }
27434
27435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27436         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
27437         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
27438         return ret_conv;
27439 }
27440
27441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27442         if (!ptr_is_owned(_res)) return;
27443         void* _res_ptr = untag_ptr(_res);
27444         CHECK_ACCESS(_res_ptr);
27445         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
27446         FREE(untag_ptr(_res));
27447         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
27448 }
27449
27450 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
27451         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
27452         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
27453         return tag_ptr(ret_conv, true);
27454 }
27455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27456         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
27457         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
27458         return ret_conv;
27459 }
27460
27461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27462         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
27463         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
27464         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
27465         return tag_ptr(ret_conv, true);
27466 }
27467
27468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27469         LDKTxAckRbf o_conv;
27470         o_conv.inner = untag_ptr(o);
27471         o_conv.is_owned = ptr_is_owned(o);
27472         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27473         o_conv = TxAckRbf_clone(&o_conv);
27474         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
27475         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
27476         return tag_ptr(ret_conv, true);
27477 }
27478
27479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27480         void* e_ptr = untag_ptr(e);
27481         CHECK_ACCESS(e_ptr);
27482         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27483         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27484         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
27485         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
27486         return tag_ptr(ret_conv, true);
27487 }
27488
27489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27490         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
27491         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
27492         return ret_conv;
27493 }
27494
27495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27496         if (!ptr_is_owned(_res)) return;
27497         void* _res_ptr = untag_ptr(_res);
27498         CHECK_ACCESS(_res_ptr);
27499         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
27500         FREE(untag_ptr(_res));
27501         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
27502 }
27503
27504 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
27505         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
27506         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
27507         return tag_ptr(ret_conv, true);
27508 }
27509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27510         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
27511         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
27512         return ret_conv;
27513 }
27514
27515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27516         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
27517         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
27518         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
27519         return tag_ptr(ret_conv, true);
27520 }
27521
27522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27523         LDKTxAbort o_conv;
27524         o_conv.inner = untag_ptr(o);
27525         o_conv.is_owned = ptr_is_owned(o);
27526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27527         o_conv = TxAbort_clone(&o_conv);
27528         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
27529         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
27530         return tag_ptr(ret_conv, true);
27531 }
27532
27533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27534         void* e_ptr = untag_ptr(e);
27535         CHECK_ACCESS(e_ptr);
27536         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27537         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27538         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
27539         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
27540         return tag_ptr(ret_conv, true);
27541 }
27542
27543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27544         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
27545         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
27546         return ret_conv;
27547 }
27548
27549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27550         if (!ptr_is_owned(_res)) return;
27551         void* _res_ptr = untag_ptr(_res);
27552         CHECK_ACCESS(_res_ptr);
27553         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
27554         FREE(untag_ptr(_res));
27555         CResult_TxAbortDecodeErrorZ_free(_res_conv);
27556 }
27557
27558 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
27559         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
27560         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
27561         return tag_ptr(ret_conv, true);
27562 }
27563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27564         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
27565         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
27566         return ret_conv;
27567 }
27568
27569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27570         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
27571         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
27572         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
27573         return tag_ptr(ret_conv, true);
27574 }
27575
27576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27577         LDKAnnouncementSignatures o_conv;
27578         o_conv.inner = untag_ptr(o);
27579         o_conv.is_owned = ptr_is_owned(o);
27580         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27581         o_conv = AnnouncementSignatures_clone(&o_conv);
27582         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27583         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
27584         return tag_ptr(ret_conv, true);
27585 }
27586
27587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27588         void* e_ptr = untag_ptr(e);
27589         CHECK_ACCESS(e_ptr);
27590         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27591         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27592         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27593         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
27594         return tag_ptr(ret_conv, true);
27595 }
27596
27597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27598         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
27599         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
27600         return ret_conv;
27601 }
27602
27603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27604         if (!ptr_is_owned(_res)) return;
27605         void* _res_ptr = untag_ptr(_res);
27606         CHECK_ACCESS(_res_ptr);
27607         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
27608         FREE(untag_ptr(_res));
27609         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
27610 }
27611
27612 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
27613         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27614         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
27615         return tag_ptr(ret_conv, true);
27616 }
27617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27618         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
27619         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
27620         return ret_conv;
27621 }
27622
27623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27624         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
27625         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27626         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
27627         return tag_ptr(ret_conv, true);
27628 }
27629
27630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27631         LDKChannelReestablish o_conv;
27632         o_conv.inner = untag_ptr(o);
27633         o_conv.is_owned = ptr_is_owned(o);
27634         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27635         o_conv = ChannelReestablish_clone(&o_conv);
27636         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27637         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
27638         return tag_ptr(ret_conv, true);
27639 }
27640
27641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27642         void* e_ptr = untag_ptr(e);
27643         CHECK_ACCESS(e_ptr);
27644         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27645         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27646         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27647         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
27648         return tag_ptr(ret_conv, true);
27649 }
27650
27651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27652         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
27653         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
27654         return ret_conv;
27655 }
27656
27657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27658         if (!ptr_is_owned(_res)) return;
27659         void* _res_ptr = untag_ptr(_res);
27660         CHECK_ACCESS(_res_ptr);
27661         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
27662         FREE(untag_ptr(_res));
27663         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
27664 }
27665
27666 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
27667         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27668         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
27669         return tag_ptr(ret_conv, true);
27670 }
27671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27672         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
27673         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
27674         return ret_conv;
27675 }
27676
27677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27678         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
27679         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27680         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
27681         return tag_ptr(ret_conv, true);
27682 }
27683
27684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27685         LDKClosingSigned o_conv;
27686         o_conv.inner = untag_ptr(o);
27687         o_conv.is_owned = ptr_is_owned(o);
27688         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27689         o_conv = ClosingSigned_clone(&o_conv);
27690         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27691         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
27692         return tag_ptr(ret_conv, true);
27693 }
27694
27695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27696         void* e_ptr = untag_ptr(e);
27697         CHECK_ACCESS(e_ptr);
27698         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27699         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27700         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27701         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
27702         return tag_ptr(ret_conv, true);
27703 }
27704
27705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27706         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
27707         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
27708         return ret_conv;
27709 }
27710
27711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27712         if (!ptr_is_owned(_res)) return;
27713         void* _res_ptr = untag_ptr(_res);
27714         CHECK_ACCESS(_res_ptr);
27715         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
27716         FREE(untag_ptr(_res));
27717         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
27718 }
27719
27720 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
27721         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27722         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
27723         return tag_ptr(ret_conv, true);
27724 }
27725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27726         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
27727         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
27728         return ret_conv;
27729 }
27730
27731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27732         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
27733         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27734         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
27735         return tag_ptr(ret_conv, true);
27736 }
27737
27738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27739         LDKClosingSignedFeeRange o_conv;
27740         o_conv.inner = untag_ptr(o);
27741         o_conv.is_owned = ptr_is_owned(o);
27742         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27743         o_conv = ClosingSignedFeeRange_clone(&o_conv);
27744         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27745         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
27746         return tag_ptr(ret_conv, true);
27747 }
27748
27749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27750         void* e_ptr = untag_ptr(e);
27751         CHECK_ACCESS(e_ptr);
27752         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27753         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27754         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27755         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
27756         return tag_ptr(ret_conv, true);
27757 }
27758
27759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27760         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
27761         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
27762         return ret_conv;
27763 }
27764
27765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27766         if (!ptr_is_owned(_res)) return;
27767         void* _res_ptr = untag_ptr(_res);
27768         CHECK_ACCESS(_res_ptr);
27769         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
27770         FREE(untag_ptr(_res));
27771         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
27772 }
27773
27774 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
27775         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27776         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
27777         return tag_ptr(ret_conv, true);
27778 }
27779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27780         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
27781         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
27782         return ret_conv;
27783 }
27784
27785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27786         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
27787         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27788         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
27789         return tag_ptr(ret_conv, true);
27790 }
27791
27792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27793         LDKCommitmentSigned o_conv;
27794         o_conv.inner = untag_ptr(o);
27795         o_conv.is_owned = ptr_is_owned(o);
27796         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27797         o_conv = CommitmentSigned_clone(&o_conv);
27798         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27799         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
27800         return tag_ptr(ret_conv, true);
27801 }
27802
27803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27804         void* e_ptr = untag_ptr(e);
27805         CHECK_ACCESS(e_ptr);
27806         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27807         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27808         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27809         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
27810         return tag_ptr(ret_conv, true);
27811 }
27812
27813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27814         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
27815         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
27816         return ret_conv;
27817 }
27818
27819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27820         if (!ptr_is_owned(_res)) return;
27821         void* _res_ptr = untag_ptr(_res);
27822         CHECK_ACCESS(_res_ptr);
27823         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
27824         FREE(untag_ptr(_res));
27825         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
27826 }
27827
27828 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
27829         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27830         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
27831         return tag_ptr(ret_conv, true);
27832 }
27833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27834         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
27835         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
27836         return ret_conv;
27837 }
27838
27839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27840         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
27841         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27842         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
27843         return tag_ptr(ret_conv, true);
27844 }
27845
27846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27847         LDKFundingCreated o_conv;
27848         o_conv.inner = untag_ptr(o);
27849         o_conv.is_owned = ptr_is_owned(o);
27850         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27851         o_conv = FundingCreated_clone(&o_conv);
27852         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27853         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
27854         return tag_ptr(ret_conv, true);
27855 }
27856
27857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27858         void* e_ptr = untag_ptr(e);
27859         CHECK_ACCESS(e_ptr);
27860         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27861         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27862         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27863         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
27864         return tag_ptr(ret_conv, true);
27865 }
27866
27867 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27868         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
27869         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
27870         return ret_conv;
27871 }
27872
27873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27874         if (!ptr_is_owned(_res)) return;
27875         void* _res_ptr = untag_ptr(_res);
27876         CHECK_ACCESS(_res_ptr);
27877         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
27878         FREE(untag_ptr(_res));
27879         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
27880 }
27881
27882 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
27883         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27884         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
27885         return tag_ptr(ret_conv, true);
27886 }
27887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27888         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
27889         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
27890         return ret_conv;
27891 }
27892
27893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27894         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
27895         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27896         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
27897         return tag_ptr(ret_conv, true);
27898 }
27899
27900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27901         LDKFundingSigned o_conv;
27902         o_conv.inner = untag_ptr(o);
27903         o_conv.is_owned = ptr_is_owned(o);
27904         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27905         o_conv = FundingSigned_clone(&o_conv);
27906         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27907         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
27908         return tag_ptr(ret_conv, true);
27909 }
27910
27911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27912         void* e_ptr = untag_ptr(e);
27913         CHECK_ACCESS(e_ptr);
27914         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27915         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27916         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27917         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
27918         return tag_ptr(ret_conv, true);
27919 }
27920
27921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27922         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
27923         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
27924         return ret_conv;
27925 }
27926
27927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27928         if (!ptr_is_owned(_res)) return;
27929         void* _res_ptr = untag_ptr(_res);
27930         CHECK_ACCESS(_res_ptr);
27931         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
27932         FREE(untag_ptr(_res));
27933         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
27934 }
27935
27936 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
27937         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27938         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
27939         return tag_ptr(ret_conv, true);
27940 }
27941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27942         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
27943         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
27944         return ret_conv;
27945 }
27946
27947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27948         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
27949         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27950         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
27951         return tag_ptr(ret_conv, true);
27952 }
27953
27954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27955         LDKChannelReady o_conv;
27956         o_conv.inner = untag_ptr(o);
27957         o_conv.is_owned = ptr_is_owned(o);
27958         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27959         o_conv = ChannelReady_clone(&o_conv);
27960         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
27961         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
27962         return tag_ptr(ret_conv, true);
27963 }
27964
27965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27966         void* e_ptr = untag_ptr(e);
27967         CHECK_ACCESS(e_ptr);
27968         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27969         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27970         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
27971         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
27972         return tag_ptr(ret_conv, true);
27973 }
27974
27975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27976         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
27977         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
27978         return ret_conv;
27979 }
27980
27981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27982         if (!ptr_is_owned(_res)) return;
27983         void* _res_ptr = untag_ptr(_res);
27984         CHECK_ACCESS(_res_ptr);
27985         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
27986         FREE(untag_ptr(_res));
27987         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
27988 }
27989
27990 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
27991         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
27992         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
27993         return tag_ptr(ret_conv, true);
27994 }
27995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27996         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
27997         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
27998         return ret_conv;
27999 }
28000
28001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28002         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
28003         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28004         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
28005         return tag_ptr(ret_conv, true);
28006 }
28007
28008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28009         LDKInit o_conv;
28010         o_conv.inner = untag_ptr(o);
28011         o_conv.is_owned = ptr_is_owned(o);
28012         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28013         o_conv = Init_clone(&o_conv);
28014         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28015         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
28016         return tag_ptr(ret_conv, true);
28017 }
28018
28019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28020         void* e_ptr = untag_ptr(e);
28021         CHECK_ACCESS(e_ptr);
28022         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28023         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28024         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28025         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
28026         return tag_ptr(ret_conv, true);
28027 }
28028
28029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28030         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
28031         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
28032         return ret_conv;
28033 }
28034
28035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28036         if (!ptr_is_owned(_res)) return;
28037         void* _res_ptr = untag_ptr(_res);
28038         CHECK_ACCESS(_res_ptr);
28039         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
28040         FREE(untag_ptr(_res));
28041         CResult_InitDecodeErrorZ_free(_res_conv);
28042 }
28043
28044 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
28045         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28046         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
28047         return tag_ptr(ret_conv, true);
28048 }
28049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28050         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
28051         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
28052         return ret_conv;
28053 }
28054
28055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28056         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
28057         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28058         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
28059         return tag_ptr(ret_conv, true);
28060 }
28061
28062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28063         LDKOpenChannel o_conv;
28064         o_conv.inner = untag_ptr(o);
28065         o_conv.is_owned = ptr_is_owned(o);
28066         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28067         o_conv = OpenChannel_clone(&o_conv);
28068         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28069         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
28070         return tag_ptr(ret_conv, true);
28071 }
28072
28073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28074         void* e_ptr = untag_ptr(e);
28075         CHECK_ACCESS(e_ptr);
28076         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28077         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28078         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28079         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
28080         return tag_ptr(ret_conv, true);
28081 }
28082
28083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28084         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
28085         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
28086         return ret_conv;
28087 }
28088
28089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28090         if (!ptr_is_owned(_res)) return;
28091         void* _res_ptr = untag_ptr(_res);
28092         CHECK_ACCESS(_res_ptr);
28093         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
28094         FREE(untag_ptr(_res));
28095         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
28096 }
28097
28098 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
28099         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28100         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
28101         return tag_ptr(ret_conv, true);
28102 }
28103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28104         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
28105         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
28106         return ret_conv;
28107 }
28108
28109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28110         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
28111         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28112         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
28113         return tag_ptr(ret_conv, true);
28114 }
28115
28116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28117         LDKOpenChannelV2 o_conv;
28118         o_conv.inner = untag_ptr(o);
28119         o_conv.is_owned = ptr_is_owned(o);
28120         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28121         o_conv = OpenChannelV2_clone(&o_conv);
28122         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
28123         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
28124         return tag_ptr(ret_conv, true);
28125 }
28126
28127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28128         void* e_ptr = untag_ptr(e);
28129         CHECK_ACCESS(e_ptr);
28130         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28131         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28132         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
28133         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
28134         return tag_ptr(ret_conv, true);
28135 }
28136
28137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28138         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
28139         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
28140         return ret_conv;
28141 }
28142
28143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28144         if (!ptr_is_owned(_res)) return;
28145         void* _res_ptr = untag_ptr(_res);
28146         CHECK_ACCESS(_res_ptr);
28147         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
28148         FREE(untag_ptr(_res));
28149         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
28150 }
28151
28152 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
28153         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
28154         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
28155         return tag_ptr(ret_conv, true);
28156 }
28157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28158         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
28159         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
28160         return ret_conv;
28161 }
28162
28163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28164         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
28165         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
28166         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
28167         return tag_ptr(ret_conv, true);
28168 }
28169
28170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28171         LDKRevokeAndACK o_conv;
28172         o_conv.inner = untag_ptr(o);
28173         o_conv.is_owned = ptr_is_owned(o);
28174         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28175         o_conv = RevokeAndACK_clone(&o_conv);
28176         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
28177         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
28178         return tag_ptr(ret_conv, true);
28179 }
28180
28181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28182         void* e_ptr = untag_ptr(e);
28183         CHECK_ACCESS(e_ptr);
28184         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28185         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28186         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
28187         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
28188         return tag_ptr(ret_conv, true);
28189 }
28190
28191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28192         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
28193         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
28194         return ret_conv;
28195 }
28196
28197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28198         if (!ptr_is_owned(_res)) return;
28199         void* _res_ptr = untag_ptr(_res);
28200         CHECK_ACCESS(_res_ptr);
28201         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
28202         FREE(untag_ptr(_res));
28203         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
28204 }
28205
28206 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
28207         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
28208         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
28209         return tag_ptr(ret_conv, true);
28210 }
28211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28212         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
28213         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
28214         return ret_conv;
28215 }
28216
28217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28218         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
28219         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
28220         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
28221         return tag_ptr(ret_conv, true);
28222 }
28223
28224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28225         LDKShutdown o_conv;
28226         o_conv.inner = untag_ptr(o);
28227         o_conv.is_owned = ptr_is_owned(o);
28228         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28229         o_conv = Shutdown_clone(&o_conv);
28230         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
28231         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
28232         return tag_ptr(ret_conv, true);
28233 }
28234
28235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28236         void* e_ptr = untag_ptr(e);
28237         CHECK_ACCESS(e_ptr);
28238         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28239         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28240         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
28241         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
28242         return tag_ptr(ret_conv, true);
28243 }
28244
28245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28246         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
28247         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
28248         return ret_conv;
28249 }
28250
28251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28252         if (!ptr_is_owned(_res)) return;
28253         void* _res_ptr = untag_ptr(_res);
28254         CHECK_ACCESS(_res_ptr);
28255         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
28256         FREE(untag_ptr(_res));
28257         CResult_ShutdownDecodeErrorZ_free(_res_conv);
28258 }
28259
28260 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
28261         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
28262         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
28263         return tag_ptr(ret_conv, true);
28264 }
28265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28266         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
28267         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
28268         return ret_conv;
28269 }
28270
28271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28272         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
28273         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
28274         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
28275         return tag_ptr(ret_conv, true);
28276 }
28277
28278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28279         LDKUpdateFailHTLC o_conv;
28280         o_conv.inner = untag_ptr(o);
28281         o_conv.is_owned = ptr_is_owned(o);
28282         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28283         o_conv = UpdateFailHTLC_clone(&o_conv);
28284         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
28285         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
28286         return tag_ptr(ret_conv, true);
28287 }
28288
28289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28290         void* e_ptr = untag_ptr(e);
28291         CHECK_ACCESS(e_ptr);
28292         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28293         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28294         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
28295         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
28296         return tag_ptr(ret_conv, true);
28297 }
28298
28299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28300         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
28301         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
28302         return ret_conv;
28303 }
28304
28305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28306         if (!ptr_is_owned(_res)) return;
28307         void* _res_ptr = untag_ptr(_res);
28308         CHECK_ACCESS(_res_ptr);
28309         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
28310         FREE(untag_ptr(_res));
28311         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
28312 }
28313
28314 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
28315         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
28316         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
28317         return tag_ptr(ret_conv, true);
28318 }
28319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28320         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
28321         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
28322         return ret_conv;
28323 }
28324
28325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28326         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
28327         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
28328         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
28329         return tag_ptr(ret_conv, true);
28330 }
28331
28332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28333         LDKUpdateFailMalformedHTLC o_conv;
28334         o_conv.inner = untag_ptr(o);
28335         o_conv.is_owned = ptr_is_owned(o);
28336         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28337         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
28338         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
28339         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
28340         return tag_ptr(ret_conv, true);
28341 }
28342
28343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28344         void* e_ptr = untag_ptr(e);
28345         CHECK_ACCESS(e_ptr);
28346         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28347         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28348         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
28349         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
28350         return tag_ptr(ret_conv, true);
28351 }
28352
28353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28354         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
28355         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
28356         return ret_conv;
28357 }
28358
28359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28360         if (!ptr_is_owned(_res)) return;
28361         void* _res_ptr = untag_ptr(_res);
28362         CHECK_ACCESS(_res_ptr);
28363         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
28364         FREE(untag_ptr(_res));
28365         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
28366 }
28367
28368 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
28369         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
28370         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
28371         return tag_ptr(ret_conv, true);
28372 }
28373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28374         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
28375         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
28376         return ret_conv;
28377 }
28378
28379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28380         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
28381         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
28382         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
28383         return tag_ptr(ret_conv, true);
28384 }
28385
28386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28387         LDKUpdateFee o_conv;
28388         o_conv.inner = untag_ptr(o);
28389         o_conv.is_owned = ptr_is_owned(o);
28390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28391         o_conv = UpdateFee_clone(&o_conv);
28392         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
28393         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
28394         return tag_ptr(ret_conv, true);
28395 }
28396
28397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28398         void* e_ptr = untag_ptr(e);
28399         CHECK_ACCESS(e_ptr);
28400         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28401         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28402         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
28403         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
28404         return tag_ptr(ret_conv, true);
28405 }
28406
28407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28408         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
28409         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
28410         return ret_conv;
28411 }
28412
28413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28414         if (!ptr_is_owned(_res)) return;
28415         void* _res_ptr = untag_ptr(_res);
28416         CHECK_ACCESS(_res_ptr);
28417         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
28418         FREE(untag_ptr(_res));
28419         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
28420 }
28421
28422 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
28423         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
28424         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
28425         return tag_ptr(ret_conv, true);
28426 }
28427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28428         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
28429         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
28430         return ret_conv;
28431 }
28432
28433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28434         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
28435         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
28436         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
28437         return tag_ptr(ret_conv, true);
28438 }
28439
28440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28441         LDKUpdateFulfillHTLC o_conv;
28442         o_conv.inner = untag_ptr(o);
28443         o_conv.is_owned = ptr_is_owned(o);
28444         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28445         o_conv = UpdateFulfillHTLC_clone(&o_conv);
28446         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28447         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
28448         return tag_ptr(ret_conv, true);
28449 }
28450
28451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28452         void* e_ptr = untag_ptr(e);
28453         CHECK_ACCESS(e_ptr);
28454         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28455         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28456         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28457         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
28458         return tag_ptr(ret_conv, true);
28459 }
28460
28461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28462         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
28463         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
28464         return ret_conv;
28465 }
28466
28467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28468         if (!ptr_is_owned(_res)) return;
28469         void* _res_ptr = untag_ptr(_res);
28470         CHECK_ACCESS(_res_ptr);
28471         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
28472         FREE(untag_ptr(_res));
28473         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
28474 }
28475
28476 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
28477         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28478         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
28479         return tag_ptr(ret_conv, true);
28480 }
28481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28482         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
28483         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
28484         return ret_conv;
28485 }
28486
28487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28488         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
28489         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28490         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
28491         return tag_ptr(ret_conv, true);
28492 }
28493
28494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28495         LDKUpdateAddHTLC o_conv;
28496         o_conv.inner = untag_ptr(o);
28497         o_conv.is_owned = ptr_is_owned(o);
28498         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28499         o_conv = UpdateAddHTLC_clone(&o_conv);
28500         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28501         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
28502         return tag_ptr(ret_conv, true);
28503 }
28504
28505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28506         void* e_ptr = untag_ptr(e);
28507         CHECK_ACCESS(e_ptr);
28508         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28509         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28510         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28511         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
28512         return tag_ptr(ret_conv, true);
28513 }
28514
28515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28516         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
28517         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
28518         return ret_conv;
28519 }
28520
28521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28522         if (!ptr_is_owned(_res)) return;
28523         void* _res_ptr = untag_ptr(_res);
28524         CHECK_ACCESS(_res_ptr);
28525         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
28526         FREE(untag_ptr(_res));
28527         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
28528 }
28529
28530 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
28531         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28532         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
28533         return tag_ptr(ret_conv, true);
28534 }
28535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28536         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
28537         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
28538         return ret_conv;
28539 }
28540
28541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28542         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
28543         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28544         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
28545         return tag_ptr(ret_conv, true);
28546 }
28547
28548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28549         LDKOnionMessage o_conv;
28550         o_conv.inner = untag_ptr(o);
28551         o_conv.is_owned = ptr_is_owned(o);
28552         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28553         o_conv = OnionMessage_clone(&o_conv);
28554         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
28555         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
28556         return tag_ptr(ret_conv, true);
28557 }
28558
28559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28560         void* e_ptr = untag_ptr(e);
28561         CHECK_ACCESS(e_ptr);
28562         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28563         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28564         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
28565         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
28566         return tag_ptr(ret_conv, true);
28567 }
28568
28569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28570         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
28571         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
28572         return ret_conv;
28573 }
28574
28575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28576         if (!ptr_is_owned(_res)) return;
28577         void* _res_ptr = untag_ptr(_res);
28578         CHECK_ACCESS(_res_ptr);
28579         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
28580         FREE(untag_ptr(_res));
28581         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
28582 }
28583
28584 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
28585         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
28586         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
28587         return tag_ptr(ret_conv, true);
28588 }
28589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28590         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
28591         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
28592         return ret_conv;
28593 }
28594
28595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28596         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
28597         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
28598         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
28599         return tag_ptr(ret_conv, true);
28600 }
28601
28602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28603         LDKPing o_conv;
28604         o_conv.inner = untag_ptr(o);
28605         o_conv.is_owned = ptr_is_owned(o);
28606         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28607         o_conv = Ping_clone(&o_conv);
28608         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28609         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
28610         return tag_ptr(ret_conv, true);
28611 }
28612
28613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28614         void* e_ptr = untag_ptr(e);
28615         CHECK_ACCESS(e_ptr);
28616         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28617         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28618         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28619         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
28620         return tag_ptr(ret_conv, true);
28621 }
28622
28623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28624         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
28625         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
28626         return ret_conv;
28627 }
28628
28629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28630         if (!ptr_is_owned(_res)) return;
28631         void* _res_ptr = untag_ptr(_res);
28632         CHECK_ACCESS(_res_ptr);
28633         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
28634         FREE(untag_ptr(_res));
28635         CResult_PingDecodeErrorZ_free(_res_conv);
28636 }
28637
28638 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
28639         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28640         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
28641         return tag_ptr(ret_conv, true);
28642 }
28643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28644         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
28645         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
28646         return ret_conv;
28647 }
28648
28649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28650         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
28651         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28652         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
28653         return tag_ptr(ret_conv, true);
28654 }
28655
28656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28657         LDKPong o_conv;
28658         o_conv.inner = untag_ptr(o);
28659         o_conv.is_owned = ptr_is_owned(o);
28660         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28661         o_conv = Pong_clone(&o_conv);
28662         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28663         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
28664         return tag_ptr(ret_conv, true);
28665 }
28666
28667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28668         void* e_ptr = untag_ptr(e);
28669         CHECK_ACCESS(e_ptr);
28670         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28671         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28672         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28673         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
28674         return tag_ptr(ret_conv, true);
28675 }
28676
28677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28678         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
28679         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
28680         return ret_conv;
28681 }
28682
28683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28684         if (!ptr_is_owned(_res)) return;
28685         void* _res_ptr = untag_ptr(_res);
28686         CHECK_ACCESS(_res_ptr);
28687         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
28688         FREE(untag_ptr(_res));
28689         CResult_PongDecodeErrorZ_free(_res_conv);
28690 }
28691
28692 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
28693         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28694         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
28695         return tag_ptr(ret_conv, true);
28696 }
28697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28698         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
28699         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
28700         return ret_conv;
28701 }
28702
28703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28704         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
28705         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28706         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
28707         return tag_ptr(ret_conv, true);
28708 }
28709
28710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28711         LDKUnsignedChannelAnnouncement o_conv;
28712         o_conv.inner = untag_ptr(o);
28713         o_conv.is_owned = ptr_is_owned(o);
28714         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28715         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
28716         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28717         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
28718         return tag_ptr(ret_conv, true);
28719 }
28720
28721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28722         void* e_ptr = untag_ptr(e);
28723         CHECK_ACCESS(e_ptr);
28724         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28725         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28726         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28727         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
28728         return tag_ptr(ret_conv, true);
28729 }
28730
28731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28732         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
28733         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
28734         return ret_conv;
28735 }
28736
28737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28738         if (!ptr_is_owned(_res)) return;
28739         void* _res_ptr = untag_ptr(_res);
28740         CHECK_ACCESS(_res_ptr);
28741         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
28742         FREE(untag_ptr(_res));
28743         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
28744 }
28745
28746 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
28747         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28748         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
28749         return tag_ptr(ret_conv, true);
28750 }
28751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28752         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
28753         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
28754         return ret_conv;
28755 }
28756
28757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28758         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
28759         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28760         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
28761         return tag_ptr(ret_conv, true);
28762 }
28763
28764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28765         LDKChannelAnnouncement o_conv;
28766         o_conv.inner = untag_ptr(o);
28767         o_conv.is_owned = ptr_is_owned(o);
28768         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28769         o_conv = ChannelAnnouncement_clone(&o_conv);
28770         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28771         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
28772         return tag_ptr(ret_conv, true);
28773 }
28774
28775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28776         void* e_ptr = untag_ptr(e);
28777         CHECK_ACCESS(e_ptr);
28778         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28779         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28780         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28781         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
28782         return tag_ptr(ret_conv, true);
28783 }
28784
28785 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28786         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
28787         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
28788         return ret_conv;
28789 }
28790
28791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28792         if (!ptr_is_owned(_res)) return;
28793         void* _res_ptr = untag_ptr(_res);
28794         CHECK_ACCESS(_res_ptr);
28795         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
28796         FREE(untag_ptr(_res));
28797         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
28798 }
28799
28800 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
28801         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28802         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
28803         return tag_ptr(ret_conv, true);
28804 }
28805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28806         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
28807         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
28808         return ret_conv;
28809 }
28810
28811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28812         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
28813         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28814         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
28815         return tag_ptr(ret_conv, true);
28816 }
28817
28818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28819         LDKUnsignedChannelUpdate o_conv;
28820         o_conv.inner = untag_ptr(o);
28821         o_conv.is_owned = ptr_is_owned(o);
28822         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28823         o_conv = UnsignedChannelUpdate_clone(&o_conv);
28824         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28825         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
28826         return tag_ptr(ret_conv, true);
28827 }
28828
28829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28830         void* e_ptr = untag_ptr(e);
28831         CHECK_ACCESS(e_ptr);
28832         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28833         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28834         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28835         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
28836         return tag_ptr(ret_conv, true);
28837 }
28838
28839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28840         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
28841         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
28842         return ret_conv;
28843 }
28844
28845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28846         if (!ptr_is_owned(_res)) return;
28847         void* _res_ptr = untag_ptr(_res);
28848         CHECK_ACCESS(_res_ptr);
28849         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
28850         FREE(untag_ptr(_res));
28851         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
28852 }
28853
28854 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
28855         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28856         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
28857         return tag_ptr(ret_conv, true);
28858 }
28859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28860         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
28861         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
28862         return ret_conv;
28863 }
28864
28865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28866         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
28867         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28868         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
28869         return tag_ptr(ret_conv, true);
28870 }
28871
28872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28873         LDKChannelUpdate o_conv;
28874         o_conv.inner = untag_ptr(o);
28875         o_conv.is_owned = ptr_is_owned(o);
28876         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28877         o_conv = ChannelUpdate_clone(&o_conv);
28878         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28879         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
28880         return tag_ptr(ret_conv, true);
28881 }
28882
28883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28884         void* e_ptr = untag_ptr(e);
28885         CHECK_ACCESS(e_ptr);
28886         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28887         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28888         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28889         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
28890         return tag_ptr(ret_conv, true);
28891 }
28892
28893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28894         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
28895         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
28896         return ret_conv;
28897 }
28898
28899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28900         if (!ptr_is_owned(_res)) return;
28901         void* _res_ptr = untag_ptr(_res);
28902         CHECK_ACCESS(_res_ptr);
28903         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
28904         FREE(untag_ptr(_res));
28905         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
28906 }
28907
28908 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
28909         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28910         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
28911         return tag_ptr(ret_conv, true);
28912 }
28913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28914         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
28915         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
28916         return ret_conv;
28917 }
28918
28919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28920         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
28921         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28922         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
28923         return tag_ptr(ret_conv, true);
28924 }
28925
28926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28927         LDKErrorMessage o_conv;
28928         o_conv.inner = untag_ptr(o);
28929         o_conv.is_owned = ptr_is_owned(o);
28930         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28931         o_conv = ErrorMessage_clone(&o_conv);
28932         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28933         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
28934         return tag_ptr(ret_conv, true);
28935 }
28936
28937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28938         void* e_ptr = untag_ptr(e);
28939         CHECK_ACCESS(e_ptr);
28940         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28941         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28942         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28943         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
28944         return tag_ptr(ret_conv, true);
28945 }
28946
28947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28948         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
28949         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
28950         return ret_conv;
28951 }
28952
28953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28954         if (!ptr_is_owned(_res)) return;
28955         void* _res_ptr = untag_ptr(_res);
28956         CHECK_ACCESS(_res_ptr);
28957         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
28958         FREE(untag_ptr(_res));
28959         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
28960 }
28961
28962 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
28963         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28964         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
28965         return tag_ptr(ret_conv, true);
28966 }
28967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28968         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
28969         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
28970         return ret_conv;
28971 }
28972
28973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28974         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
28975         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28976         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
28977         return tag_ptr(ret_conv, true);
28978 }
28979
28980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28981         LDKWarningMessage o_conv;
28982         o_conv.inner = untag_ptr(o);
28983         o_conv.is_owned = ptr_is_owned(o);
28984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28985         o_conv = WarningMessage_clone(&o_conv);
28986         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
28987         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
28988         return tag_ptr(ret_conv, true);
28989 }
28990
28991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28992         void* e_ptr = untag_ptr(e);
28993         CHECK_ACCESS(e_ptr);
28994         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28995         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28996         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
28997         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
28998         return tag_ptr(ret_conv, true);
28999 }
29000
29001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29002         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
29003         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
29004         return ret_conv;
29005 }
29006
29007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29008         if (!ptr_is_owned(_res)) return;
29009         void* _res_ptr = untag_ptr(_res);
29010         CHECK_ACCESS(_res_ptr);
29011         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
29012         FREE(untag_ptr(_res));
29013         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
29014 }
29015
29016 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
29017         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
29018         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
29019         return tag_ptr(ret_conv, true);
29020 }
29021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29022         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
29023         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
29024         return ret_conv;
29025 }
29026
29027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29028         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
29029         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
29030         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
29031         return tag_ptr(ret_conv, true);
29032 }
29033
29034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29035         LDKUnsignedNodeAnnouncement o_conv;
29036         o_conv.inner = untag_ptr(o);
29037         o_conv.is_owned = ptr_is_owned(o);
29038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29039         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
29040         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
29041         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
29042         return tag_ptr(ret_conv, true);
29043 }
29044
29045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29046         void* e_ptr = untag_ptr(e);
29047         CHECK_ACCESS(e_ptr);
29048         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29049         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29050         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
29051         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
29052         return tag_ptr(ret_conv, true);
29053 }
29054
29055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29056         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
29057         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
29058         return ret_conv;
29059 }
29060
29061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29062         if (!ptr_is_owned(_res)) return;
29063         void* _res_ptr = untag_ptr(_res);
29064         CHECK_ACCESS(_res_ptr);
29065         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
29066         FREE(untag_ptr(_res));
29067         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
29068 }
29069
29070 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29071         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
29072         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
29073         return tag_ptr(ret_conv, true);
29074 }
29075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29076         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
29077         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29078         return ret_conv;
29079 }
29080
29081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29082         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
29083         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
29084         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
29085         return tag_ptr(ret_conv, true);
29086 }
29087
29088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29089         LDKNodeAnnouncement o_conv;
29090         o_conv.inner = untag_ptr(o);
29091         o_conv.is_owned = ptr_is_owned(o);
29092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29093         o_conv = NodeAnnouncement_clone(&o_conv);
29094         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
29095         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
29096         return tag_ptr(ret_conv, true);
29097 }
29098
29099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29100         void* e_ptr = untag_ptr(e);
29101         CHECK_ACCESS(e_ptr);
29102         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29103         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29104         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
29105         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
29106         return tag_ptr(ret_conv, true);
29107 }
29108
29109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29110         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
29111         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
29112         return ret_conv;
29113 }
29114
29115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29116         if (!ptr_is_owned(_res)) return;
29117         void* _res_ptr = untag_ptr(_res);
29118         CHECK_ACCESS(_res_ptr);
29119         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
29120         FREE(untag_ptr(_res));
29121         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
29122 }
29123
29124 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29125         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
29126         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
29127         return tag_ptr(ret_conv, true);
29128 }
29129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29130         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
29131         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29132         return ret_conv;
29133 }
29134
29135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29136         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
29137         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
29138         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
29139         return tag_ptr(ret_conv, true);
29140 }
29141
29142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29143         LDKQueryShortChannelIds o_conv;
29144         o_conv.inner = untag_ptr(o);
29145         o_conv.is_owned = ptr_is_owned(o);
29146         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29147         o_conv = QueryShortChannelIds_clone(&o_conv);
29148         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
29149         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
29150         return tag_ptr(ret_conv, true);
29151 }
29152
29153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29154         void* e_ptr = untag_ptr(e);
29155         CHECK_ACCESS(e_ptr);
29156         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29157         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29158         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
29159         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
29160         return tag_ptr(ret_conv, true);
29161 }
29162
29163 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29164         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
29165         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
29166         return ret_conv;
29167 }
29168
29169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29170         if (!ptr_is_owned(_res)) return;
29171         void* _res_ptr = untag_ptr(_res);
29172         CHECK_ACCESS(_res_ptr);
29173         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
29174         FREE(untag_ptr(_res));
29175         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
29176 }
29177
29178 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
29179         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
29180         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
29181         return tag_ptr(ret_conv, true);
29182 }
29183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29184         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
29185         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
29186         return ret_conv;
29187 }
29188
29189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29190         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
29191         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
29192         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
29193         return tag_ptr(ret_conv, true);
29194 }
29195
29196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29197         LDKReplyShortChannelIdsEnd o_conv;
29198         o_conv.inner = untag_ptr(o);
29199         o_conv.is_owned = ptr_is_owned(o);
29200         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29201         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
29202         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
29203         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
29204         return tag_ptr(ret_conv, true);
29205 }
29206
29207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29208         void* e_ptr = untag_ptr(e);
29209         CHECK_ACCESS(e_ptr);
29210         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29211         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29212         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
29213         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
29214         return tag_ptr(ret_conv, true);
29215 }
29216
29217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29218         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
29219         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
29220         return ret_conv;
29221 }
29222
29223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29224         if (!ptr_is_owned(_res)) return;
29225         void* _res_ptr = untag_ptr(_res);
29226         CHECK_ACCESS(_res_ptr);
29227         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
29228         FREE(untag_ptr(_res));
29229         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
29230 }
29231
29232 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
29233         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
29234         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
29235         return tag_ptr(ret_conv, true);
29236 }
29237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29238         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
29239         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
29240         return ret_conv;
29241 }
29242
29243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29244         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
29245         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
29246         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
29247         return tag_ptr(ret_conv, true);
29248 }
29249
29250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29251         LDKQueryChannelRange o_conv;
29252         o_conv.inner = untag_ptr(o);
29253         o_conv.is_owned = ptr_is_owned(o);
29254         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29255         o_conv = QueryChannelRange_clone(&o_conv);
29256         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
29257         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
29258         return tag_ptr(ret_conv, true);
29259 }
29260
29261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29262         void* e_ptr = untag_ptr(e);
29263         CHECK_ACCESS(e_ptr);
29264         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29265         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29266         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
29267         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
29268         return tag_ptr(ret_conv, true);
29269 }
29270
29271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29272         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
29273         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
29274         return ret_conv;
29275 }
29276
29277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29278         if (!ptr_is_owned(_res)) return;
29279         void* _res_ptr = untag_ptr(_res);
29280         CHECK_ACCESS(_res_ptr);
29281         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
29282         FREE(untag_ptr(_res));
29283         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
29284 }
29285
29286 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
29287         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
29288         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
29289         return tag_ptr(ret_conv, true);
29290 }
29291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29292         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
29293         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
29294         return ret_conv;
29295 }
29296
29297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29298         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
29299         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
29300         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
29301         return tag_ptr(ret_conv, true);
29302 }
29303
29304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29305         LDKReplyChannelRange o_conv;
29306         o_conv.inner = untag_ptr(o);
29307         o_conv.is_owned = ptr_is_owned(o);
29308         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29309         o_conv = ReplyChannelRange_clone(&o_conv);
29310         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
29311         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
29312         return tag_ptr(ret_conv, true);
29313 }
29314
29315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29316         void* e_ptr = untag_ptr(e);
29317         CHECK_ACCESS(e_ptr);
29318         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29319         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29320         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
29321         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
29322         return tag_ptr(ret_conv, true);
29323 }
29324
29325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29326         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
29327         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
29328         return ret_conv;
29329 }
29330
29331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29332         if (!ptr_is_owned(_res)) return;
29333         void* _res_ptr = untag_ptr(_res);
29334         CHECK_ACCESS(_res_ptr);
29335         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
29336         FREE(untag_ptr(_res));
29337         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
29338 }
29339
29340 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
29341         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
29342         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
29343         return tag_ptr(ret_conv, true);
29344 }
29345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29346         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
29347         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
29348         return ret_conv;
29349 }
29350
29351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29352         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
29353         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
29354         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
29355         return tag_ptr(ret_conv, true);
29356 }
29357
29358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29359         LDKGossipTimestampFilter o_conv;
29360         o_conv.inner = untag_ptr(o);
29361         o_conv.is_owned = ptr_is_owned(o);
29362         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29363         o_conv = GossipTimestampFilter_clone(&o_conv);
29364         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
29365         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
29366         return tag_ptr(ret_conv, true);
29367 }
29368
29369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29370         void* e_ptr = untag_ptr(e);
29371         CHECK_ACCESS(e_ptr);
29372         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29373         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29374         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
29375         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
29376         return tag_ptr(ret_conv, true);
29377 }
29378
29379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29380         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
29381         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
29382         return ret_conv;
29383 }
29384
29385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29386         if (!ptr_is_owned(_res)) return;
29387         void* _res_ptr = untag_ptr(_res);
29388         CHECK_ACCESS(_res_ptr);
29389         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
29390         FREE(untag_ptr(_res));
29391         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
29392 }
29393
29394 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
29395         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
29396         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
29397         return tag_ptr(ret_conv, true);
29398 }
29399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29400         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
29401         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
29402         return ret_conv;
29403 }
29404
29405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29406         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
29407         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
29408         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
29409         return tag_ptr(ret_conv, true);
29410 }
29411
29412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29413         LDKCVec_PhantomRouteHintsZ _res_constr;
29414         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29415         if (_res_constr.datalen > 0)
29416                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
29417         else
29418                 _res_constr.data = NULL;
29419         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29420         for (size_t t = 0; t < _res_constr.datalen; t++) {
29421                 int64_t _res_conv_19 = _res_vals[t];
29422                 LDKPhantomRouteHints _res_conv_19_conv;
29423                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
29424                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
29425                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
29426                 _res_constr.data[t] = _res_conv_19_conv;
29427         }
29428         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29429         CVec_PhantomRouteHintsZ_free(_res_constr);
29430 }
29431
29432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29433         LDKBolt11Invoice o_conv;
29434         o_conv.inner = untag_ptr(o);
29435         o_conv.is_owned = ptr_is_owned(o);
29436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29437         o_conv = Bolt11Invoice_clone(&o_conv);
29438         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
29439         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
29440         return tag_ptr(ret_conv, true);
29441 }
29442
29443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29444         void* e_ptr = untag_ptr(e);
29445         CHECK_ACCESS(e_ptr);
29446         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
29447         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
29448         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
29449         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
29450         return tag_ptr(ret_conv, true);
29451 }
29452
29453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29454         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
29455         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
29456         return ret_conv;
29457 }
29458
29459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29460         if (!ptr_is_owned(_res)) return;
29461         void* _res_ptr = untag_ptr(_res);
29462         CHECK_ACCESS(_res_ptr);
29463         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
29464         FREE(untag_ptr(_res));
29465         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
29466 }
29467
29468 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
29469         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
29470         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
29471         return tag_ptr(ret_conv, true);
29472 }
29473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29474         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
29475         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
29476         return ret_conv;
29477 }
29478
29479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29480         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
29481         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
29482         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
29483         return tag_ptr(ret_conv, true);
29484 }
29485
29486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29487         LDKCVec_FutureZ _res_constr;
29488         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29489         if (_res_constr.datalen > 0)
29490                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
29491         else
29492                 _res_constr.data = NULL;
29493         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29494         for (size_t i = 0; i < _res_constr.datalen; i++) {
29495                 int64_t _res_conv_8 = _res_vals[i];
29496                 LDKFuture _res_conv_8_conv;
29497                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
29498                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
29499                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
29500                 _res_constr.data[i] = _res_conv_8_conv;
29501         }
29502         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29503         CVec_FutureZ_free(_res_constr);
29504 }
29505
29506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29507         void* o_ptr = untag_ptr(o);
29508         CHECK_ACCESS(o_ptr);
29509         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
29510         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
29511         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
29512         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
29513         return tag_ptr(ret_conv, true);
29514 }
29515
29516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29517         void* e_ptr = untag_ptr(e);
29518         CHECK_ACCESS(e_ptr);
29519         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29520         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29521         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
29522         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
29523         return tag_ptr(ret_conv, true);
29524 }
29525
29526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29527         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
29528         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
29529         return ret_conv;
29530 }
29531
29532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29533         if (!ptr_is_owned(_res)) return;
29534         void* _res_ptr = untag_ptr(_res);
29535         CHECK_ACCESS(_res_ptr);
29536         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
29537         FREE(untag_ptr(_res));
29538         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
29539 }
29540
29541 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
29542         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
29543         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
29544         return tag_ptr(ret_conv, true);
29545 }
29546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29547         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
29548         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
29549         return ret_conv;
29550 }
29551
29552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29553         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
29554         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
29555         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
29556         return tag_ptr(ret_conv, true);
29557 }
29558
29559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
29560         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
29561         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
29562         *ret_copy = COption_HTLCClaimZ_some(o_conv);
29563         int64_t ret_ref = tag_ptr(ret_copy, true);
29564         return ret_ref;
29565 }
29566
29567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
29568         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
29569         *ret_copy = COption_HTLCClaimZ_none();
29570         int64_t ret_ref = tag_ptr(ret_copy, true);
29571         return ret_ref;
29572 }
29573
29574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29575         if (!ptr_is_owned(_res)) return;
29576         void* _res_ptr = untag_ptr(_res);
29577         CHECK_ACCESS(_res_ptr);
29578         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
29579         FREE(untag_ptr(_res));
29580         COption_HTLCClaimZ_free(_res_conv);
29581 }
29582
29583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29584         LDKCounterpartyCommitmentSecrets o_conv;
29585         o_conv.inner = untag_ptr(o);
29586         o_conv.is_owned = ptr_is_owned(o);
29587         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29588         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
29589         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
29590         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
29591         return tag_ptr(ret_conv, true);
29592 }
29593
29594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29595         void* e_ptr = untag_ptr(e);
29596         CHECK_ACCESS(e_ptr);
29597         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29598         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29599         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
29600         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
29601         return tag_ptr(ret_conv, true);
29602 }
29603
29604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29605         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
29606         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
29607         return ret_conv;
29608 }
29609
29610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29611         if (!ptr_is_owned(_res)) return;
29612         void* _res_ptr = untag_ptr(_res);
29613         CHECK_ACCESS(_res_ptr);
29614         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
29615         FREE(untag_ptr(_res));
29616         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
29617 }
29618
29619 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
29620         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
29621         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
29622         return tag_ptr(ret_conv, true);
29623 }
29624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29625         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
29626         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
29627         return ret_conv;
29628 }
29629
29630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29631         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
29632         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
29633         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
29634         return tag_ptr(ret_conv, true);
29635 }
29636
29637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29638         LDKTxCreationKeys o_conv;
29639         o_conv.inner = untag_ptr(o);
29640         o_conv.is_owned = ptr_is_owned(o);
29641         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29642         o_conv = TxCreationKeys_clone(&o_conv);
29643         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29644         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
29645         return tag_ptr(ret_conv, true);
29646 }
29647
29648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29649         void* e_ptr = untag_ptr(e);
29650         CHECK_ACCESS(e_ptr);
29651         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29652         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29653         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29654         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
29655         return tag_ptr(ret_conv, true);
29656 }
29657
29658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29659         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
29660         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
29661         return ret_conv;
29662 }
29663
29664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29665         if (!ptr_is_owned(_res)) return;
29666         void* _res_ptr = untag_ptr(_res);
29667         CHECK_ACCESS(_res_ptr);
29668         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
29669         FREE(untag_ptr(_res));
29670         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
29671 }
29672
29673 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
29674         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29675         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
29676         return tag_ptr(ret_conv, true);
29677 }
29678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29679         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
29680         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
29681         return ret_conv;
29682 }
29683
29684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29685         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
29686         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29687         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
29688         return tag_ptr(ret_conv, true);
29689 }
29690
29691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29692         LDKChannelPublicKeys o_conv;
29693         o_conv.inner = untag_ptr(o);
29694         o_conv.is_owned = ptr_is_owned(o);
29695         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29696         o_conv = ChannelPublicKeys_clone(&o_conv);
29697         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29698         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
29699         return tag_ptr(ret_conv, true);
29700 }
29701
29702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29703         void* e_ptr = untag_ptr(e);
29704         CHECK_ACCESS(e_ptr);
29705         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29706         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29707         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29708         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
29709         return tag_ptr(ret_conv, true);
29710 }
29711
29712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29713         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
29714         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
29715         return ret_conv;
29716 }
29717
29718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29719         if (!ptr_is_owned(_res)) return;
29720         void* _res_ptr = untag_ptr(_res);
29721         CHECK_ACCESS(_res_ptr);
29722         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
29723         FREE(untag_ptr(_res));
29724         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
29725 }
29726
29727 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
29728         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29729         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
29730         return tag_ptr(ret_conv, true);
29731 }
29732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29733         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
29734         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
29735         return ret_conv;
29736 }
29737
29738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29739         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
29740         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29741         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
29742         return tag_ptr(ret_conv, true);
29743 }
29744
29745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29746         LDKHTLCOutputInCommitment o_conv;
29747         o_conv.inner = untag_ptr(o);
29748         o_conv.is_owned = ptr_is_owned(o);
29749         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29750         o_conv = HTLCOutputInCommitment_clone(&o_conv);
29751         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29752         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
29753         return tag_ptr(ret_conv, true);
29754 }
29755
29756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29757         void* e_ptr = untag_ptr(e);
29758         CHECK_ACCESS(e_ptr);
29759         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29760         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29761         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29762         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
29763         return tag_ptr(ret_conv, true);
29764 }
29765
29766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29767         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
29768         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
29769         return ret_conv;
29770 }
29771
29772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29773         if (!ptr_is_owned(_res)) return;
29774         void* _res_ptr = untag_ptr(_res);
29775         CHECK_ACCESS(_res_ptr);
29776         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
29777         FREE(untag_ptr(_res));
29778         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
29779 }
29780
29781 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
29782         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29783         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
29784         return tag_ptr(ret_conv, true);
29785 }
29786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29787         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
29788         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
29789         return ret_conv;
29790 }
29791
29792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29793         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
29794         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29795         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
29796         return tag_ptr(ret_conv, true);
29797 }
29798
29799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29800         LDKCounterpartyChannelTransactionParameters o_conv;
29801         o_conv.inner = untag_ptr(o);
29802         o_conv.is_owned = ptr_is_owned(o);
29803         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29804         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
29805         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29806         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
29807         return tag_ptr(ret_conv, true);
29808 }
29809
29810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29811         void* e_ptr = untag_ptr(e);
29812         CHECK_ACCESS(e_ptr);
29813         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29814         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29815         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29816         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
29817         return tag_ptr(ret_conv, true);
29818 }
29819
29820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29821         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
29822         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
29823         return ret_conv;
29824 }
29825
29826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29827         if (!ptr_is_owned(_res)) return;
29828         void* _res_ptr = untag_ptr(_res);
29829         CHECK_ACCESS(_res_ptr);
29830         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
29831         FREE(untag_ptr(_res));
29832         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
29833 }
29834
29835 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
29836         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29837         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
29838         return tag_ptr(ret_conv, true);
29839 }
29840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29841         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
29842         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
29843         return ret_conv;
29844 }
29845
29846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29847         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
29848         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29849         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
29850         return tag_ptr(ret_conv, true);
29851 }
29852
29853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29854         LDKChannelTransactionParameters o_conv;
29855         o_conv.inner = untag_ptr(o);
29856         o_conv.is_owned = ptr_is_owned(o);
29857         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29858         o_conv = ChannelTransactionParameters_clone(&o_conv);
29859         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29860         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
29861         return tag_ptr(ret_conv, true);
29862 }
29863
29864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29865         void* e_ptr = untag_ptr(e);
29866         CHECK_ACCESS(e_ptr);
29867         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29868         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29869         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29870         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
29871         return tag_ptr(ret_conv, true);
29872 }
29873
29874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29875         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
29876         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
29877         return ret_conv;
29878 }
29879
29880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29881         if (!ptr_is_owned(_res)) return;
29882         void* _res_ptr = untag_ptr(_res);
29883         CHECK_ACCESS(_res_ptr);
29884         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
29885         FREE(untag_ptr(_res));
29886         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
29887 }
29888
29889 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
29890         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29891         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
29892         return tag_ptr(ret_conv, true);
29893 }
29894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29895         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
29896         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
29897         return ret_conv;
29898 }
29899
29900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29901         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
29902         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29903         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
29904         return tag_ptr(ret_conv, true);
29905 }
29906
29907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29908         LDKHolderCommitmentTransaction o_conv;
29909         o_conv.inner = untag_ptr(o);
29910         o_conv.is_owned = ptr_is_owned(o);
29911         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29912         o_conv = HolderCommitmentTransaction_clone(&o_conv);
29913         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29914         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
29915         return tag_ptr(ret_conv, true);
29916 }
29917
29918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29919         void* e_ptr = untag_ptr(e);
29920         CHECK_ACCESS(e_ptr);
29921         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29922         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29923         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29924         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
29925         return tag_ptr(ret_conv, true);
29926 }
29927
29928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29929         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
29930         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
29931         return ret_conv;
29932 }
29933
29934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29935         if (!ptr_is_owned(_res)) return;
29936         void* _res_ptr = untag_ptr(_res);
29937         CHECK_ACCESS(_res_ptr);
29938         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
29939         FREE(untag_ptr(_res));
29940         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
29941 }
29942
29943 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
29944         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29945         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
29946         return tag_ptr(ret_conv, true);
29947 }
29948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29949         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
29950         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
29951         return ret_conv;
29952 }
29953
29954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29955         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
29956         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29957         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
29958         return tag_ptr(ret_conv, true);
29959 }
29960
29961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29962         LDKBuiltCommitmentTransaction o_conv;
29963         o_conv.inner = untag_ptr(o);
29964         o_conv.is_owned = ptr_is_owned(o);
29965         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29966         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
29967         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
29968         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
29969         return tag_ptr(ret_conv, true);
29970 }
29971
29972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29973         void* e_ptr = untag_ptr(e);
29974         CHECK_ACCESS(e_ptr);
29975         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29976         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29977         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
29978         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
29979         return tag_ptr(ret_conv, true);
29980 }
29981
29982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29983         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
29984         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
29985         return ret_conv;
29986 }
29987
29988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29989         if (!ptr_is_owned(_res)) return;
29990         void* _res_ptr = untag_ptr(_res);
29991         CHECK_ACCESS(_res_ptr);
29992         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
29993         FREE(untag_ptr(_res));
29994         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
29995 }
29996
29997 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
29998         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
29999         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
30000         return tag_ptr(ret_conv, true);
30001 }
30002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30003         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
30004         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
30005         return ret_conv;
30006 }
30007
30008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30009         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
30010         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
30011         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
30012         return tag_ptr(ret_conv, true);
30013 }
30014
30015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30016         LDKTrustedClosingTransaction o_conv;
30017         o_conv.inner = untag_ptr(o);
30018         o_conv.is_owned = ptr_is_owned(o);
30019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30020         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
30021         
30022         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
30023         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
30024         return tag_ptr(ret_conv, true);
30025 }
30026
30027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
30028         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
30029         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
30030         return tag_ptr(ret_conv, true);
30031 }
30032
30033 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30034         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
30035         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
30036         return ret_conv;
30037 }
30038
30039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30040         if (!ptr_is_owned(_res)) return;
30041         void* _res_ptr = untag_ptr(_res);
30042         CHECK_ACCESS(_res_ptr);
30043         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
30044         FREE(untag_ptr(_res));
30045         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
30046 }
30047
30048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30049         LDKCommitmentTransaction o_conv;
30050         o_conv.inner = untag_ptr(o);
30051         o_conv.is_owned = ptr_is_owned(o);
30052         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30053         o_conv = CommitmentTransaction_clone(&o_conv);
30054         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30055         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
30056         return tag_ptr(ret_conv, true);
30057 }
30058
30059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30060         void* e_ptr = untag_ptr(e);
30061         CHECK_ACCESS(e_ptr);
30062         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30063         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30064         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30065         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
30066         return tag_ptr(ret_conv, true);
30067 }
30068
30069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30070         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
30071         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
30072         return ret_conv;
30073 }
30074
30075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30076         if (!ptr_is_owned(_res)) return;
30077         void* _res_ptr = untag_ptr(_res);
30078         CHECK_ACCESS(_res_ptr);
30079         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
30080         FREE(untag_ptr(_res));
30081         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
30082 }
30083
30084 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
30085         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30086         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
30087         return tag_ptr(ret_conv, true);
30088 }
30089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30090         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
30091         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
30092         return ret_conv;
30093 }
30094
30095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30096         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
30097         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30098         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
30099         return tag_ptr(ret_conv, true);
30100 }
30101
30102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30103         LDKTrustedCommitmentTransaction o_conv;
30104         o_conv.inner = untag_ptr(o);
30105         o_conv.is_owned = ptr_is_owned(o);
30106         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30107         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
30108         
30109         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30110         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
30111         return tag_ptr(ret_conv, true);
30112 }
30113
30114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
30115         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30116         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
30117         return tag_ptr(ret_conv, true);
30118 }
30119
30120 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30121         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
30122         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
30123         return ret_conv;
30124 }
30125
30126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30127         if (!ptr_is_owned(_res)) return;
30128         void* _res_ptr = untag_ptr(_res);
30129         CHECK_ACCESS(_res_ptr);
30130         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
30131         FREE(untag_ptr(_res));
30132         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
30133 }
30134
30135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
30136         LDKCVec_SignatureZ o_constr;
30137         o_constr.datalen = (*env)->GetArrayLength(env, o);
30138         if (o_constr.datalen > 0)
30139                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30140         else
30141                 o_constr.data = NULL;
30142         for (size_t i = 0; i < o_constr.datalen; i++) {
30143                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
30144                 LDKSignature o_conv_8_ref;
30145                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
30146                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
30147                 o_constr.data[i] = o_conv_8_ref;
30148         }
30149         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30150         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
30151         return tag_ptr(ret_conv, true);
30152 }
30153
30154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
30155         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30156         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
30157         return tag_ptr(ret_conv, true);
30158 }
30159
30160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30161         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
30162         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
30163         return ret_conv;
30164 }
30165
30166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30167         if (!ptr_is_owned(_res)) return;
30168         void* _res_ptr = untag_ptr(_res);
30169         CHECK_ACCESS(_res_ptr);
30170         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
30171         FREE(untag_ptr(_res));
30172         CResult_CVec_SignatureZNoneZ_free(_res_conv);
30173 }
30174
30175 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
30176         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30177         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
30178         return tag_ptr(ret_conv, true);
30179 }
30180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30181         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
30182         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
30183         return ret_conv;
30184 }
30185
30186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30187         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
30188         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30189         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
30190         return tag_ptr(ret_conv, true);
30191 }
30192
30193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30194         LDKShutdownScript o_conv;
30195         o_conv.inner = untag_ptr(o);
30196         o_conv.is_owned = ptr_is_owned(o);
30197         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30198         o_conv = ShutdownScript_clone(&o_conv);
30199         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30200         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
30201         return tag_ptr(ret_conv, true);
30202 }
30203
30204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30205         void* e_ptr = untag_ptr(e);
30206         CHECK_ACCESS(e_ptr);
30207         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30208         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30209         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30210         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
30211         return tag_ptr(ret_conv, true);
30212 }
30213
30214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30215         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
30216         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
30217         return ret_conv;
30218 }
30219
30220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30221         if (!ptr_is_owned(_res)) return;
30222         void* _res_ptr = untag_ptr(_res);
30223         CHECK_ACCESS(_res_ptr);
30224         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
30225         FREE(untag_ptr(_res));
30226         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
30227 }
30228
30229 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
30230         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30231         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
30232         return tag_ptr(ret_conv, true);
30233 }
30234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30235         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
30236         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
30237         return ret_conv;
30238 }
30239
30240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30241         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
30242         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30243         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
30244         return tag_ptr(ret_conv, true);
30245 }
30246
30247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30248         LDKShutdownScript o_conv;
30249         o_conv.inner = untag_ptr(o);
30250         o_conv.is_owned = ptr_is_owned(o);
30251         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30252         o_conv = ShutdownScript_clone(&o_conv);
30253         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30254         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
30255         return tag_ptr(ret_conv, true);
30256 }
30257
30258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30259         LDKInvalidShutdownScript e_conv;
30260         e_conv.inner = untag_ptr(e);
30261         e_conv.is_owned = ptr_is_owned(e);
30262         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
30263         e_conv = InvalidShutdownScript_clone(&e_conv);
30264         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30265         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
30266         return tag_ptr(ret_conv, true);
30267 }
30268
30269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30270         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
30271         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
30272         return ret_conv;
30273 }
30274
30275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30276         if (!ptr_is_owned(_res)) return;
30277         void* _res_ptr = untag_ptr(_res);
30278         CHECK_ACCESS(_res_ptr);
30279         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
30280         FREE(untag_ptr(_res));
30281         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
30282 }
30283
30284 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
30285         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30286         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
30287         return tag_ptr(ret_conv, true);
30288 }
30289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30290         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
30291         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
30292         return ret_conv;
30293 }
30294
30295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30296         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
30297         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30298         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
30299         return tag_ptr(ret_conv, true);
30300 }
30301
30302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30303         void* o_ptr = untag_ptr(o);
30304         CHECK_ACCESS(o_ptr);
30305         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
30306         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
30307         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
30308         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
30309         return tag_ptr(ret_conv, true);
30310 }
30311
30312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30313         void* e_ptr = untag_ptr(e);
30314         CHECK_ACCESS(e_ptr);
30315         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30316         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30317         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
30318         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
30319         return tag_ptr(ret_conv, true);
30320 }
30321
30322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30323         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
30324         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
30325         return ret_conv;
30326 }
30327
30328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30329         if (!ptr_is_owned(_res)) return;
30330         void* _res_ptr = untag_ptr(_res);
30331         CHECK_ACCESS(_res_ptr);
30332         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
30333         FREE(untag_ptr(_res));
30334         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
30335 }
30336
30337 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
30338         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
30339         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
30340         return tag_ptr(ret_conv, true);
30341 }
30342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30343         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
30344         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
30345         return ret_conv;
30346 }
30347
30348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30349         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
30350         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
30351         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
30352         return tag_ptr(ret_conv, true);
30353 }
30354
30355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30356         void* o_ptr = untag_ptr(o);
30357         CHECK_ACCESS(o_ptr);
30358         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
30359         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
30360         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
30361         *ret_copy = COption_PathFailureZ_some(o_conv);
30362         int64_t ret_ref = tag_ptr(ret_copy, true);
30363         return ret_ref;
30364 }
30365
30366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
30367         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
30368         *ret_copy = COption_PathFailureZ_none();
30369         int64_t ret_ref = tag_ptr(ret_copy, true);
30370         return ret_ref;
30371 }
30372
30373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30374         if (!ptr_is_owned(_res)) return;
30375         void* _res_ptr = untag_ptr(_res);
30376         CHECK_ACCESS(_res_ptr);
30377         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
30378         FREE(untag_ptr(_res));
30379         COption_PathFailureZ_free(_res_conv);
30380 }
30381
30382 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
30383         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
30384         *ret_copy = COption_PathFailureZ_clone(arg);
30385         int64_t ret_ref = tag_ptr(ret_copy, true);
30386         return ret_ref;
30387 }
30388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30389         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
30390         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
30391         return ret_conv;
30392 }
30393
30394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30395         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
30396         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
30397         *ret_copy = COption_PathFailureZ_clone(orig_conv);
30398         int64_t ret_ref = tag_ptr(ret_copy, true);
30399         return ret_ref;
30400 }
30401
30402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30403         void* o_ptr = untag_ptr(o);
30404         CHECK_ACCESS(o_ptr);
30405         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
30406         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
30407         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
30408         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
30409         return tag_ptr(ret_conv, true);
30410 }
30411
30412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30413         void* e_ptr = untag_ptr(e);
30414         CHECK_ACCESS(e_ptr);
30415         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30416         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30417         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
30418         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
30419         return tag_ptr(ret_conv, true);
30420 }
30421
30422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30423         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
30424         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
30425         return ret_conv;
30426 }
30427
30428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30429         if (!ptr_is_owned(_res)) return;
30430         void* _res_ptr = untag_ptr(_res);
30431         CHECK_ACCESS(_res_ptr);
30432         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
30433         FREE(untag_ptr(_res));
30434         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
30435 }
30436
30437 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
30438         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
30439         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
30440         return tag_ptr(ret_conv, true);
30441 }
30442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30443         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
30444         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
30445         return ret_conv;
30446 }
30447
30448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30449         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
30450         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
30451         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
30452         return tag_ptr(ret_conv, true);
30453 }
30454
30455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30456         void* o_ptr = untag_ptr(o);
30457         CHECK_ACCESS(o_ptr);
30458         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
30459         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
30460         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
30461         *ret_copy = COption_ClosureReasonZ_some(o_conv);
30462         int64_t ret_ref = tag_ptr(ret_copy, true);
30463         return ret_ref;
30464 }
30465
30466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
30467         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
30468         *ret_copy = COption_ClosureReasonZ_none();
30469         int64_t ret_ref = tag_ptr(ret_copy, true);
30470         return ret_ref;
30471 }
30472
30473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30474         if (!ptr_is_owned(_res)) return;
30475         void* _res_ptr = untag_ptr(_res);
30476         CHECK_ACCESS(_res_ptr);
30477         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
30478         FREE(untag_ptr(_res));
30479         COption_ClosureReasonZ_free(_res_conv);
30480 }
30481
30482 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
30483         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
30484         *ret_copy = COption_ClosureReasonZ_clone(arg);
30485         int64_t ret_ref = tag_ptr(ret_copy, true);
30486         return ret_ref;
30487 }
30488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30489         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
30490         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
30491         return ret_conv;
30492 }
30493
30494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30495         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
30496         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
30497         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
30498         int64_t ret_ref = tag_ptr(ret_copy, true);
30499         return ret_ref;
30500 }
30501
30502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30503         void* o_ptr = untag_ptr(o);
30504         CHECK_ACCESS(o_ptr);
30505         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
30506         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
30507         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
30508         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
30509         return tag_ptr(ret_conv, true);
30510 }
30511
30512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30513         void* e_ptr = untag_ptr(e);
30514         CHECK_ACCESS(e_ptr);
30515         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30516         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30517         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
30518         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
30519         return tag_ptr(ret_conv, true);
30520 }
30521
30522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30523         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
30524         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
30525         return ret_conv;
30526 }
30527
30528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30529         if (!ptr_is_owned(_res)) return;
30530         void* _res_ptr = untag_ptr(_res);
30531         CHECK_ACCESS(_res_ptr);
30532         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
30533         FREE(untag_ptr(_res));
30534         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
30535 }
30536
30537 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
30538         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
30539         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
30540         return tag_ptr(ret_conv, true);
30541 }
30542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30543         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
30544         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
30545         return ret_conv;
30546 }
30547
30548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30549         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
30550         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
30551         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
30552         return tag_ptr(ret_conv, true);
30553 }
30554
30555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30556         void* o_ptr = untag_ptr(o);
30557         CHECK_ACCESS(o_ptr);
30558         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
30559         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
30560         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
30561         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
30562         int64_t ret_ref = tag_ptr(ret_copy, true);
30563         return ret_ref;
30564 }
30565
30566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
30567         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
30568         *ret_copy = COption_HTLCDestinationZ_none();
30569         int64_t ret_ref = tag_ptr(ret_copy, true);
30570         return ret_ref;
30571 }
30572
30573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30574         if (!ptr_is_owned(_res)) return;
30575         void* _res_ptr = untag_ptr(_res);
30576         CHECK_ACCESS(_res_ptr);
30577         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
30578         FREE(untag_ptr(_res));
30579         COption_HTLCDestinationZ_free(_res_conv);
30580 }
30581
30582 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
30583         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
30584         *ret_copy = COption_HTLCDestinationZ_clone(arg);
30585         int64_t ret_ref = tag_ptr(ret_copy, true);
30586         return ret_ref;
30587 }
30588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30589         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
30590         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
30591         return ret_conv;
30592 }
30593
30594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30595         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
30596         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
30597         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
30598         int64_t ret_ref = tag_ptr(ret_copy, true);
30599         return ret_ref;
30600 }
30601
30602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30603         void* o_ptr = untag_ptr(o);
30604         CHECK_ACCESS(o_ptr);
30605         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
30606         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
30607         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
30608         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
30609         return tag_ptr(ret_conv, true);
30610 }
30611
30612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30613         void* e_ptr = untag_ptr(e);
30614         CHECK_ACCESS(e_ptr);
30615         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30616         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30617         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
30618         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
30619         return tag_ptr(ret_conv, true);
30620 }
30621
30622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30623         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
30624         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
30625         return ret_conv;
30626 }
30627
30628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30629         if (!ptr_is_owned(_res)) return;
30630         void* _res_ptr = untag_ptr(_res);
30631         CHECK_ACCESS(_res_ptr);
30632         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
30633         FREE(untag_ptr(_res));
30634         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
30635 }
30636
30637 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
30638         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
30639         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
30640         return tag_ptr(ret_conv, true);
30641 }
30642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30643         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
30644         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
30645         return ret_conv;
30646 }
30647
30648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30649         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
30650         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
30651         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
30652         return tag_ptr(ret_conv, true);
30653 }
30654
30655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
30656         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
30657         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
30658         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
30659         return tag_ptr(ret_conv, true);
30660 }
30661
30662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30663         void* e_ptr = untag_ptr(e);
30664         CHECK_ACCESS(e_ptr);
30665         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30666         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30667         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
30668         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
30669         return tag_ptr(ret_conv, true);
30670 }
30671
30672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30673         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
30674         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
30675         return ret_conv;
30676 }
30677
30678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30679         if (!ptr_is_owned(_res)) return;
30680         void* _res_ptr = untag_ptr(_res);
30681         CHECK_ACCESS(_res_ptr);
30682         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
30683         FREE(untag_ptr(_res));
30684         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
30685 }
30686
30687 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
30688         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
30689         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
30690         return tag_ptr(ret_conv, true);
30691 }
30692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30693         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
30694         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
30695         return ret_conv;
30696 }
30697
30698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30699         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
30700         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
30701         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
30702         return tag_ptr(ret_conv, true);
30703 }
30704
30705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
30706         LDKU128 o_ref;
30707         CHECK((*env)->GetArrayLength(env, o) == 16);
30708         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
30709         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
30710         *ret_copy = COption_u128Z_some(o_ref);
30711         int64_t ret_ref = tag_ptr(ret_copy, true);
30712         return ret_ref;
30713 }
30714
30715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1none(JNIEnv *env, jclass clz) {
30716         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
30717         *ret_copy = COption_u128Z_none();
30718         int64_t ret_ref = tag_ptr(ret_copy, true);
30719         return ret_ref;
30720 }
30721
30722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
30723         if (!ptr_is_owned(_res)) return;
30724         void* _res_ptr = untag_ptr(_res);
30725         CHECK_ACCESS(_res_ptr);
30726         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
30727         FREE(untag_ptr(_res));
30728         COption_u128Z_free(_res_conv);
30729 }
30730
30731 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
30732         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
30733         *ret_copy = COption_u128Z_clone(arg);
30734         int64_t ret_ref = tag_ptr(ret_copy, true);
30735         return ret_ref;
30736 }
30737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30738         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
30739         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
30740         return ret_conv;
30741 }
30742
30743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30744         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
30745         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
30746         *ret_copy = COption_u128Z_clone(orig_conv);
30747         int64_t ret_ref = tag_ptr(ret_copy, true);
30748         return ret_ref;
30749 }
30750
30751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
30752         LDKThirtyTwoBytes o_ref;
30753         CHECK((*env)->GetArrayLength(env, o) == 32);
30754         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
30755         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
30756         *ret_copy = COption_PaymentIdZ_some(o_ref);
30757         int64_t ret_ref = tag_ptr(ret_copy, true);
30758         return ret_ref;
30759 }
30760
30761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1none(JNIEnv *env, jclass clz) {
30762         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
30763         *ret_copy = COption_PaymentIdZ_none();
30764         int64_t ret_ref = tag_ptr(ret_copy, true);
30765         return ret_ref;
30766 }
30767
30768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30769         if (!ptr_is_owned(_res)) return;
30770         void* _res_ptr = untag_ptr(_res);
30771         CHECK_ACCESS(_res_ptr);
30772         LDKCOption_PaymentIdZ _res_conv = *(LDKCOption_PaymentIdZ*)(_res_ptr);
30773         FREE(untag_ptr(_res));
30774         COption_PaymentIdZ_free(_res_conv);
30775 }
30776
30777 static inline uint64_t COption_PaymentIdZ_clone_ptr(LDKCOption_PaymentIdZ *NONNULL_PTR arg) {
30778         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
30779         *ret_copy = COption_PaymentIdZ_clone(arg);
30780         int64_t ret_ref = tag_ptr(ret_copy, true);
30781         return ret_ref;
30782 }
30783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30784         LDKCOption_PaymentIdZ* arg_conv = (LDKCOption_PaymentIdZ*)untag_ptr(arg);
30785         int64_t ret_conv = COption_PaymentIdZ_clone_ptr(arg_conv);
30786         return ret_conv;
30787 }
30788
30789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30790         LDKCOption_PaymentIdZ* orig_conv = (LDKCOption_PaymentIdZ*)untag_ptr(orig);
30791         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
30792         *ret_copy = COption_PaymentIdZ_clone(orig_conv);
30793         int64_t ret_ref = tag_ptr(ret_copy, true);
30794         return ret_ref;
30795 }
30796
30797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
30798         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
30799         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
30800         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
30801         int64_t ret_ref = tag_ptr(ret_copy, true);
30802         return ret_ref;
30803 }
30804
30805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
30806         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
30807         *ret_copy = COption_PaymentFailureReasonZ_none();
30808         int64_t ret_ref = tag_ptr(ret_copy, true);
30809         return ret_ref;
30810 }
30811
30812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30813         if (!ptr_is_owned(_res)) return;
30814         void* _res_ptr = untag_ptr(_res);
30815         CHECK_ACCESS(_res_ptr);
30816         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
30817         FREE(untag_ptr(_res));
30818         COption_PaymentFailureReasonZ_free(_res_conv);
30819 }
30820
30821 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
30822         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
30823         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
30824         int64_t ret_ref = tag_ptr(ret_copy, true);
30825         return ret_ref;
30826 }
30827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30828         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
30829         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
30830         return ret_conv;
30831 }
30832
30833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30834         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
30835         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
30836         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
30837         int64_t ret_ref = tag_ptr(ret_copy, true);
30838         return ret_ref;
30839 }
30840
30841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30842         void* o_ptr = untag_ptr(o);
30843         CHECK_ACCESS(o_ptr);
30844         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
30845         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
30846         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
30847         *ret_copy = COption_EventZ_some(o_conv);
30848         int64_t ret_ref = tag_ptr(ret_copy, true);
30849         return ret_ref;
30850 }
30851
30852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
30853         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
30854         *ret_copy = COption_EventZ_none();
30855         int64_t ret_ref = tag_ptr(ret_copy, true);
30856         return ret_ref;
30857 }
30858
30859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30860         if (!ptr_is_owned(_res)) return;
30861         void* _res_ptr = untag_ptr(_res);
30862         CHECK_ACCESS(_res_ptr);
30863         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
30864         FREE(untag_ptr(_res));
30865         COption_EventZ_free(_res_conv);
30866 }
30867
30868 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
30869         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
30870         *ret_copy = COption_EventZ_clone(arg);
30871         int64_t ret_ref = tag_ptr(ret_copy, true);
30872         return ret_ref;
30873 }
30874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30875         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
30876         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
30877         return ret_conv;
30878 }
30879
30880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30881         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
30882         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
30883         *ret_copy = COption_EventZ_clone(orig_conv);
30884         int64_t ret_ref = tag_ptr(ret_copy, true);
30885         return ret_ref;
30886 }
30887
30888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30889         void* o_ptr = untag_ptr(o);
30890         CHECK_ACCESS(o_ptr);
30891         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
30892         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
30893         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
30894         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
30895         return tag_ptr(ret_conv, true);
30896 }
30897
30898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30899         void* e_ptr = untag_ptr(e);
30900         CHECK_ACCESS(e_ptr);
30901         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30902         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30903         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
30904         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
30905         return tag_ptr(ret_conv, true);
30906 }
30907
30908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30909         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
30910         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
30911         return ret_conv;
30912 }
30913
30914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30915         if (!ptr_is_owned(_res)) return;
30916         void* _res_ptr = untag_ptr(_res);
30917         CHECK_ACCESS(_res_ptr);
30918         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
30919         FREE(untag_ptr(_res));
30920         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
30921 }
30922
30923 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
30924         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
30925         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
30926         return tag_ptr(ret_conv, true);
30927 }
30928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30929         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
30930         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
30931         return ret_conv;
30932 }
30933
30934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30935         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
30936         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
30937         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
30938         return tag_ptr(ret_conv, true);
30939 }
30940
30941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30942         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
30943         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30944         if (_res_constr.datalen > 0)
30945                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
30946         else
30947                 _res_constr.data = NULL;
30948         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30949         for (size_t j = 0; j < _res_constr.datalen; j++) {
30950                 int64_t _res_conv_35 = _res_vals[j];
30951                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
30952                 CHECK_ACCESS(_res_conv_35_ptr);
30953                 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
30954                 FREE(untag_ptr(_res_conv_35));
30955                 _res_constr.data[j] = _res_conv_35_conv;
30956         }
30957         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30958         CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
30959 }
30960
30961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
30962         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
30963         o_constr.datalen = (*env)->GetArrayLength(env, o);
30964         if (o_constr.datalen > 0)
30965                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
30966         else
30967                 o_constr.data = NULL;
30968         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
30969         for (size_t j = 0; j < o_constr.datalen; j++) {
30970                 int64_t o_conv_35 = o_vals[j];
30971                 void* o_conv_35_ptr = untag_ptr(o_conv_35);
30972                 CHECK_ACCESS(o_conv_35_ptr);
30973                 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
30974                 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o_conv_35));
30975                 o_constr.data[j] = o_conv_35_conv;
30976         }
30977         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
30978         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
30979         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
30980         return tag_ptr(ret_conv, true);
30981 }
30982
30983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30984         LDKIOError e_conv = LDKIOError_from_java(env, e);
30985         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
30986         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
30987         return tag_ptr(ret_conv, true);
30988 }
30989
30990 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30991         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(o);
30992         jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
30993         return ret_conv;
30994 }
30995
30996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30997         if (!ptr_is_owned(_res)) return;
30998         void* _res_ptr = untag_ptr(_res);
30999         CHECK_ACCESS(_res_ptr);
31000         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
31001         FREE(untag_ptr(_res));
31002         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
31003 }
31004
31005 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
31006         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
31007         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
31008         return tag_ptr(ret_conv, true);
31009 }
31010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31011         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(arg);
31012         int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
31013         return ret_conv;
31014 }
31015
31016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31017         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(orig);
31018         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
31019         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
31020         return tag_ptr(ret_conv, true);
31021 }
31022
31023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
31024         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
31025         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
31026         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
31027         return tag_ptr(ret_conv, true);
31028 }
31029
31030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31031         void* e_ptr = untag_ptr(e);
31032         CHECK_ACCESS(e_ptr);
31033         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
31034         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
31035         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
31036         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
31037         return tag_ptr(ret_conv, true);
31038 }
31039
31040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31041         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
31042         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
31043         return ret_conv;
31044 }
31045
31046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31047         if (!ptr_is_owned(_res)) return;
31048         void* _res_ptr = untag_ptr(_res);
31049         CHECK_ACCESS(_res_ptr);
31050         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
31051         FREE(untag_ptr(_res));
31052         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
31053 }
31054
31055 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
31056         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
31057         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
31058         return tag_ptr(ret_conv, true);
31059 }
31060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31061         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
31062         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
31063         return ret_conv;
31064 }
31065
31066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31067         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
31068         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
31069         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
31070         return tag_ptr(ret_conv, true);
31071 }
31072
31073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31074         LDKBolt11Invoice o_conv;
31075         o_conv.inner = untag_ptr(o);
31076         o_conv.is_owned = ptr_is_owned(o);
31077         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31078         o_conv = Bolt11Invoice_clone(&o_conv);
31079         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
31080         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
31081         return tag_ptr(ret_conv, true);
31082 }
31083
31084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31085         void* e_ptr = untag_ptr(e);
31086         CHECK_ACCESS(e_ptr);
31087         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
31088         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
31089         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
31090         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
31091         return tag_ptr(ret_conv, true);
31092 }
31093
31094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31095         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
31096         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
31097         return ret_conv;
31098 }
31099
31100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31101         if (!ptr_is_owned(_res)) return;
31102         void* _res_ptr = untag_ptr(_res);
31103         CHECK_ACCESS(_res_ptr);
31104         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
31105         FREE(untag_ptr(_res));
31106         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
31107 }
31108
31109 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
31110         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
31111         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
31112         return tag_ptr(ret_conv, true);
31113 }
31114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31115         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
31116         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
31117         return ret_conv;
31118 }
31119
31120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31121         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
31122         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
31123         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
31124         return tag_ptr(ret_conv, true);
31125 }
31126
31127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31128         LDKSignedRawBolt11Invoice o_conv;
31129         o_conv.inner = untag_ptr(o);
31130         o_conv.is_owned = ptr_is_owned(o);
31131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31132         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
31133         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
31134         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
31135         return tag_ptr(ret_conv, true);
31136 }
31137
31138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31139         void* e_ptr = untag_ptr(e);
31140         CHECK_ACCESS(e_ptr);
31141         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
31142         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
31143         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
31144         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
31145         return tag_ptr(ret_conv, true);
31146 }
31147
31148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31149         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
31150         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
31151         return ret_conv;
31152 }
31153
31154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31155         if (!ptr_is_owned(_res)) return;
31156         void* _res_ptr = untag_ptr(_res);
31157         CHECK_ACCESS(_res_ptr);
31158         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
31159         FREE(untag_ptr(_res));
31160         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
31161 }
31162
31163 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
31164         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
31165         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
31166         return tag_ptr(ret_conv, true);
31167 }
31168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31169         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
31170         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
31171         return ret_conv;
31172 }
31173
31174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31175         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
31176         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
31177         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
31178         return tag_ptr(ret_conv, true);
31179 }
31180
31181 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
31182         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
31183         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
31184         return tag_ptr(ret_conv, true);
31185 }
31186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31187         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
31188         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
31189         return ret_conv;
31190 }
31191
31192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31193         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
31194         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
31195         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
31196         return tag_ptr(ret_conv, true);
31197 }
31198
31199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
31200         LDKRawBolt11Invoice a_conv;
31201         a_conv.inner = untag_ptr(a);
31202         a_conv.is_owned = ptr_is_owned(a);
31203         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31204         a_conv = RawBolt11Invoice_clone(&a_conv);
31205         LDKThirtyTwoBytes b_ref;
31206         CHECK((*env)->GetArrayLength(env, b) == 32);
31207         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
31208         LDKBolt11InvoiceSignature c_conv;
31209         c_conv.inner = untag_ptr(c);
31210         c_conv.is_owned = ptr_is_owned(c);
31211         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
31212         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
31213         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
31214         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
31215         return tag_ptr(ret_conv, true);
31216 }
31217
31218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31219         if (!ptr_is_owned(_res)) return;
31220         void* _res_ptr = untag_ptr(_res);
31221         CHECK_ACCESS(_res_ptr);
31222         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
31223         FREE(untag_ptr(_res));
31224         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
31225 }
31226
31227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31228         LDKPayeePubKey o_conv;
31229         o_conv.inner = untag_ptr(o);
31230         o_conv.is_owned = ptr_is_owned(o);
31231         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31232         o_conv = PayeePubKey_clone(&o_conv);
31233         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
31234         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
31235         return tag_ptr(ret_conv, true);
31236 }
31237
31238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31239         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
31240         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
31241         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
31242         return tag_ptr(ret_conv, true);
31243 }
31244
31245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31246         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
31247         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
31248         return ret_conv;
31249 }
31250
31251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31252         if (!ptr_is_owned(_res)) return;
31253         void* _res_ptr = untag_ptr(_res);
31254         CHECK_ACCESS(_res_ptr);
31255         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
31256         FREE(untag_ptr(_res));
31257         CResult_PayeePubKeyErrorZ_free(_res_conv);
31258 }
31259
31260 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
31261         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
31262         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
31263         return tag_ptr(ret_conv, true);
31264 }
31265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31266         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
31267         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
31268         return ret_conv;
31269 }
31270
31271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31272         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
31273         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
31274         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
31275         return tag_ptr(ret_conv, true);
31276 }
31277
31278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31279         LDKCVec_PrivateRouteZ _res_constr;
31280         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31281         if (_res_constr.datalen > 0)
31282                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
31283         else
31284                 _res_constr.data = NULL;
31285         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31286         for (size_t o = 0; o < _res_constr.datalen; o++) {
31287                 int64_t _res_conv_14 = _res_vals[o];
31288                 LDKPrivateRoute _res_conv_14_conv;
31289                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
31290                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
31291                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
31292                 _res_constr.data[o] = _res_conv_14_conv;
31293         }
31294         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31295         CVec_PrivateRouteZ_free(_res_constr);
31296 }
31297
31298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31299         LDKPositiveTimestamp o_conv;
31300         o_conv.inner = untag_ptr(o);
31301         o_conv.is_owned = ptr_is_owned(o);
31302         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31303         o_conv = PositiveTimestamp_clone(&o_conv);
31304         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31305         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
31306         return tag_ptr(ret_conv, true);
31307 }
31308
31309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31310         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
31311         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31312         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
31313         return tag_ptr(ret_conv, true);
31314 }
31315
31316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31317         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
31318         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
31319         return ret_conv;
31320 }
31321
31322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31323         if (!ptr_is_owned(_res)) return;
31324         void* _res_ptr = untag_ptr(_res);
31325         CHECK_ACCESS(_res_ptr);
31326         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
31327         FREE(untag_ptr(_res));
31328         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
31329 }
31330
31331 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
31332         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31333         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
31334         return tag_ptr(ret_conv, true);
31335 }
31336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31337         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
31338         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
31339         return ret_conv;
31340 }
31341
31342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31343         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
31344         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31345         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
31346         return tag_ptr(ret_conv, true);
31347 }
31348
31349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
31350         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
31351         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
31352         return tag_ptr(ret_conv, true);
31353 }
31354
31355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31356         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
31357         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
31358         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
31359         return tag_ptr(ret_conv, true);
31360 }
31361
31362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31363         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
31364         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
31365         return ret_conv;
31366 }
31367
31368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31369         if (!ptr_is_owned(_res)) return;
31370         void* _res_ptr = untag_ptr(_res);
31371         CHECK_ACCESS(_res_ptr);
31372         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
31373         FREE(untag_ptr(_res));
31374         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
31375 }
31376
31377 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
31378         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
31379         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
31380         return tag_ptr(ret_conv, true);
31381 }
31382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31383         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
31384         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
31385         return ret_conv;
31386 }
31387
31388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31389         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
31390         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
31391         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
31392         return tag_ptr(ret_conv, true);
31393 }
31394
31395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31396         LDKBolt11Invoice o_conv;
31397         o_conv.inner = untag_ptr(o);
31398         o_conv.is_owned = ptr_is_owned(o);
31399         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31400         o_conv = Bolt11Invoice_clone(&o_conv);
31401         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
31402         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
31403         return tag_ptr(ret_conv, true);
31404 }
31405
31406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31407         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
31408         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
31409         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
31410         return tag_ptr(ret_conv, true);
31411 }
31412
31413 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31414         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
31415         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
31416         return ret_conv;
31417 }
31418
31419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31420         if (!ptr_is_owned(_res)) return;
31421         void* _res_ptr = untag_ptr(_res);
31422         CHECK_ACCESS(_res_ptr);
31423         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
31424         FREE(untag_ptr(_res));
31425         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
31426 }
31427
31428 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
31429         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
31430         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
31431         return tag_ptr(ret_conv, true);
31432 }
31433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31434         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
31435         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
31436         return ret_conv;
31437 }
31438
31439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31440         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
31441         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
31442         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
31443         return tag_ptr(ret_conv, true);
31444 }
31445
31446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1AddressZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
31447         LDKCVec_AddressZ _res_constr;
31448         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31449         if (_res_constr.datalen > 0)
31450                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_AddressZ Elements");
31451         else
31452                 _res_constr.data = NULL;
31453         for (size_t i = 0; i < _res_constr.datalen; i++) {
31454                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
31455                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
31456                 _res_constr.data[i] = dummy;
31457         }
31458         CVec_AddressZ_free(_res_constr);
31459 }
31460
31461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31462         LDKDescription o_conv;
31463         o_conv.inner = untag_ptr(o);
31464         o_conv.is_owned = ptr_is_owned(o);
31465         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31466         o_conv = Description_clone(&o_conv);
31467         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
31468         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
31469         return tag_ptr(ret_conv, true);
31470 }
31471
31472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31473         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
31474         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
31475         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
31476         return tag_ptr(ret_conv, true);
31477 }
31478
31479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31480         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
31481         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
31482         return ret_conv;
31483 }
31484
31485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31486         if (!ptr_is_owned(_res)) return;
31487         void* _res_ptr = untag_ptr(_res);
31488         CHECK_ACCESS(_res_ptr);
31489         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
31490         FREE(untag_ptr(_res));
31491         CResult_DescriptionCreationErrorZ_free(_res_conv);
31492 }
31493
31494 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
31495         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
31496         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
31497         return tag_ptr(ret_conv, true);
31498 }
31499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31500         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
31501         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
31502         return ret_conv;
31503 }
31504
31505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31506         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
31507         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
31508         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
31509         return tag_ptr(ret_conv, true);
31510 }
31511
31512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31513         LDKPrivateRoute o_conv;
31514         o_conv.inner = untag_ptr(o);
31515         o_conv.is_owned = ptr_is_owned(o);
31516         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31517         o_conv = PrivateRoute_clone(&o_conv);
31518         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
31519         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
31520         return tag_ptr(ret_conv, true);
31521 }
31522
31523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31524         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
31525         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
31526         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
31527         return tag_ptr(ret_conv, true);
31528 }
31529
31530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31531         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
31532         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
31533         return ret_conv;
31534 }
31535
31536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31537         if (!ptr_is_owned(_res)) return;
31538         void* _res_ptr = untag_ptr(_res);
31539         CHECK_ACCESS(_res_ptr);
31540         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
31541         FREE(untag_ptr(_res));
31542         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
31543 }
31544
31545 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
31546         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
31547         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
31548         return tag_ptr(ret_conv, true);
31549 }
31550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31551         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
31552         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
31553         return ret_conv;
31554 }
31555
31556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31557         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
31558         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
31559         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
31560         return tag_ptr(ret_conv, true);
31561 }
31562
31563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31564         LDKOutPoint o_conv;
31565         o_conv.inner = untag_ptr(o);
31566         o_conv.is_owned = ptr_is_owned(o);
31567         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31568         o_conv = OutPoint_clone(&o_conv);
31569         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31570         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
31571         return tag_ptr(ret_conv, true);
31572 }
31573
31574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31575         void* e_ptr = untag_ptr(e);
31576         CHECK_ACCESS(e_ptr);
31577         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31578         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31579         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31580         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
31581         return tag_ptr(ret_conv, true);
31582 }
31583
31584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31585         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
31586         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
31587         return ret_conv;
31588 }
31589
31590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31591         if (!ptr_is_owned(_res)) return;
31592         void* _res_ptr = untag_ptr(_res);
31593         CHECK_ACCESS(_res_ptr);
31594         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
31595         FREE(untag_ptr(_res));
31596         CResult_OutPointDecodeErrorZ_free(_res_conv);
31597 }
31598
31599 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
31600         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31601         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
31602         return tag_ptr(ret_conv, true);
31603 }
31604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31605         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
31606         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
31607         return ret_conv;
31608 }
31609
31610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31611         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
31612         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31613         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
31614         return tag_ptr(ret_conv, true);
31615 }
31616
31617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31618         LDKBigSize o_conv;
31619         o_conv.inner = untag_ptr(o);
31620         o_conv.is_owned = ptr_is_owned(o);
31621         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31622         o_conv = BigSize_clone(&o_conv);
31623         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31624         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
31625         return tag_ptr(ret_conv, true);
31626 }
31627
31628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31629         void* e_ptr = untag_ptr(e);
31630         CHECK_ACCESS(e_ptr);
31631         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31632         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31633         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31634         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
31635         return tag_ptr(ret_conv, true);
31636 }
31637
31638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31639         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
31640         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
31641         return ret_conv;
31642 }
31643
31644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31645         if (!ptr_is_owned(_res)) return;
31646         void* _res_ptr = untag_ptr(_res);
31647         CHECK_ACCESS(_res_ptr);
31648         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
31649         FREE(untag_ptr(_res));
31650         CResult_BigSizeDecodeErrorZ_free(_res_conv);
31651 }
31652
31653 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
31654         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31655         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
31656         return tag_ptr(ret_conv, true);
31657 }
31658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31659         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
31660         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
31661         return ret_conv;
31662 }
31663
31664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31665         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
31666         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31667         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
31668         return tag_ptr(ret_conv, true);
31669 }
31670
31671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31672         LDKHostname o_conv;
31673         o_conv.inner = untag_ptr(o);
31674         o_conv.is_owned = ptr_is_owned(o);
31675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31676         o_conv = Hostname_clone(&o_conv);
31677         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
31678         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
31679         return tag_ptr(ret_conv, true);
31680 }
31681
31682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31683         void* e_ptr = untag_ptr(e);
31684         CHECK_ACCESS(e_ptr);
31685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31687         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
31688         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
31689         return tag_ptr(ret_conv, true);
31690 }
31691
31692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31693         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
31694         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
31695         return ret_conv;
31696 }
31697
31698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31699         if (!ptr_is_owned(_res)) return;
31700         void* _res_ptr = untag_ptr(_res);
31701         CHECK_ACCESS(_res_ptr);
31702         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
31703         FREE(untag_ptr(_res));
31704         CResult_HostnameDecodeErrorZ_free(_res_conv);
31705 }
31706
31707 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
31708         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
31709         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
31710         return tag_ptr(ret_conv, true);
31711 }
31712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31713         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
31714         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
31715         return ret_conv;
31716 }
31717
31718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31719         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
31720         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
31721         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
31722         return tag_ptr(ret_conv, true);
31723 }
31724
31725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31726         LDKTransactionU16LenLimited o_conv;
31727         o_conv.inner = untag_ptr(o);
31728         o_conv.is_owned = ptr_is_owned(o);
31729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31730         o_conv = TransactionU16LenLimited_clone(&o_conv);
31731         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
31732         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
31733         return tag_ptr(ret_conv, true);
31734 }
31735
31736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
31737         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
31738         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
31739         return tag_ptr(ret_conv, true);
31740 }
31741
31742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31743         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
31744         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
31745         return ret_conv;
31746 }
31747
31748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31749         if (!ptr_is_owned(_res)) return;
31750         void* _res_ptr = untag_ptr(_res);
31751         CHECK_ACCESS(_res_ptr);
31752         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
31753         FREE(untag_ptr(_res));
31754         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
31755 }
31756
31757 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
31758         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
31759         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
31760         return tag_ptr(ret_conv, true);
31761 }
31762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31763         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
31764         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
31765         return ret_conv;
31766 }
31767
31768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31769         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
31770         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
31771         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
31772         return tag_ptr(ret_conv, true);
31773 }
31774
31775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31776         LDKTransactionU16LenLimited o_conv;
31777         o_conv.inner = untag_ptr(o);
31778         o_conv.is_owned = ptr_is_owned(o);
31779         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31780         o_conv = TransactionU16LenLimited_clone(&o_conv);
31781         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
31782         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
31783         return tag_ptr(ret_conv, true);
31784 }
31785
31786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31787         void* e_ptr = untag_ptr(e);
31788         CHECK_ACCESS(e_ptr);
31789         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31790         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31791         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
31792         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
31793         return tag_ptr(ret_conv, true);
31794 }
31795
31796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31797         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
31798         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
31799         return ret_conv;
31800 }
31801
31802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31803         if (!ptr_is_owned(_res)) return;
31804         void* _res_ptr = untag_ptr(_res);
31805         CHECK_ACCESS(_res_ptr);
31806         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
31807         FREE(untag_ptr(_res));
31808         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
31809 }
31810
31811 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
31812         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
31813         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
31814         return tag_ptr(ret_conv, true);
31815 }
31816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31817         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
31818         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
31819         return ret_conv;
31820 }
31821
31822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31823         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
31824         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
31825         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
31826         return tag_ptr(ret_conv, true);
31827 }
31828
31829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31830         LDKUntrustedString o_conv;
31831         o_conv.inner = untag_ptr(o);
31832         o_conv.is_owned = ptr_is_owned(o);
31833         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31834         o_conv = UntrustedString_clone(&o_conv);
31835         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
31836         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
31837         return tag_ptr(ret_conv, true);
31838 }
31839
31840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31841         void* e_ptr = untag_ptr(e);
31842         CHECK_ACCESS(e_ptr);
31843         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31844         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31845         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
31846         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
31847         return tag_ptr(ret_conv, true);
31848 }
31849
31850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31851         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
31852         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
31853         return ret_conv;
31854 }
31855
31856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31857         if (!ptr_is_owned(_res)) return;
31858         void* _res_ptr = untag_ptr(_res);
31859         CHECK_ACCESS(_res_ptr);
31860         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
31861         FREE(untag_ptr(_res));
31862         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
31863 }
31864
31865 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
31866         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
31867         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
31868         return tag_ptr(ret_conv, true);
31869 }
31870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31871         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
31872         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
31873         return ret_conv;
31874 }
31875
31876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31877         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
31878         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
31879         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
31880         return tag_ptr(ret_conv, true);
31881 }
31882
31883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
31884         LDKThirtyTwoBytes o_ref;
31885         CHECK((*env)->GetArrayLength(env, o) == 32);
31886         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
31887         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
31888         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
31889         return tag_ptr(ret_conv, true);
31890 }
31891
31892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31893         void* e_ptr = untag_ptr(e);
31894         CHECK_ACCESS(e_ptr);
31895         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
31896         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
31897         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
31898         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
31899         return tag_ptr(ret_conv, true);
31900 }
31901
31902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31903         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
31904         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
31905         return ret_conv;
31906 }
31907
31908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31909         if (!ptr_is_owned(_res)) return;
31910         void* _res_ptr = untag_ptr(_res);
31911         CHECK_ACCESS(_res_ptr);
31912         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
31913         FREE(untag_ptr(_res));
31914         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
31915 }
31916
31917 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
31918         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
31919         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
31920         return tag_ptr(ret_conv, true);
31921 }
31922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31923         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
31924         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
31925         return ret_conv;
31926 }
31927
31928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31929         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
31930         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
31931         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
31932         return tag_ptr(ret_conv, true);
31933 }
31934
31935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1ok(JNIEnv *env, jclass clz) {
31936         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
31937         *ret_conv = CResult_NonePaymentErrorZ_ok();
31938         return tag_ptr(ret_conv, true);
31939 }
31940
31941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31942         void* e_ptr = untag_ptr(e);
31943         CHECK_ACCESS(e_ptr);
31944         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
31945         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
31946         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
31947         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
31948         return tag_ptr(ret_conv, true);
31949 }
31950
31951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31952         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
31953         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
31954         return ret_conv;
31955 }
31956
31957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31958         if (!ptr_is_owned(_res)) return;
31959         void* _res_ptr = untag_ptr(_res);
31960         CHECK_ACCESS(_res_ptr);
31961         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
31962         FREE(untag_ptr(_res));
31963         CResult_NonePaymentErrorZ_free(_res_conv);
31964 }
31965
31966 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
31967         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
31968         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
31969         return tag_ptr(ret_conv, true);
31970 }
31971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31972         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
31973         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
31974         return ret_conv;
31975 }
31976
31977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31978         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
31979         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
31980         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
31981         return tag_ptr(ret_conv, true);
31982 }
31983
31984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
31985         LDKStr o_conv = java_to_owned_str(env, o);
31986         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
31987         *ret_conv = CResult_StringErrorZ_ok(o_conv);
31988         return tag_ptr(ret_conv, true);
31989 }
31990
31991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31992         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
31993         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
31994         *ret_conv = CResult_StringErrorZ_err(e_conv);
31995         return tag_ptr(ret_conv, true);
31996 }
31997
31998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31999         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
32000         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
32001         return ret_conv;
32002 }
32003
32004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32005         if (!ptr_is_owned(_res)) return;
32006         void* _res_ptr = untag_ptr(_res);
32007         CHECK_ACCESS(_res_ptr);
32008         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
32009         FREE(untag_ptr(_res));
32010         CResult_StringErrorZ_free(_res_conv);
32011 }
32012
32013 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
32014         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
32015         *ret_conv = CResult_StringErrorZ_clone(arg);
32016         return tag_ptr(ret_conv, true);
32017 }
32018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32019         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
32020         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
32021         return ret_conv;
32022 }
32023
32024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32025         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
32026         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
32027         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
32028         return tag_ptr(ret_conv, true);
32029 }
32030
32031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32032         void* o_ptr = untag_ptr(o);
32033         CHECK_ACCESS(o_ptr);
32034         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
32035         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
32036         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
32037         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
32038         return tag_ptr(ret_conv, true);
32039 }
32040
32041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32042         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
32043         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
32044         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
32045         return tag_ptr(ret_conv, true);
32046 }
32047
32048 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32049         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
32050         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
32051         return ret_conv;
32052 }
32053
32054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32055         if (!ptr_is_owned(_res)) return;
32056         void* _res_ptr = untag_ptr(_res);
32057         CHECK_ACCESS(_res_ptr);
32058         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
32059         FREE(untag_ptr(_res));
32060         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
32061 }
32062
32063 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
32064         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
32065         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
32066         return tag_ptr(ret_conv, true);
32067 }
32068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32069         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
32070         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
32071         return ret_conv;
32072 }
32073
32074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32075         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
32076         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
32077         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
32078         return tag_ptr(ret_conv, true);
32079 }
32080
32081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32082         LDKOnionMessagePath o_conv;
32083         o_conv.inner = untag_ptr(o);
32084         o_conv.is_owned = ptr_is_owned(o);
32085         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32086         o_conv = OnionMessagePath_clone(&o_conv);
32087         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
32088         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
32089         return tag_ptr(ret_conv, true);
32090 }
32091
32092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
32093         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
32094         *ret_conv = CResult_OnionMessagePathNoneZ_err();
32095         return tag_ptr(ret_conv, true);
32096 }
32097
32098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32099         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
32100         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
32101         return ret_conv;
32102 }
32103
32104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32105         if (!ptr_is_owned(_res)) return;
32106         void* _res_ptr = untag_ptr(_res);
32107         CHECK_ACCESS(_res_ptr);
32108         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
32109         FREE(untag_ptr(_res));
32110         CResult_OnionMessagePathNoneZ_free(_res_conv);
32111 }
32112
32113 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
32114         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
32115         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
32116         return tag_ptr(ret_conv, true);
32117 }
32118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32119         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
32120         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
32121         return ret_conv;
32122 }
32123
32124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32125         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
32126         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
32127         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
32128         return tag_ptr(ret_conv, true);
32129 }
32130
32131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) {
32132         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
32133         *ret_conv = CResult_NoneSendErrorZ_ok();
32134         return tag_ptr(ret_conv, true);
32135 }
32136
32137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32138         void* e_ptr = untag_ptr(e);
32139         CHECK_ACCESS(e_ptr);
32140         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
32141         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
32142         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
32143         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
32144         return tag_ptr(ret_conv, true);
32145 }
32146
32147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32148         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
32149         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
32150         return ret_conv;
32151 }
32152
32153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32154         if (!ptr_is_owned(_res)) return;
32155         void* _res_ptr = untag_ptr(_res);
32156         CHECK_ACCESS(_res_ptr);
32157         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
32158         FREE(untag_ptr(_res));
32159         CResult_NoneSendErrorZ_free(_res_conv);
32160 }
32161
32162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32163         LDKBlindedPath o_conv;
32164         o_conv.inner = untag_ptr(o);
32165         o_conv.is_owned = ptr_is_owned(o);
32166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32167         o_conv = BlindedPath_clone(&o_conv);
32168         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
32169         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
32170         return tag_ptr(ret_conv, true);
32171 }
32172
32173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
32174         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
32175         *ret_conv = CResult_BlindedPathNoneZ_err();
32176         return tag_ptr(ret_conv, true);
32177 }
32178
32179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32180         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
32181         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
32182         return ret_conv;
32183 }
32184
32185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32186         if (!ptr_is_owned(_res)) return;
32187         void* _res_ptr = untag_ptr(_res);
32188         CHECK_ACCESS(_res_ptr);
32189         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
32190         FREE(untag_ptr(_res));
32191         CResult_BlindedPathNoneZ_free(_res_conv);
32192 }
32193
32194 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
32195         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
32196         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
32197         return tag_ptr(ret_conv, true);
32198 }
32199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32200         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
32201         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
32202         return ret_conv;
32203 }
32204
32205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32206         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
32207         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
32208         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
32209         return tag_ptr(ret_conv, true);
32210 }
32211
32212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32213         LDKBlindedPath o_conv;
32214         o_conv.inner = untag_ptr(o);
32215         o_conv.is_owned = ptr_is_owned(o);
32216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32217         o_conv = BlindedPath_clone(&o_conv);
32218         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
32219         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
32220         return tag_ptr(ret_conv, true);
32221 }
32222
32223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32224         void* e_ptr = untag_ptr(e);
32225         CHECK_ACCESS(e_ptr);
32226         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32227         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32228         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
32229         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
32230         return tag_ptr(ret_conv, true);
32231 }
32232
32233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32234         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
32235         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
32236         return ret_conv;
32237 }
32238
32239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32240         if (!ptr_is_owned(_res)) return;
32241         void* _res_ptr = untag_ptr(_res);
32242         CHECK_ACCESS(_res_ptr);
32243         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
32244         FREE(untag_ptr(_res));
32245         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
32246 }
32247
32248 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
32249         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
32250         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
32251         return tag_ptr(ret_conv, true);
32252 }
32253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32254         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
32255         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
32256         return ret_conv;
32257 }
32258
32259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32260         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
32261         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
32262         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
32263         return tag_ptr(ret_conv, true);
32264 }
32265
32266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32267         LDKBlindedHop o_conv;
32268         o_conv.inner = untag_ptr(o);
32269         o_conv.is_owned = ptr_is_owned(o);
32270         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32271         o_conv = BlindedHop_clone(&o_conv);
32272         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
32273         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
32274         return tag_ptr(ret_conv, true);
32275 }
32276
32277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32278         void* e_ptr = untag_ptr(e);
32279         CHECK_ACCESS(e_ptr);
32280         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32281         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32282         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
32283         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
32284         return tag_ptr(ret_conv, true);
32285 }
32286
32287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32288         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
32289         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
32290         return ret_conv;
32291 }
32292
32293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32294         if (!ptr_is_owned(_res)) return;
32295         void* _res_ptr = untag_ptr(_res);
32296         CHECK_ACCESS(_res_ptr);
32297         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
32298         FREE(untag_ptr(_res));
32299         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
32300 }
32301
32302 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
32303         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
32304         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
32305         return tag_ptr(ret_conv, true);
32306 }
32307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32308         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
32309         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
32310         return ret_conv;
32311 }
32312
32313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32314         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
32315         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
32316         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
32317         return tag_ptr(ret_conv, true);
32318 }
32319
32320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32321         LDKInvoiceError o_conv;
32322         o_conv.inner = untag_ptr(o);
32323         o_conv.is_owned = ptr_is_owned(o);
32324         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32325         o_conv = InvoiceError_clone(&o_conv);
32326         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
32327         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
32328         return tag_ptr(ret_conv, true);
32329 }
32330
32331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32332         void* e_ptr = untag_ptr(e);
32333         CHECK_ACCESS(e_ptr);
32334         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32335         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32336         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
32337         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
32338         return tag_ptr(ret_conv, true);
32339 }
32340
32341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32342         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
32343         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
32344         return ret_conv;
32345 }
32346
32347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32348         if (!ptr_is_owned(_res)) return;
32349         void* _res_ptr = untag_ptr(_res);
32350         CHECK_ACCESS(_res_ptr);
32351         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
32352         FREE(untag_ptr(_res));
32353         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
32354 }
32355
32356 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
32357         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
32358         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
32359         return tag_ptr(ret_conv, true);
32360 }
32361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32362         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
32363         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
32364         return ret_conv;
32365 }
32366
32367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32368         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
32369         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
32370         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
32371         return tag_ptr(ret_conv, true);
32372 }
32373
32374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32375         void* o_ptr = untag_ptr(o);
32376         CHECK_ACCESS(o_ptr);
32377         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
32378         if (o_conv.free == LDKFilter_JCalls_free) {
32379                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32380                 LDKFilter_JCalls_cloned(&o_conv);
32381         }
32382         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
32383         *ret_copy = COption_FilterZ_some(o_conv);
32384         int64_t ret_ref = tag_ptr(ret_copy, true);
32385         return ret_ref;
32386 }
32387
32388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
32389         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
32390         *ret_copy = COption_FilterZ_none();
32391         int64_t ret_ref = tag_ptr(ret_copy, true);
32392         return ret_ref;
32393 }
32394
32395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32396         if (!ptr_is_owned(_res)) return;
32397         void* _res_ptr = untag_ptr(_res);
32398         CHECK_ACCESS(_res_ptr);
32399         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
32400         FREE(untag_ptr(_res));
32401         COption_FilterZ_free(_res_conv);
32402 }
32403
32404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32405         LDKLockedChannelMonitor o_conv;
32406         o_conv.inner = untag_ptr(o);
32407         o_conv.is_owned = ptr_is_owned(o);
32408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32409         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
32410         
32411         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
32412         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
32413         return tag_ptr(ret_conv, true);
32414 }
32415
32416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
32417         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
32418         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
32419         return tag_ptr(ret_conv, true);
32420 }
32421
32422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32423         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
32424         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
32425         return ret_conv;
32426 }
32427
32428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32429         if (!ptr_is_owned(_res)) return;
32430         void* _res_ptr = untag_ptr(_res);
32431         CHECK_ACCESS(_res_ptr);
32432         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
32433         FREE(untag_ptr(_res));
32434         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
32435 }
32436
32437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32438         LDKCVec_OutPointZ _res_constr;
32439         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32440         if (_res_constr.datalen > 0)
32441                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
32442         else
32443                 _res_constr.data = NULL;
32444         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32445         for (size_t k = 0; k < _res_constr.datalen; k++) {
32446                 int64_t _res_conv_10 = _res_vals[k];
32447                 LDKOutPoint _res_conv_10_conv;
32448                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
32449                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
32450                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
32451                 _res_constr.data[k] = _res_conv_10_conv;
32452         }
32453         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32454         CVec_OutPointZ_free(_res_constr);
32455 }
32456
32457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32458         LDKCVec_MonitorUpdateIdZ _res_constr;
32459         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32460         if (_res_constr.datalen > 0)
32461                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
32462         else
32463                 _res_constr.data = NULL;
32464         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32465         for (size_t r = 0; r < _res_constr.datalen; r++) {
32466                 int64_t _res_conv_17 = _res_vals[r];
32467                 LDKMonitorUpdateId _res_conv_17_conv;
32468                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
32469                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
32470                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
32471                 _res_constr.data[r] = _res_conv_17_conv;
32472         }
32473         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32474         CVec_MonitorUpdateIdZ_free(_res_constr);
32475 }
32476
32477 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
32478         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
32479         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
32480         return tag_ptr(ret_conv, true);
32481 }
32482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32483         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
32484         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
32485         return ret_conv;
32486 }
32487
32488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32489         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
32490         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
32491         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
32492         return tag_ptr(ret_conv, true);
32493 }
32494
32495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
32496         LDKOutPoint a_conv;
32497         a_conv.inner = untag_ptr(a);
32498         a_conv.is_owned = ptr_is_owned(a);
32499         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32500         a_conv = OutPoint_clone(&a_conv);
32501         LDKCVec_MonitorUpdateIdZ b_constr;
32502         b_constr.datalen = (*env)->GetArrayLength(env, b);
32503         if (b_constr.datalen > 0)
32504                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
32505         else
32506                 b_constr.data = NULL;
32507         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
32508         for (size_t r = 0; r < b_constr.datalen; r++) {
32509                 int64_t b_conv_17 = b_vals[r];
32510                 LDKMonitorUpdateId b_conv_17_conv;
32511                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
32512                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
32513                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
32514                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
32515                 b_constr.data[r] = b_conv_17_conv;
32516         }
32517         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
32518         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
32519         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
32520         return tag_ptr(ret_conv, true);
32521 }
32522
32523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32524         if (!ptr_is_owned(_res)) return;
32525         void* _res_ptr = untag_ptr(_res);
32526         CHECK_ACCESS(_res_ptr);
32527         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
32528         FREE(untag_ptr(_res));
32529         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
32530 }
32531
32532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32533         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
32534         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32535         if (_res_constr.datalen > 0)
32536                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
32537         else
32538                 _res_constr.data = NULL;
32539         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32540         for (size_t p = 0; p < _res_constr.datalen; p++) {
32541                 int64_t _res_conv_41 = _res_vals[p];
32542                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
32543                 CHECK_ACCESS(_res_conv_41_ptr);
32544                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
32545                 FREE(untag_ptr(_res_conv_41));
32546                 _res_constr.data[p] = _res_conv_41_conv;
32547         }
32548         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32549         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
32550 }
32551
32552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32553         if (!ptr_is_owned(this_ptr)) return;
32554         void* this_ptr_ptr = untag_ptr(this_ptr);
32555         CHECK_ACCESS(this_ptr_ptr);
32556         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
32557         FREE(untag_ptr(this_ptr));
32558         APIError_free(this_ptr_conv);
32559 }
32560
32561 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
32562         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32563         *ret_copy = APIError_clone(arg);
32564         int64_t ret_ref = tag_ptr(ret_copy, true);
32565         return ret_ref;
32566 }
32567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32568         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
32569         int64_t ret_conv = APIError_clone_ptr(arg_conv);
32570         return ret_conv;
32571 }
32572
32573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32574         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
32575         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32576         *ret_copy = APIError_clone(orig_conv);
32577         int64_t ret_ref = tag_ptr(ret_copy, true);
32578         return ret_ref;
32579 }
32580
32581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
32582         LDKStr err_conv = java_to_owned_str(env, err);
32583         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32584         *ret_copy = APIError_apimisuse_error(err_conv);
32585         int64_t ret_ref = tag_ptr(ret_copy, true);
32586         return ret_ref;
32587 }
32588
32589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
32590         LDKStr err_conv = java_to_owned_str(env, err);
32591         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32592         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
32593         int64_t ret_ref = tag_ptr(ret_copy, true);
32594         return ret_ref;
32595 }
32596
32597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
32598         LDKStr err_conv = java_to_owned_str(env, err);
32599         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32600         *ret_copy = APIError_invalid_route(err_conv);
32601         int64_t ret_ref = tag_ptr(ret_copy, true);
32602         return ret_ref;
32603 }
32604
32605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
32606         LDKStr err_conv = java_to_owned_str(env, err);
32607         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32608         *ret_copy = APIError_channel_unavailable(err_conv);
32609         int64_t ret_ref = tag_ptr(ret_copy, true);
32610         return ret_ref;
32611 }
32612
32613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
32614         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32615         *ret_copy = APIError_monitor_update_in_progress();
32616         int64_t ret_ref = tag_ptr(ret_copy, true);
32617         return ret_ref;
32618 }
32619
32620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
32621         LDKShutdownScript script_conv;
32622         script_conv.inner = untag_ptr(script);
32623         script_conv.is_owned = ptr_is_owned(script);
32624         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
32625         script_conv = ShutdownScript_clone(&script_conv);
32626         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32627         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
32628         int64_t ret_ref = tag_ptr(ret_copy, true);
32629         return ret_ref;
32630 }
32631
32632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32633         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
32634         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
32635         jboolean ret_conv = APIError_eq(a_conv, b_conv);
32636         return ret_conv;
32637 }
32638
32639 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
32640         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
32641         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
32642         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32643         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32644         CVec_u8Z_free(ret_var);
32645         return ret_arr;
32646 }
32647
32648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32649         LDKu8slice ser_ref;
32650         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32651         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32652         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
32653         *ret_conv = APIError_read(ser_ref);
32654         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32655         return tag_ptr(ret_conv, true);
32656 }
32657
32658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32659         LDKBigSize this_obj_conv;
32660         this_obj_conv.inner = untag_ptr(this_obj);
32661         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32663         BigSize_free(this_obj_conv);
32664 }
32665
32666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
32667         LDKBigSize this_ptr_conv;
32668         this_ptr_conv.inner = untag_ptr(this_ptr);
32669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32671         this_ptr_conv.is_owned = false;
32672         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
32673         return ret_conv;
32674 }
32675
32676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32677         LDKBigSize this_ptr_conv;
32678         this_ptr_conv.inner = untag_ptr(this_ptr);
32679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32681         this_ptr_conv.is_owned = false;
32682         BigSize_set_a(&this_ptr_conv, val);
32683 }
32684
32685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
32686         LDKBigSize ret_var = BigSize_new(a_arg);
32687         int64_t ret_ref = 0;
32688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32690         return ret_ref;
32691 }
32692
32693 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
32694         LDKBigSize ret_var = BigSize_clone(arg);
32695         int64_t ret_ref = 0;
32696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32698         return ret_ref;
32699 }
32700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32701         LDKBigSize arg_conv;
32702         arg_conv.inner = untag_ptr(arg);
32703         arg_conv.is_owned = ptr_is_owned(arg);
32704         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32705         arg_conv.is_owned = false;
32706         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
32707         return ret_conv;
32708 }
32709
32710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32711         LDKBigSize orig_conv;
32712         orig_conv.inner = untag_ptr(orig);
32713         orig_conv.is_owned = ptr_is_owned(orig);
32714         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32715         orig_conv.is_owned = false;
32716         LDKBigSize ret_var = BigSize_clone(&orig_conv);
32717         int64_t ret_ref = 0;
32718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32720         return ret_ref;
32721 }
32722
32723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
32724         LDKBigSize o_conv;
32725         o_conv.inner = untag_ptr(o);
32726         o_conv.is_owned = ptr_is_owned(o);
32727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32728         o_conv.is_owned = false;
32729         int64_t ret_conv = BigSize_hash(&o_conv);
32730         return ret_conv;
32731 }
32732
32733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32734         LDKBigSize a_conv;
32735         a_conv.inner = untag_ptr(a);
32736         a_conv.is_owned = ptr_is_owned(a);
32737         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32738         a_conv.is_owned = false;
32739         LDKBigSize b_conv;
32740         b_conv.inner = untag_ptr(b);
32741         b_conv.is_owned = ptr_is_owned(b);
32742         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32743         b_conv.is_owned = false;
32744         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
32745         return ret_conv;
32746 }
32747
32748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
32749         LDKBigSize obj_conv;
32750         obj_conv.inner = untag_ptr(obj);
32751         obj_conv.is_owned = ptr_is_owned(obj);
32752         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32753         obj_conv.is_owned = false;
32754         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
32755         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32756         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32757         CVec_u8Z_free(ret_var);
32758         return ret_arr;
32759 }
32760
32761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32762         LDKu8slice ser_ref;
32763         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32764         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32765         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32766         *ret_conv = BigSize_read(ser_ref);
32767         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32768         return tag_ptr(ret_conv, true);
32769 }
32770
32771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32772         LDKHostname this_obj_conv;
32773         this_obj_conv.inner = untag_ptr(this_obj);
32774         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32776         Hostname_free(this_obj_conv);
32777 }
32778
32779 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
32780         LDKHostname ret_var = Hostname_clone(arg);
32781         int64_t ret_ref = 0;
32782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32784         return ret_ref;
32785 }
32786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32787         LDKHostname arg_conv;
32788         arg_conv.inner = untag_ptr(arg);
32789         arg_conv.is_owned = ptr_is_owned(arg);
32790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32791         arg_conv.is_owned = false;
32792         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
32793         return ret_conv;
32794 }
32795
32796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32797         LDKHostname orig_conv;
32798         orig_conv.inner = untag_ptr(orig);
32799         orig_conv.is_owned = ptr_is_owned(orig);
32800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32801         orig_conv.is_owned = false;
32802         LDKHostname ret_var = Hostname_clone(&orig_conv);
32803         int64_t ret_ref = 0;
32804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32806         return ret_ref;
32807 }
32808
32809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32810         LDKHostname a_conv;
32811         a_conv.inner = untag_ptr(a);
32812         a_conv.is_owned = ptr_is_owned(a);
32813         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32814         a_conv.is_owned = false;
32815         LDKHostname b_conv;
32816         b_conv.inner = untag_ptr(b);
32817         b_conv.is_owned = ptr_is_owned(b);
32818         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32819         b_conv.is_owned = false;
32820         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
32821         return ret_conv;
32822 }
32823
32824 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
32825         LDKHostname this_arg_conv;
32826         this_arg_conv.inner = untag_ptr(this_arg);
32827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32829         this_arg_conv.is_owned = false;
32830         int8_t ret_conv = Hostname_len(&this_arg_conv);
32831         return ret_conv;
32832 }
32833
32834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
32835         LDKHostname obj_conv;
32836         obj_conv.inner = untag_ptr(obj);
32837         obj_conv.is_owned = ptr_is_owned(obj);
32838         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32839         obj_conv.is_owned = false;
32840         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
32841         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32842         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32843         CVec_u8Z_free(ret_var);
32844         return ret_arr;
32845 }
32846
32847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32848         LDKu8slice ser_ref;
32849         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32850         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32851         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32852         *ret_conv = Hostname_read(ser_ref);
32853         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32854         return tag_ptr(ret_conv, true);
32855 }
32856
32857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32858         LDKTransactionU16LenLimited this_obj_conv;
32859         this_obj_conv.inner = untag_ptr(this_obj);
32860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32862         TransactionU16LenLimited_free(this_obj_conv);
32863 }
32864
32865 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
32866         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
32867         int64_t ret_ref = 0;
32868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32870         return ret_ref;
32871 }
32872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32873         LDKTransactionU16LenLimited arg_conv;
32874         arg_conv.inner = untag_ptr(arg);
32875         arg_conv.is_owned = ptr_is_owned(arg);
32876         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32877         arg_conv.is_owned = false;
32878         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
32879         return ret_conv;
32880 }
32881
32882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32883         LDKTransactionU16LenLimited orig_conv;
32884         orig_conv.inner = untag_ptr(orig);
32885         orig_conv.is_owned = ptr_is_owned(orig);
32886         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32887         orig_conv.is_owned = false;
32888         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
32889         int64_t ret_ref = 0;
32890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32892         return ret_ref;
32893 }
32894
32895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32896         LDKTransactionU16LenLimited a_conv;
32897         a_conv.inner = untag_ptr(a);
32898         a_conv.is_owned = ptr_is_owned(a);
32899         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32900         a_conv.is_owned = false;
32901         LDKTransactionU16LenLimited b_conv;
32902         b_conv.inner = untag_ptr(b);
32903         b_conv.is_owned = ptr_is_owned(b);
32904         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32905         b_conv.is_owned = false;
32906         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
32907         return ret_conv;
32908 }
32909
32910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
32911         LDKTransaction transaction_ref;
32912         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
32913         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
32914         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
32915         transaction_ref.data_is_owned = true;
32916         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32917         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
32918         return tag_ptr(ret_conv, true);
32919 }
32920
32921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
32922         LDKTransactionU16LenLimited this_arg_conv;
32923         this_arg_conv.inner = untag_ptr(this_arg);
32924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32926         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
32927         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
32928         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32929         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32930         Transaction_free(ret_var);
32931         return ret_arr;
32932 }
32933
32934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
32935         LDKTransactionU16LenLimited obj_conv;
32936         obj_conv.inner = untag_ptr(obj);
32937         obj_conv.is_owned = ptr_is_owned(obj);
32938         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32939         obj_conv.is_owned = false;
32940         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
32941         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32942         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32943         CVec_u8Z_free(ret_var);
32944         return ret_arr;
32945 }
32946
32947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32948         LDKu8slice ser_ref;
32949         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32950         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32951         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32952         *ret_conv = TransactionU16LenLimited_read(ser_ref);
32953         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32954         return tag_ptr(ret_conv, true);
32955 }
32956
32957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
32958         LDKu8slice msg_ref;
32959         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
32960         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
32961         uint8_t sk_arr[32];
32962         CHECK((*env)->GetArrayLength(env, sk) == 32);
32963         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
32964         uint8_t (*sk_ref)[32] = &sk_arr;
32965         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
32966         *ret_conv = sign(msg_ref, sk_ref);
32967         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
32968         return tag_ptr(ret_conv, true);
32969 }
32970
32971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
32972         LDKu8slice msg_ref;
32973         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
32974         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
32975         LDKStr sig_conv = java_to_owned_str(env, sig);
32976         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
32977         *ret_conv = recover_pk(msg_ref, sig_conv);
32978         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
32979         return tag_ptr(ret_conv, true);
32980 }
32981
32982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
32983         LDKu8slice msg_ref;
32984         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
32985         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
32986         LDKStr sig_conv = java_to_owned_str(env, sig);
32987         LDKPublicKey pk_ref;
32988         CHECK((*env)->GetArrayLength(env, pk) == 33);
32989         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
32990         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
32991         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
32992         return ret_conv;
32993 }
32994
32995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
32996         LDKu8slice hrp_bytes_ref;
32997         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
32998         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
32999         LDKCVec_U5Z data_without_signature_constr;
33000         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
33001         if (data_without_signature_constr.datalen > 0)
33002                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
33003         else
33004                 data_without_signature_constr.data = NULL;
33005         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
33006         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
33007                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
33008                 
33009                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
33010         }
33011         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
33012         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
33013         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33014         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33015         CVec_u8Z_free(ret_var);
33016         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
33017         return ret_arr;
33018 }
33019
33020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33021         if (!ptr_is_owned(this_ptr)) return;
33022         void* this_ptr_ptr = untag_ptr(this_ptr);
33023         CHECK_ACCESS(this_ptr_ptr);
33024         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
33025         FREE(untag_ptr(this_ptr));
33026         Persister_free(this_ptr_conv);
33027 }
33028
33029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33030         LDKUntrustedString this_obj_conv;
33031         this_obj_conv.inner = untag_ptr(this_obj);
33032         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33034         UntrustedString_free(this_obj_conv);
33035 }
33036
33037 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
33038         LDKUntrustedString this_ptr_conv;
33039         this_ptr_conv.inner = untag_ptr(this_ptr);
33040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33042         this_ptr_conv.is_owned = false;
33043         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
33044         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33045         Str_free(ret_str);
33046         return ret_conv;
33047 }
33048
33049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33050         LDKUntrustedString this_ptr_conv;
33051         this_ptr_conv.inner = untag_ptr(this_ptr);
33052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33054         this_ptr_conv.is_owned = false;
33055         LDKStr val_conv = java_to_owned_str(env, val);
33056         UntrustedString_set_a(&this_ptr_conv, val_conv);
33057 }
33058
33059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
33060         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
33061         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
33062         int64_t ret_ref = 0;
33063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33065         return ret_ref;
33066 }
33067
33068 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
33069         LDKUntrustedString ret_var = UntrustedString_clone(arg);
33070         int64_t ret_ref = 0;
33071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33073         return ret_ref;
33074 }
33075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33076         LDKUntrustedString arg_conv;
33077         arg_conv.inner = untag_ptr(arg);
33078         arg_conv.is_owned = ptr_is_owned(arg);
33079         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33080         arg_conv.is_owned = false;
33081         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
33082         return ret_conv;
33083 }
33084
33085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33086         LDKUntrustedString orig_conv;
33087         orig_conv.inner = untag_ptr(orig);
33088         orig_conv.is_owned = ptr_is_owned(orig);
33089         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33090         orig_conv.is_owned = false;
33091         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
33092         int64_t ret_ref = 0;
33093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33095         return ret_ref;
33096 }
33097
33098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
33099         LDKUntrustedString a_conv;
33100         a_conv.inner = untag_ptr(a);
33101         a_conv.is_owned = ptr_is_owned(a);
33102         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33103         a_conv.is_owned = false;
33104         LDKUntrustedString b_conv;
33105         b_conv.inner = untag_ptr(b);
33106         b_conv.is_owned = ptr_is_owned(b);
33107         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33108         b_conv.is_owned = false;
33109         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
33110         return ret_conv;
33111 }
33112
33113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
33114         LDKUntrustedString obj_conv;
33115         obj_conv.inner = untag_ptr(obj);
33116         obj_conv.is_owned = ptr_is_owned(obj);
33117         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33118         obj_conv.is_owned = false;
33119         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
33120         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33121         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33122         CVec_u8Z_free(ret_var);
33123         return ret_arr;
33124 }
33125
33126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33127         LDKu8slice ser_ref;
33128         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33129         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33130         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33131         *ret_conv = UntrustedString_read(ser_ref);
33132         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33133         return tag_ptr(ret_conv, true);
33134 }
33135
33136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33137         LDKPrintableString this_obj_conv;
33138         this_obj_conv.inner = untag_ptr(this_obj);
33139         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33141         PrintableString_free(this_obj_conv);
33142 }
33143
33144 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
33145         LDKPrintableString this_ptr_conv;
33146         this_ptr_conv.inner = untag_ptr(this_ptr);
33147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33149         this_ptr_conv.is_owned = false;
33150         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
33151         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33152         Str_free(ret_str);
33153         return ret_conv;
33154 }
33155
33156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33157         LDKPrintableString this_ptr_conv;
33158         this_ptr_conv.inner = untag_ptr(this_ptr);
33159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33161         this_ptr_conv.is_owned = false;
33162         LDKStr val_conv = java_to_owned_str(env, val);
33163         PrintableString_set_a(&this_ptr_conv, val_conv);
33164 }
33165
33166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
33167         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
33168         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
33169         int64_t ret_ref = 0;
33170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33172         return ret_ref;
33173 }
33174
33175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33176         if (!ptr_is_owned(this_ptr)) return;
33177         void* this_ptr_ptr = untag_ptr(this_ptr);
33178         CHECK_ACCESS(this_ptr_ptr);
33179         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
33180         FREE(untag_ptr(this_ptr));
33181         FutureCallback_free(this_ptr_conv);
33182 }
33183
33184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33185         LDKFuture this_obj_conv;
33186         this_obj_conv.inner = untag_ptr(this_obj);
33187         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33189         Future_free(this_obj_conv);
33190 }
33191
33192 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
33193         LDKFuture ret_var = Future_clone(arg);
33194         int64_t ret_ref = 0;
33195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33197         return ret_ref;
33198 }
33199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33200         LDKFuture arg_conv;
33201         arg_conv.inner = untag_ptr(arg);
33202         arg_conv.is_owned = ptr_is_owned(arg);
33203         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33204         arg_conv.is_owned = false;
33205         int64_t ret_conv = Future_clone_ptr(&arg_conv);
33206         return ret_conv;
33207 }
33208
33209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33210         LDKFuture orig_conv;
33211         orig_conv.inner = untag_ptr(orig);
33212         orig_conv.is_owned = ptr_is_owned(orig);
33213         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33214         orig_conv.is_owned = false;
33215         LDKFuture ret_var = Future_clone(&orig_conv);
33216         int64_t ret_ref = 0;
33217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33219         return ret_ref;
33220 }
33221
33222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
33223         LDKFuture this_arg_conv;
33224         this_arg_conv.inner = untag_ptr(this_arg);
33225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33227         this_arg_conv.is_owned = false;
33228         void* callback_ptr = untag_ptr(callback);
33229         CHECK_ACCESS(callback_ptr);
33230         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
33231         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
33232                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33233                 LDKFutureCallback_JCalls_cloned(&callback_conv);
33234         }
33235         Future_register_callback_fn(&this_arg_conv, callback_conv);
33236 }
33237
33238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
33239         LDKFuture this_arg_conv;
33240         this_arg_conv.inner = untag_ptr(this_arg);
33241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33243         this_arg_conv = Future_clone(&this_arg_conv);
33244         Future_wait(this_arg_conv);
33245 }
33246
33247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
33248         LDKFuture this_arg_conv;
33249         this_arg_conv.inner = untag_ptr(this_arg);
33250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33252         this_arg_conv = Future_clone(&this_arg_conv);
33253         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
33254         return ret_conv;
33255 }
33256
33257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33258         LDKSleeper this_obj_conv;
33259         this_obj_conv.inner = untag_ptr(this_obj);
33260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33262         Sleeper_free(this_obj_conv);
33263 }
33264
33265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
33266         LDKFuture future_conv;
33267         future_conv.inner = untag_ptr(future);
33268         future_conv.is_owned = ptr_is_owned(future);
33269         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
33270         future_conv = Future_clone(&future_conv);
33271         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
33272         int64_t ret_ref = 0;
33273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33275         return ret_ref;
33276 }
33277
33278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1two_1futures(JNIEnv *env, jclass clz, int64_t fut_a, int64_t fut_b) {
33279         LDKFuture fut_a_conv;
33280         fut_a_conv.inner = untag_ptr(fut_a);
33281         fut_a_conv.is_owned = ptr_is_owned(fut_a);
33282         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
33283         fut_a_conv = Future_clone(&fut_a_conv);
33284         LDKFuture fut_b_conv;
33285         fut_b_conv.inner = untag_ptr(fut_b);
33286         fut_b_conv.is_owned = ptr_is_owned(fut_b);
33287         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
33288         fut_b_conv = Future_clone(&fut_b_conv);
33289         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
33290         int64_t ret_ref = 0;
33291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33293         return ret_ref;
33294 }
33295
33296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
33297         LDKCVec_FutureZ futures_constr;
33298         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
33299         if (futures_constr.datalen > 0)
33300                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
33301         else
33302                 futures_constr.data = NULL;
33303         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
33304         for (size_t i = 0; i < futures_constr.datalen; i++) {
33305                 int64_t futures_conv_8 = futures_vals[i];
33306                 LDKFuture futures_conv_8_conv;
33307                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
33308                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
33309                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
33310                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
33311                 futures_constr.data[i] = futures_conv_8_conv;
33312         }
33313         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
33314         LDKSleeper ret_var = Sleeper_new(futures_constr);
33315         int64_t ret_ref = 0;
33316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33318         return ret_ref;
33319 }
33320
33321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
33322         LDKSleeper this_arg_conv;
33323         this_arg_conv.inner = untag_ptr(this_arg);
33324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33326         this_arg_conv.is_owned = false;
33327         Sleeper_wait(&this_arg_conv);
33328 }
33329
33330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
33331         LDKSleeper this_arg_conv;
33332         this_arg_conv.inner = untag_ptr(this_arg);
33333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33335         this_arg_conv.is_owned = false;
33336         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
33337         return ret_conv;
33338 }
33339
33340 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33341         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
33342         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
33343         return ret_conv;
33344 }
33345
33346 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
33347         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
33348         return ret_conv;
33349 }
33350
33351 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
33352         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
33353         return ret_conv;
33354 }
33355
33356 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
33357         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
33358         return ret_conv;
33359 }
33360
33361 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
33362         jclass ret_conv = LDKLevel_to_java(env, Level_info());
33363         return ret_conv;
33364 }
33365
33366 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
33367         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
33368         return ret_conv;
33369 }
33370
33371 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
33372         jclass ret_conv = LDKLevel_to_java(env, Level_error());
33373         return ret_conv;
33374 }
33375
33376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
33377         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
33378         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
33379         jboolean ret_conv = Level_eq(a_conv, b_conv);
33380         return ret_conv;
33381 }
33382
33383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
33384         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
33385         int64_t ret_conv = Level_hash(o_conv);
33386         return ret_conv;
33387 }
33388
33389 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
33390         jclass ret_conv = LDKLevel_to_java(env, Level_max());
33391         return ret_conv;
33392 }
33393
33394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33395         LDKRecord this_obj_conv;
33396         this_obj_conv.inner = untag_ptr(this_obj);
33397         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33399         Record_free(this_obj_conv);
33400 }
33401
33402 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
33403         LDKRecord this_ptr_conv;
33404         this_ptr_conv.inner = untag_ptr(this_ptr);
33405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33407         this_ptr_conv.is_owned = false;
33408         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
33409         return ret_conv;
33410 }
33411
33412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
33413         LDKRecord this_ptr_conv;
33414         this_ptr_conv.inner = untag_ptr(this_ptr);
33415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33417         this_ptr_conv.is_owned = false;
33418         LDKLevel val_conv = LDKLevel_from_java(env, val);
33419         Record_set_level(&this_ptr_conv, val_conv);
33420 }
33421
33422 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
33423         LDKRecord this_ptr_conv;
33424         this_ptr_conv.inner = untag_ptr(this_ptr);
33425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33427         this_ptr_conv.is_owned = false;
33428         LDKStr ret_str = Record_get_args(&this_ptr_conv);
33429         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33430         Str_free(ret_str);
33431         return ret_conv;
33432 }
33433
33434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33435         LDKRecord this_ptr_conv;
33436         this_ptr_conv.inner = untag_ptr(this_ptr);
33437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33439         this_ptr_conv.is_owned = false;
33440         LDKStr val_conv = java_to_owned_str(env, val);
33441         Record_set_args(&this_ptr_conv, val_conv);
33442 }
33443
33444 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
33445         LDKRecord this_ptr_conv;
33446         this_ptr_conv.inner = untag_ptr(this_ptr);
33447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33449         this_ptr_conv.is_owned = false;
33450         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
33451         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33452         Str_free(ret_str);
33453         return ret_conv;
33454 }
33455
33456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33457         LDKRecord this_ptr_conv;
33458         this_ptr_conv.inner = untag_ptr(this_ptr);
33459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33461         this_ptr_conv.is_owned = false;
33462         LDKStr val_conv = java_to_owned_str(env, val);
33463         Record_set_module_path(&this_ptr_conv, val_conv);
33464 }
33465
33466 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
33467         LDKRecord this_ptr_conv;
33468         this_ptr_conv.inner = untag_ptr(this_ptr);
33469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33471         this_ptr_conv.is_owned = false;
33472         LDKStr ret_str = Record_get_file(&this_ptr_conv);
33473         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33474         Str_free(ret_str);
33475         return ret_conv;
33476 }
33477
33478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33479         LDKRecord this_ptr_conv;
33480         this_ptr_conv.inner = untag_ptr(this_ptr);
33481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33483         this_ptr_conv.is_owned = false;
33484         LDKStr val_conv = java_to_owned_str(env, val);
33485         Record_set_file(&this_ptr_conv, val_conv);
33486 }
33487
33488 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
33489         LDKRecord this_ptr_conv;
33490         this_ptr_conv.inner = untag_ptr(this_ptr);
33491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33493         this_ptr_conv.is_owned = false;
33494         int32_t ret_conv = Record_get_line(&this_ptr_conv);
33495         return ret_conv;
33496 }
33497
33498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33499         LDKRecord this_ptr_conv;
33500         this_ptr_conv.inner = untag_ptr(this_ptr);
33501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33503         this_ptr_conv.is_owned = false;
33504         Record_set_line(&this_ptr_conv, val);
33505 }
33506
33507 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
33508         LDKRecord ret_var = Record_clone(arg);
33509         int64_t ret_ref = 0;
33510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33512         return ret_ref;
33513 }
33514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33515         LDKRecord arg_conv;
33516         arg_conv.inner = untag_ptr(arg);
33517         arg_conv.is_owned = ptr_is_owned(arg);
33518         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33519         arg_conv.is_owned = false;
33520         int64_t ret_conv = Record_clone_ptr(&arg_conv);
33521         return ret_conv;
33522 }
33523
33524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33525         LDKRecord orig_conv;
33526         orig_conv.inner = untag_ptr(orig);
33527         orig_conv.is_owned = ptr_is_owned(orig);
33528         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33529         orig_conv.is_owned = false;
33530         LDKRecord ret_var = Record_clone(&orig_conv);
33531         int64_t ret_ref = 0;
33532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33534         return ret_ref;
33535 }
33536
33537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33538         if (!ptr_is_owned(this_ptr)) return;
33539         void* this_ptr_ptr = untag_ptr(this_ptr);
33540         CHECK_ACCESS(this_ptr_ptr);
33541         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
33542         FREE(untag_ptr(this_ptr));
33543         Logger_free(this_ptr_conv);
33544 }
33545
33546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33547         LDKChannelHandshakeConfig this_obj_conv;
33548         this_obj_conv.inner = untag_ptr(this_obj);
33549         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33551         ChannelHandshakeConfig_free(this_obj_conv);
33552 }
33553
33554 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
33555         LDKChannelHandshakeConfig this_ptr_conv;
33556         this_ptr_conv.inner = untag_ptr(this_ptr);
33557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33559         this_ptr_conv.is_owned = false;
33560         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
33561         return ret_conv;
33562 }
33563
33564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33565         LDKChannelHandshakeConfig this_ptr_conv;
33566         this_ptr_conv.inner = untag_ptr(this_ptr);
33567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33569         this_ptr_conv.is_owned = false;
33570         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
33571 }
33572
33573 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
33574         LDKChannelHandshakeConfig this_ptr_conv;
33575         this_ptr_conv.inner = untag_ptr(this_ptr);
33576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33578         this_ptr_conv.is_owned = false;
33579         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
33580         return ret_conv;
33581 }
33582
33583 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) {
33584         LDKChannelHandshakeConfig this_ptr_conv;
33585         this_ptr_conv.inner = untag_ptr(this_ptr);
33586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33588         this_ptr_conv.is_owned = false;
33589         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
33590 }
33591
33592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33593         LDKChannelHandshakeConfig this_ptr_conv;
33594         this_ptr_conv.inner = untag_ptr(this_ptr);
33595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33597         this_ptr_conv.is_owned = false;
33598         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
33599         return ret_conv;
33600 }
33601
33602 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) {
33603         LDKChannelHandshakeConfig this_ptr_conv;
33604         this_ptr_conv.inner = untag_ptr(this_ptr);
33605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33607         this_ptr_conv.is_owned = false;
33608         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
33609 }
33610
33611 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1max_1inbound_1htlc_1value_1in_1flight_1percent_1of_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
33612         LDKChannelHandshakeConfig this_ptr_conv;
33613         this_ptr_conv.inner = untag_ptr(this_ptr);
33614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33616         this_ptr_conv.is_owned = false;
33617         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
33618         return ret_conv;
33619 }
33620
33621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1max_1inbound_1htlc_1value_1in_1flight_1percent_1of_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
33622         LDKChannelHandshakeConfig this_ptr_conv;
33623         this_ptr_conv.inner = untag_ptr(this_ptr);
33624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33626         this_ptr_conv.is_owned = false;
33627         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
33628 }
33629
33630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
33631         LDKChannelHandshakeConfig this_ptr_conv;
33632         this_ptr_conv.inner = untag_ptr(this_ptr);
33633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33635         this_ptr_conv.is_owned = false;
33636         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
33637         return ret_conv;
33638 }
33639
33640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33641         LDKChannelHandshakeConfig this_ptr_conv;
33642         this_ptr_conv.inner = untag_ptr(this_ptr);
33643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33645         this_ptr_conv.is_owned = false;
33646         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
33647 }
33648
33649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
33650         LDKChannelHandshakeConfig this_ptr_conv;
33651         this_ptr_conv.inner = untag_ptr(this_ptr);
33652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33654         this_ptr_conv.is_owned = false;
33655         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
33656         return ret_conv;
33657 }
33658
33659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33660         LDKChannelHandshakeConfig this_ptr_conv;
33661         this_ptr_conv.inner = untag_ptr(this_ptr);
33662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33664         this_ptr_conv.is_owned = false;
33665         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
33666 }
33667
33668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
33669         LDKChannelHandshakeConfig this_ptr_conv;
33670         this_ptr_conv.inner = untag_ptr(this_ptr);
33671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33673         this_ptr_conv.is_owned = false;
33674         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
33675         return ret_conv;
33676 }
33677
33678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33679         LDKChannelHandshakeConfig this_ptr_conv;
33680         this_ptr_conv.inner = untag_ptr(this_ptr);
33681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33683         this_ptr_conv.is_owned = false;
33684         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
33685 }
33686
33687 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
33688         LDKChannelHandshakeConfig this_ptr_conv;
33689         this_ptr_conv.inner = untag_ptr(this_ptr);
33690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33692         this_ptr_conv.is_owned = false;
33693         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
33694         return ret_conv;
33695 }
33696
33697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33698         LDKChannelHandshakeConfig this_ptr_conv;
33699         this_ptr_conv.inner = untag_ptr(this_ptr);
33700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33702         this_ptr_conv.is_owned = false;
33703         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
33704 }
33705
33706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
33707         LDKChannelHandshakeConfig this_ptr_conv;
33708         this_ptr_conv.inner = untag_ptr(this_ptr);
33709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33711         this_ptr_conv.is_owned = false;
33712         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
33713         return ret_conv;
33714 }
33715
33716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33717         LDKChannelHandshakeConfig this_ptr_conv;
33718         this_ptr_conv.inner = untag_ptr(this_ptr);
33719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33721         this_ptr_conv.is_owned = false;
33722         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
33723 }
33724
33725 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
33726         LDKChannelHandshakeConfig this_ptr_conv;
33727         this_ptr_conv.inner = untag_ptr(this_ptr);
33728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33730         this_ptr_conv.is_owned = false;
33731         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
33732         return ret_conv;
33733 }
33734
33735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33736         LDKChannelHandshakeConfig this_ptr_conv;
33737         this_ptr_conv.inner = untag_ptr(this_ptr);
33738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33740         this_ptr_conv.is_owned = false;
33741         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
33742 }
33743
33744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, int8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, jboolean negotiate_scid_privacy_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int32_t their_channel_reserve_proportional_millionths_arg, jboolean negotiate_anchors_zero_fee_htlc_tx_arg, int16_t our_max_accepted_htlcs_arg) {
33745         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, max_inbound_htlc_value_in_flight_percent_of_channel_arg, negotiate_scid_privacy_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, their_channel_reserve_proportional_millionths_arg, negotiate_anchors_zero_fee_htlc_tx_arg, our_max_accepted_htlcs_arg);
33746         int64_t ret_ref = 0;
33747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33749         return ret_ref;
33750 }
33751
33752 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
33753         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
33754         int64_t ret_ref = 0;
33755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33757         return ret_ref;
33758 }
33759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33760         LDKChannelHandshakeConfig arg_conv;
33761         arg_conv.inner = untag_ptr(arg);
33762         arg_conv.is_owned = ptr_is_owned(arg);
33763         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33764         arg_conv.is_owned = false;
33765         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
33766         return ret_conv;
33767 }
33768
33769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33770         LDKChannelHandshakeConfig orig_conv;
33771         orig_conv.inner = untag_ptr(orig);
33772         orig_conv.is_owned = ptr_is_owned(orig);
33773         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33774         orig_conv.is_owned = false;
33775         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
33776         int64_t ret_ref = 0;
33777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33779         return ret_ref;
33780 }
33781
33782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
33783         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
33784         int64_t ret_ref = 0;
33785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33787         return ret_ref;
33788 }
33789
33790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33791         LDKChannelHandshakeLimits this_obj_conv;
33792         this_obj_conv.inner = untag_ptr(this_obj);
33793         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33795         ChannelHandshakeLimits_free(this_obj_conv);
33796 }
33797
33798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33799         LDKChannelHandshakeLimits this_ptr_conv;
33800         this_ptr_conv.inner = untag_ptr(this_ptr);
33801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33803         this_ptr_conv.is_owned = false;
33804         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
33805         return ret_conv;
33806 }
33807
33808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33809         LDKChannelHandshakeLimits this_ptr_conv;
33810         this_ptr_conv.inner = untag_ptr(this_ptr);
33811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33813         this_ptr_conv.is_owned = false;
33814         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
33815 }
33816
33817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33818         LDKChannelHandshakeLimits this_ptr_conv;
33819         this_ptr_conv.inner = untag_ptr(this_ptr);
33820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33822         this_ptr_conv.is_owned = false;
33823         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
33824         return ret_conv;
33825 }
33826
33827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33828         LDKChannelHandshakeLimits this_ptr_conv;
33829         this_ptr_conv.inner = untag_ptr(this_ptr);
33830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33832         this_ptr_conv.is_owned = false;
33833         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
33834 }
33835
33836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33837         LDKChannelHandshakeLimits this_ptr_conv;
33838         this_ptr_conv.inner = untag_ptr(this_ptr);
33839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33841         this_ptr_conv.is_owned = false;
33842         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
33843         return ret_conv;
33844 }
33845
33846 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) {
33847         LDKChannelHandshakeLimits this_ptr_conv;
33848         this_ptr_conv.inner = untag_ptr(this_ptr);
33849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33851         this_ptr_conv.is_owned = false;
33852         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
33853 }
33854
33855 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) {
33856         LDKChannelHandshakeLimits this_ptr_conv;
33857         this_ptr_conv.inner = untag_ptr(this_ptr);
33858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33860         this_ptr_conv.is_owned = false;
33861         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
33862         return ret_conv;
33863 }
33864
33865 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) {
33866         LDKChannelHandshakeLimits this_ptr_conv;
33867         this_ptr_conv.inner = untag_ptr(this_ptr);
33868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33870         this_ptr_conv.is_owned = false;
33871         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
33872 }
33873
33874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33875         LDKChannelHandshakeLimits this_ptr_conv;
33876         this_ptr_conv.inner = untag_ptr(this_ptr);
33877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33879         this_ptr_conv.is_owned = false;
33880         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
33881         return ret_conv;
33882 }
33883
33884 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) {
33885         LDKChannelHandshakeLimits this_ptr_conv;
33886         this_ptr_conv.inner = untag_ptr(this_ptr);
33887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33889         this_ptr_conv.is_owned = false;
33890         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
33891 }
33892
33893 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
33894         LDKChannelHandshakeLimits this_ptr_conv;
33895         this_ptr_conv.inner = untag_ptr(this_ptr);
33896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33898         this_ptr_conv.is_owned = false;
33899         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
33900         return ret_conv;
33901 }
33902
33903 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) {
33904         LDKChannelHandshakeLimits this_ptr_conv;
33905         this_ptr_conv.inner = untag_ptr(this_ptr);
33906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33908         this_ptr_conv.is_owned = false;
33909         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
33910 }
33911
33912 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
33913         LDKChannelHandshakeLimits this_ptr_conv;
33914         this_ptr_conv.inner = untag_ptr(this_ptr);
33915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33917         this_ptr_conv.is_owned = false;
33918         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
33919         return ret_conv;
33920 }
33921
33922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33923         LDKChannelHandshakeLimits this_ptr_conv;
33924         this_ptr_conv.inner = untag_ptr(this_ptr);
33925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33927         this_ptr_conv.is_owned = false;
33928         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
33929 }
33930
33931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
33932         LDKChannelHandshakeLimits this_ptr_conv;
33933         this_ptr_conv.inner = untag_ptr(this_ptr);
33934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33936         this_ptr_conv.is_owned = false;
33937         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
33938         return ret_conv;
33939 }
33940
33941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33942         LDKChannelHandshakeLimits this_ptr_conv;
33943         this_ptr_conv.inner = untag_ptr(this_ptr);
33944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33946         this_ptr_conv.is_owned = false;
33947         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
33948 }
33949
33950 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
33951         LDKChannelHandshakeLimits this_ptr_conv;
33952         this_ptr_conv.inner = untag_ptr(this_ptr);
33953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33955         this_ptr_conv.is_owned = false;
33956         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
33957         return ret_conv;
33958 }
33959
33960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33961         LDKChannelHandshakeLimits this_ptr_conv;
33962         this_ptr_conv.inner = untag_ptr(this_ptr);
33963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33965         this_ptr_conv.is_owned = false;
33966         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
33967 }
33968
33969 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
33970         LDKChannelHandshakeLimits this_ptr_conv;
33971         this_ptr_conv.inner = untag_ptr(this_ptr);
33972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33974         this_ptr_conv.is_owned = false;
33975         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
33976         return ret_conv;
33977 }
33978
33979 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) {
33980         LDKChannelHandshakeLimits this_ptr_conv;
33981         this_ptr_conv.inner = untag_ptr(this_ptr);
33982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33984         this_ptr_conv.is_owned = false;
33985         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
33986 }
33987
33988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int32_t max_minimum_depth_arg, jboolean trust_own_funding_0conf_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
33989         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, max_minimum_depth_arg, trust_own_funding_0conf_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
33990         int64_t ret_ref = 0;
33991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33993         return ret_ref;
33994 }
33995
33996 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
33997         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
33998         int64_t ret_ref = 0;
33999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34001         return ret_ref;
34002 }
34003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34004         LDKChannelHandshakeLimits arg_conv;
34005         arg_conv.inner = untag_ptr(arg);
34006         arg_conv.is_owned = ptr_is_owned(arg);
34007         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34008         arg_conv.is_owned = false;
34009         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
34010         return ret_conv;
34011 }
34012
34013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34014         LDKChannelHandshakeLimits orig_conv;
34015         orig_conv.inner = untag_ptr(orig);
34016         orig_conv.is_owned = ptr_is_owned(orig);
34017         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34018         orig_conv.is_owned = false;
34019         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
34020         int64_t ret_ref = 0;
34021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34023         return ret_ref;
34024 }
34025
34026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
34027         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
34028         int64_t ret_ref = 0;
34029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34031         return ret_ref;
34032 }
34033
34034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34035         if (!ptr_is_owned(this_ptr)) return;
34036         void* this_ptr_ptr = untag_ptr(this_ptr);
34037         CHECK_ACCESS(this_ptr_ptr);
34038         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
34039         FREE(untag_ptr(this_ptr));
34040         MaxDustHTLCExposure_free(this_ptr_conv);
34041 }
34042
34043 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
34044         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34045         *ret_copy = MaxDustHTLCExposure_clone(arg);
34046         int64_t ret_ref = tag_ptr(ret_copy, true);
34047         return ret_ref;
34048 }
34049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34050         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
34051         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
34052         return ret_conv;
34053 }
34054
34055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34056         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
34057         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34058         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
34059         int64_t ret_ref = tag_ptr(ret_copy, true);
34060         return ret_ref;
34061 }
34062
34063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
34064         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34065         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
34066         int64_t ret_ref = tag_ptr(ret_copy, true);
34067         return ret_ref;
34068 }
34069
34070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
34071         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34072         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
34073         int64_t ret_ref = tag_ptr(ret_copy, true);
34074         return ret_ref;
34075 }
34076
34077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34078         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
34079         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
34080         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
34081         return ret_conv;
34082 }
34083
34084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
34085         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
34086         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
34087         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34088         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34089         CVec_u8Z_free(ret_var);
34090         return ret_arr;
34091 }
34092
34093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34094         LDKu8slice ser_ref;
34095         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34096         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34097         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
34098         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
34099         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34100         return tag_ptr(ret_conv, true);
34101 }
34102
34103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34104         LDKChannelConfig this_obj_conv;
34105         this_obj_conv.inner = untag_ptr(this_obj);
34106         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34108         ChannelConfig_free(this_obj_conv);
34109 }
34110
34111 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
34112         LDKChannelConfig this_ptr_conv;
34113         this_ptr_conv.inner = untag_ptr(this_ptr);
34114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34116         this_ptr_conv.is_owned = false;
34117         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
34118         return ret_conv;
34119 }
34120
34121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34122         LDKChannelConfig this_ptr_conv;
34123         this_ptr_conv.inner = untag_ptr(this_ptr);
34124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34126         this_ptr_conv.is_owned = false;
34127         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
34128 }
34129
34130 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34131         LDKChannelConfig this_ptr_conv;
34132         this_ptr_conv.inner = untag_ptr(this_ptr);
34133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34135         this_ptr_conv.is_owned = false;
34136         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
34137         return ret_conv;
34138 }
34139
34140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34141         LDKChannelConfig this_ptr_conv;
34142         this_ptr_conv.inner = untag_ptr(this_ptr);
34143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34145         this_ptr_conv.is_owned = false;
34146         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
34147 }
34148
34149 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
34150         LDKChannelConfig this_ptr_conv;
34151         this_ptr_conv.inner = untag_ptr(this_ptr);
34152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34154         this_ptr_conv.is_owned = false;
34155         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
34156         return ret_conv;
34157 }
34158
34159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34160         LDKChannelConfig this_ptr_conv;
34161         this_ptr_conv.inner = untag_ptr(this_ptr);
34162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34164         this_ptr_conv.is_owned = false;
34165         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
34166 }
34167
34168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
34169         LDKChannelConfig this_ptr_conv;
34170         this_ptr_conv.inner = untag_ptr(this_ptr);
34171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34173         this_ptr_conv.is_owned = false;
34174         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34175         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
34176         int64_t ret_ref = tag_ptr(ret_copy, true);
34177         return ret_ref;
34178 }
34179
34180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34181         LDKChannelConfig this_ptr_conv;
34182         this_ptr_conv.inner = untag_ptr(this_ptr);
34183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34185         this_ptr_conv.is_owned = false;
34186         void* val_ptr = untag_ptr(val);
34187         CHECK_ACCESS(val_ptr);
34188         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
34189         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
34190         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
34191 }
34192
34193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
34194         LDKChannelConfig this_ptr_conv;
34195         this_ptr_conv.inner = untag_ptr(this_ptr);
34196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34198         this_ptr_conv.is_owned = false;
34199         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
34200         return ret_conv;
34201 }
34202
34203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34204         LDKChannelConfig this_ptr_conv;
34205         this_ptr_conv.inner = untag_ptr(this_ptr);
34206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34208         this_ptr_conv.is_owned = false;
34209         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
34210 }
34211
34212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34213         LDKChannelConfig this_ptr_conv;
34214         this_ptr_conv.inner = untag_ptr(this_ptr);
34215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34217         this_ptr_conv.is_owned = false;
34218         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
34219         return ret_conv;
34220 }
34221
34222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34223         LDKChannelConfig this_ptr_conv;
34224         this_ptr_conv.inner = untag_ptr(this_ptr);
34225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34227         this_ptr_conv.is_owned = false;
34228         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
34229 }
34230
34231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_arg, int64_t force_close_avoidance_max_fee_satoshis_arg, jboolean accept_underpaying_htlcs_arg) {
34232         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
34233         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
34234         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
34235         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
34236         LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, max_dust_htlc_exposure_arg_conv, force_close_avoidance_max_fee_satoshis_arg, accept_underpaying_htlcs_arg);
34237         int64_t ret_ref = 0;
34238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34240         return ret_ref;
34241 }
34242
34243 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
34244         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
34245         int64_t ret_ref = 0;
34246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34248         return ret_ref;
34249 }
34250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34251         LDKChannelConfig arg_conv;
34252         arg_conv.inner = untag_ptr(arg);
34253         arg_conv.is_owned = ptr_is_owned(arg);
34254         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34255         arg_conv.is_owned = false;
34256         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
34257         return ret_conv;
34258 }
34259
34260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34261         LDKChannelConfig orig_conv;
34262         orig_conv.inner = untag_ptr(orig);
34263         orig_conv.is_owned = ptr_is_owned(orig);
34264         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34265         orig_conv.is_owned = false;
34266         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
34267         int64_t ret_ref = 0;
34268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34270         return ret_ref;
34271 }
34272
34273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34274         LDKChannelConfig a_conv;
34275         a_conv.inner = untag_ptr(a);
34276         a_conv.is_owned = ptr_is_owned(a);
34277         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34278         a_conv.is_owned = false;
34279         LDKChannelConfig b_conv;
34280         b_conv.inner = untag_ptr(b);
34281         b_conv.is_owned = ptr_is_owned(b);
34282         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34283         b_conv.is_owned = false;
34284         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
34285         return ret_conv;
34286 }
34287
34288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
34289         LDKChannelConfig this_arg_conv;
34290         this_arg_conv.inner = untag_ptr(this_arg);
34291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34293         this_arg_conv.is_owned = false;
34294         LDKChannelConfigUpdate update_conv;
34295         update_conv.inner = untag_ptr(update);
34296         update_conv.is_owned = ptr_is_owned(update);
34297         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
34298         update_conv.is_owned = false;
34299         ChannelConfig_apply(&this_arg_conv, &update_conv);
34300 }
34301
34302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
34303         LDKChannelConfig ret_var = ChannelConfig_default();
34304         int64_t ret_ref = 0;
34305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34307         return ret_ref;
34308 }
34309
34310 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
34311         LDKChannelConfig obj_conv;
34312         obj_conv.inner = untag_ptr(obj);
34313         obj_conv.is_owned = ptr_is_owned(obj);
34314         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34315         obj_conv.is_owned = false;
34316         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
34317         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34318         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34319         CVec_u8Z_free(ret_var);
34320         return ret_arr;
34321 }
34322
34323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34324         LDKu8slice ser_ref;
34325         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34326         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34327         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
34328         *ret_conv = ChannelConfig_read(ser_ref);
34329         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34330         return tag_ptr(ret_conv, true);
34331 }
34332
34333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34334         LDKChannelConfigUpdate this_obj_conv;
34335         this_obj_conv.inner = untag_ptr(this_obj);
34336         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34338         ChannelConfigUpdate_free(this_obj_conv);
34339 }
34340
34341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
34342         LDKChannelConfigUpdate this_ptr_conv;
34343         this_ptr_conv.inner = untag_ptr(this_ptr);
34344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34346         this_ptr_conv.is_owned = false;
34347         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34348         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
34349         int64_t ret_ref = tag_ptr(ret_copy, true);
34350         return ret_ref;
34351 }
34352
34353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34354         LDKChannelConfigUpdate this_ptr_conv;
34355         this_ptr_conv.inner = untag_ptr(this_ptr);
34356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34358         this_ptr_conv.is_owned = false;
34359         void* val_ptr = untag_ptr(val);
34360         CHECK_ACCESS(val_ptr);
34361         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34362         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34363         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
34364 }
34365
34366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34367         LDKChannelConfigUpdate this_ptr_conv;
34368         this_ptr_conv.inner = untag_ptr(this_ptr);
34369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34371         this_ptr_conv.is_owned = false;
34372         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34373         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
34374         int64_t ret_ref = tag_ptr(ret_copy, true);
34375         return ret_ref;
34376 }
34377
34378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34379         LDKChannelConfigUpdate this_ptr_conv;
34380         this_ptr_conv.inner = untag_ptr(this_ptr);
34381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34383         this_ptr_conv.is_owned = false;
34384         void* val_ptr = untag_ptr(val);
34385         CHECK_ACCESS(val_ptr);
34386         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34387         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34388         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
34389 }
34390
34391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
34392         LDKChannelConfigUpdate this_ptr_conv;
34393         this_ptr_conv.inner = untag_ptr(this_ptr);
34394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34396         this_ptr_conv.is_owned = false;
34397         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
34398         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34399         int64_t ret_ref = tag_ptr(ret_copy, true);
34400         return ret_ref;
34401 }
34402
34403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34404         LDKChannelConfigUpdate this_ptr_conv;
34405         this_ptr_conv.inner = untag_ptr(this_ptr);
34406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34408         this_ptr_conv.is_owned = false;
34409         void* val_ptr = untag_ptr(val);
34410         CHECK_ACCESS(val_ptr);
34411         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
34412         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
34413         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
34414 }
34415
34416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34417         LDKChannelConfigUpdate this_ptr_conv;
34418         this_ptr_conv.inner = untag_ptr(this_ptr);
34419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34421         this_ptr_conv.is_owned = false;
34422         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
34423         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
34424         int64_t ret_ref = tag_ptr(ret_copy, true);
34425         return ret_ref;
34426 }
34427
34428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34429         LDKChannelConfigUpdate this_ptr_conv;
34430         this_ptr_conv.inner = untag_ptr(this_ptr);
34431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34433         this_ptr_conv.is_owned = false;
34434         void* val_ptr = untag_ptr(val);
34435         CHECK_ACCESS(val_ptr);
34436         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
34437         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
34438         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
34439 }
34440
34441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
34442         LDKChannelConfigUpdate this_ptr_conv;
34443         this_ptr_conv.inner = untag_ptr(this_ptr);
34444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34446         this_ptr_conv.is_owned = false;
34447         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34448         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
34449         int64_t ret_ref = tag_ptr(ret_copy, true);
34450         return ret_ref;
34451 }
34452
34453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34454         LDKChannelConfigUpdate this_ptr_conv;
34455         this_ptr_conv.inner = untag_ptr(this_ptr);
34456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34458         this_ptr_conv.is_owned = false;
34459         void* val_ptr = untag_ptr(val);
34460         CHECK_ACCESS(val_ptr);
34461         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34462         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34463         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
34464 }
34465
34466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1new(JNIEnv *env, jclass clz, int64_t forwarding_fee_proportional_millionths_arg, int64_t forwarding_fee_base_msat_arg, int64_t cltv_expiry_delta_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
34467         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
34468         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
34469         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
34470         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
34471         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
34472         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
34473         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
34474         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
34475         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
34476         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
34477         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
34478         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
34479         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
34480         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
34481         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
34482         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
34483         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
34484         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
34485         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
34486         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
34487         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_new(forwarding_fee_proportional_millionths_arg_conv, forwarding_fee_base_msat_arg_conv, cltv_expiry_delta_arg_conv, max_dust_htlc_exposure_msat_arg_conv, force_close_avoidance_max_fee_satoshis_arg_conv);
34488         int64_t ret_ref = 0;
34489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34491         return ret_ref;
34492 }
34493
34494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
34495         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
34496         int64_t ret_ref = 0;
34497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34499         return ret_ref;
34500 }
34501
34502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34503         LDKUserConfig this_obj_conv;
34504         this_obj_conv.inner = untag_ptr(this_obj);
34505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34507         UserConfig_free(this_obj_conv);
34508 }
34509
34510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
34511         LDKUserConfig this_ptr_conv;
34512         this_ptr_conv.inner = untag_ptr(this_ptr);
34513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34515         this_ptr_conv.is_owned = false;
34516         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
34517         int64_t ret_ref = 0;
34518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34520         return ret_ref;
34521 }
34522
34523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34524         LDKUserConfig this_ptr_conv;
34525         this_ptr_conv.inner = untag_ptr(this_ptr);
34526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34528         this_ptr_conv.is_owned = false;
34529         LDKChannelHandshakeConfig val_conv;
34530         val_conv.inner = untag_ptr(val);
34531         val_conv.is_owned = ptr_is_owned(val);
34532         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34533         val_conv = ChannelHandshakeConfig_clone(&val_conv);
34534         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
34535 }
34536
34537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
34538         LDKUserConfig this_ptr_conv;
34539         this_ptr_conv.inner = untag_ptr(this_ptr);
34540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34542         this_ptr_conv.is_owned = false;
34543         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
34544         int64_t ret_ref = 0;
34545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34547         return ret_ref;
34548 }
34549
34550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34551         LDKUserConfig this_ptr_conv;
34552         this_ptr_conv.inner = untag_ptr(this_ptr);
34553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34555         this_ptr_conv.is_owned = false;
34556         LDKChannelHandshakeLimits val_conv;
34557         val_conv.inner = untag_ptr(val);
34558         val_conv.is_owned = ptr_is_owned(val);
34559         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34560         val_conv = ChannelHandshakeLimits_clone(&val_conv);
34561         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
34562 }
34563
34564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
34565         LDKUserConfig this_ptr_conv;
34566         this_ptr_conv.inner = untag_ptr(this_ptr);
34567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34569         this_ptr_conv.is_owned = false;
34570         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
34571         int64_t ret_ref = 0;
34572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34574         return ret_ref;
34575 }
34576
34577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34578         LDKUserConfig this_ptr_conv;
34579         this_ptr_conv.inner = untag_ptr(this_ptr);
34580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34582         this_ptr_conv.is_owned = false;
34583         LDKChannelConfig val_conv;
34584         val_conv.inner = untag_ptr(val);
34585         val_conv.is_owned = ptr_is_owned(val);
34586         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34587         val_conv = ChannelConfig_clone(&val_conv);
34588         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
34589 }
34590
34591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
34592         LDKUserConfig this_ptr_conv;
34593         this_ptr_conv.inner = untag_ptr(this_ptr);
34594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34596         this_ptr_conv.is_owned = false;
34597         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
34598         return ret_conv;
34599 }
34600
34601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34602         LDKUserConfig this_ptr_conv;
34603         this_ptr_conv.inner = untag_ptr(this_ptr);
34604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34606         this_ptr_conv.is_owned = false;
34607         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
34608 }
34609
34610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
34611         LDKUserConfig this_ptr_conv;
34612         this_ptr_conv.inner = untag_ptr(this_ptr);
34613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34615         this_ptr_conv.is_owned = false;
34616         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
34617         return ret_conv;
34618 }
34619
34620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34621         LDKUserConfig this_ptr_conv;
34622         this_ptr_conv.inner = untag_ptr(this_ptr);
34623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34625         this_ptr_conv.is_owned = false;
34626         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
34627 }
34628
34629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
34630         LDKUserConfig this_ptr_conv;
34631         this_ptr_conv.inner = untag_ptr(this_ptr);
34632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34634         this_ptr_conv.is_owned = false;
34635         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
34636         return ret_conv;
34637 }
34638
34639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34640         LDKUserConfig this_ptr_conv;
34641         this_ptr_conv.inner = untag_ptr(this_ptr);
34642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34644         this_ptr_conv.is_owned = false;
34645         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
34646 }
34647
34648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34649         LDKUserConfig this_ptr_conv;
34650         this_ptr_conv.inner = untag_ptr(this_ptr);
34651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34653         this_ptr_conv.is_owned = false;
34654         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
34655         return ret_conv;
34656 }
34657
34658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34659         LDKUserConfig this_ptr_conv;
34660         this_ptr_conv.inner = untag_ptr(this_ptr);
34661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34663         this_ptr_conv.is_owned = false;
34664         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
34665 }
34666
34667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
34668         LDKUserConfig this_ptr_conv;
34669         this_ptr_conv.inner = untag_ptr(this_ptr);
34670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34672         this_ptr_conv.is_owned = false;
34673         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
34674         return ret_conv;
34675 }
34676
34677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34678         LDKUserConfig this_ptr_conv;
34679         this_ptr_conv.inner = untag_ptr(this_ptr);
34680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34682         this_ptr_conv.is_owned = false;
34683         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
34684 }
34685
34686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t channel_handshake_config_arg, int64_t channel_handshake_limits_arg, int64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg, jboolean accept_intercept_htlcs_arg, jboolean accept_mpp_keysend_arg) {
34687         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
34688         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
34689         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
34690         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
34691         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
34692         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
34693         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
34694         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
34695         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
34696         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
34697         LDKChannelConfig channel_config_arg_conv;
34698         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
34699         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
34700         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
34701         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
34702         LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg, accept_intercept_htlcs_arg, accept_mpp_keysend_arg);
34703         int64_t ret_ref = 0;
34704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34706         return ret_ref;
34707 }
34708
34709 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
34710         LDKUserConfig ret_var = UserConfig_clone(arg);
34711         int64_t ret_ref = 0;
34712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34714         return ret_ref;
34715 }
34716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34717         LDKUserConfig arg_conv;
34718         arg_conv.inner = untag_ptr(arg);
34719         arg_conv.is_owned = ptr_is_owned(arg);
34720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34721         arg_conv.is_owned = false;
34722         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
34723         return ret_conv;
34724 }
34725
34726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34727         LDKUserConfig orig_conv;
34728         orig_conv.inner = untag_ptr(orig);
34729         orig_conv.is_owned = ptr_is_owned(orig);
34730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34731         orig_conv.is_owned = false;
34732         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
34733         int64_t ret_ref = 0;
34734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34736         return ret_ref;
34737 }
34738
34739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
34740         LDKUserConfig ret_var = UserConfig_default();
34741         int64_t ret_ref = 0;
34742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34744         return ret_ref;
34745 }
34746
34747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34748         LDKBestBlock this_obj_conv;
34749         this_obj_conv.inner = untag_ptr(this_obj);
34750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34752         BestBlock_free(this_obj_conv);
34753 }
34754
34755 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
34756         LDKBestBlock ret_var = BestBlock_clone(arg);
34757         int64_t ret_ref = 0;
34758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34760         return ret_ref;
34761 }
34762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34763         LDKBestBlock arg_conv;
34764         arg_conv.inner = untag_ptr(arg);
34765         arg_conv.is_owned = ptr_is_owned(arg);
34766         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34767         arg_conv.is_owned = false;
34768         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
34769         return ret_conv;
34770 }
34771
34772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34773         LDKBestBlock orig_conv;
34774         orig_conv.inner = untag_ptr(orig);
34775         orig_conv.is_owned = ptr_is_owned(orig);
34776         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34777         orig_conv.is_owned = false;
34778         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
34779         int64_t ret_ref = 0;
34780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34782         return ret_ref;
34783 }
34784
34785 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34786         LDKBestBlock a_conv;
34787         a_conv.inner = untag_ptr(a);
34788         a_conv.is_owned = ptr_is_owned(a);
34789         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34790         a_conv.is_owned = false;
34791         LDKBestBlock b_conv;
34792         b_conv.inner = untag_ptr(b);
34793         b_conv.is_owned = ptr_is_owned(b);
34794         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34795         b_conv.is_owned = false;
34796         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
34797         return ret_conv;
34798 }
34799
34800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
34801         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
34802         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
34803         int64_t ret_ref = 0;
34804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34806         return ret_ref;
34807 }
34808
34809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
34810         LDKThirtyTwoBytes block_hash_ref;
34811         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
34812         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
34813         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
34814         int64_t ret_ref = 0;
34815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34817         return ret_ref;
34818 }
34819
34820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
34821         LDKBestBlock this_arg_conv;
34822         this_arg_conv.inner = untag_ptr(this_arg);
34823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34825         this_arg_conv.is_owned = false;
34826         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34827         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
34828         return ret_arr;
34829 }
34830
34831 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
34832         LDKBestBlock this_arg_conv;
34833         this_arg_conv.inner = untag_ptr(this_arg);
34834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34836         this_arg_conv.is_owned = false;
34837         int32_t ret_conv = BestBlock_height(&this_arg_conv);
34838         return ret_conv;
34839 }
34840
34841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34842         if (!ptr_is_owned(this_ptr)) return;
34843         void* this_ptr_ptr = untag_ptr(this_ptr);
34844         CHECK_ACCESS(this_ptr_ptr);
34845         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
34846         FREE(untag_ptr(this_ptr));
34847         Listen_free(this_ptr_conv);
34848 }
34849
34850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34851         if (!ptr_is_owned(this_ptr)) return;
34852         void* this_ptr_ptr = untag_ptr(this_ptr);
34853         CHECK_ACCESS(this_ptr_ptr);
34854         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
34855         FREE(untag_ptr(this_ptr));
34856         Confirm_free(this_ptr_conv);
34857 }
34858
34859 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34860         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
34861         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
34862         return ret_conv;
34863 }
34864
34865 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
34866         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
34867         return ret_conv;
34868 }
34869
34870 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
34871         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
34872         return ret_conv;
34873 }
34874
34875 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1permanent_1failure(JNIEnv *env, jclass clz) {
34876         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_permanent_failure());
34877         return ret_conv;
34878 }
34879
34880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34881         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
34882         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
34883         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
34884         return ret_conv;
34885 }
34886
34887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34888         if (!ptr_is_owned(this_ptr)) return;
34889         void* this_ptr_ptr = untag_ptr(this_ptr);
34890         CHECK_ACCESS(this_ptr_ptr);
34891         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
34892         FREE(untag_ptr(this_ptr));
34893         Watch_free(this_ptr_conv);
34894 }
34895
34896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34897         if (!ptr_is_owned(this_ptr)) return;
34898         void* this_ptr_ptr = untag_ptr(this_ptr);
34899         CHECK_ACCESS(this_ptr_ptr);
34900         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
34901         FREE(untag_ptr(this_ptr));
34902         Filter_free(this_ptr_conv);
34903 }
34904
34905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34906         LDKWatchedOutput this_obj_conv;
34907         this_obj_conv.inner = untag_ptr(this_obj);
34908         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34910         WatchedOutput_free(this_obj_conv);
34911 }
34912
34913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34914         LDKWatchedOutput this_ptr_conv;
34915         this_ptr_conv.inner = untag_ptr(this_ptr);
34916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34918         this_ptr_conv.is_owned = false;
34919         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
34920         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
34921         int64_t ret_ref = tag_ptr(ret_copy, true);
34922         return ret_ref;
34923 }
34924
34925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34926         LDKWatchedOutput this_ptr_conv;
34927         this_ptr_conv.inner = untag_ptr(this_ptr);
34928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34930         this_ptr_conv.is_owned = false;
34931         void* val_ptr = untag_ptr(val);
34932         CHECK_ACCESS(val_ptr);
34933         LDKCOption_BlockHashZ val_conv = *(LDKCOption_BlockHashZ*)(val_ptr);
34934         val_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(val));
34935         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
34936 }
34937
34938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
34939         LDKWatchedOutput this_ptr_conv;
34940         this_ptr_conv.inner = untag_ptr(this_ptr);
34941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34943         this_ptr_conv.is_owned = false;
34944         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
34945         int64_t ret_ref = 0;
34946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34948         return ret_ref;
34949 }
34950
34951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34952         LDKWatchedOutput this_ptr_conv;
34953         this_ptr_conv.inner = untag_ptr(this_ptr);
34954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34956         this_ptr_conv.is_owned = false;
34957         LDKOutPoint val_conv;
34958         val_conv.inner = untag_ptr(val);
34959         val_conv.is_owned = ptr_is_owned(val);
34960         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34961         val_conv = OutPoint_clone(&val_conv);
34962         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
34963 }
34964
34965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
34966         LDKWatchedOutput this_ptr_conv;
34967         this_ptr_conv.inner = untag_ptr(this_ptr);
34968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34970         this_ptr_conv.is_owned = false;
34971         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
34972         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34973         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34974         return ret_arr;
34975 }
34976
34977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34978         LDKWatchedOutput this_ptr_conv;
34979         this_ptr_conv.inner = untag_ptr(this_ptr);
34980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34982         this_ptr_conv.is_owned = false;
34983         LDKCVec_u8Z val_ref;
34984         val_ref.datalen = (*env)->GetArrayLength(env, val);
34985         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34986         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
34987         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
34988 }
34989
34990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv *env, jclass clz, int64_t block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
34991         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
34992         CHECK_ACCESS(block_hash_arg_ptr);
34993         LDKCOption_BlockHashZ block_hash_arg_conv = *(LDKCOption_BlockHashZ*)(block_hash_arg_ptr);
34994         block_hash_arg_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(block_hash_arg));
34995         LDKOutPoint outpoint_arg_conv;
34996         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
34997         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
34998         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
34999         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
35000         LDKCVec_u8Z script_pubkey_arg_ref;
35001         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
35002         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
35003         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
35004         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
35005         int64_t ret_ref = 0;
35006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35008         return ret_ref;
35009 }
35010
35011 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
35012         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
35013         int64_t ret_ref = 0;
35014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35016         return ret_ref;
35017 }
35018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35019         LDKWatchedOutput arg_conv;
35020         arg_conv.inner = untag_ptr(arg);
35021         arg_conv.is_owned = ptr_is_owned(arg);
35022         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35023         arg_conv.is_owned = false;
35024         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
35025         return ret_conv;
35026 }
35027
35028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35029         LDKWatchedOutput orig_conv;
35030         orig_conv.inner = untag_ptr(orig);
35031         orig_conv.is_owned = ptr_is_owned(orig);
35032         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35033         orig_conv.is_owned = false;
35034         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
35035         int64_t ret_ref = 0;
35036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35038         return ret_ref;
35039 }
35040
35041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35042         LDKWatchedOutput a_conv;
35043         a_conv.inner = untag_ptr(a);
35044         a_conv.is_owned = ptr_is_owned(a);
35045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35046         a_conv.is_owned = false;
35047         LDKWatchedOutput b_conv;
35048         b_conv.inner = untag_ptr(b);
35049         b_conv.is_owned = ptr_is_owned(b);
35050         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35051         b_conv.is_owned = false;
35052         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
35053         return ret_conv;
35054 }
35055
35056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
35057         LDKWatchedOutput o_conv;
35058         o_conv.inner = untag_ptr(o);
35059         o_conv.is_owned = ptr_is_owned(o);
35060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35061         o_conv.is_owned = false;
35062         int64_t ret_conv = WatchedOutput_hash(&o_conv);
35063         return ret_conv;
35064 }
35065
35066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35067         if (!ptr_is_owned(this_ptr)) return;
35068         void* this_ptr_ptr = untag_ptr(this_ptr);
35069         CHECK_ACCESS(this_ptr_ptr);
35070         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
35071         FREE(untag_ptr(this_ptr));
35072         BroadcasterInterface_free(this_ptr_conv);
35073 }
35074
35075 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35076         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
35077         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
35078         return ret_conv;
35079 }
35080
35081 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1mempool_1minimum(JNIEnv *env, jclass clz) {
35082         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_mempool_minimum());
35083         return ret_conv;
35084 }
35085
35086 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
35087         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
35088         return ret_conv;
35089 }
35090
35091 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
35092         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
35093         return ret_conv;
35094 }
35095
35096 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
35097         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
35098         return ret_conv;
35099 }
35100
35101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
35102         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
35103         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
35104         return ret_conv;
35105 }
35106
35107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35108         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
35109         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
35110         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
35111         return ret_conv;
35112 }
35113
35114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35115         if (!ptr_is_owned(this_ptr)) return;
35116         void* this_ptr_ptr = untag_ptr(this_ptr);
35117         CHECK_ACCESS(this_ptr_ptr);
35118         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
35119         FREE(untag_ptr(this_ptr));
35120         FeeEstimator_free(this_ptr_conv);
35121 }
35122
35123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35124         LDKMonitorUpdateId this_obj_conv;
35125         this_obj_conv.inner = untag_ptr(this_obj);
35126         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35128         MonitorUpdateId_free(this_obj_conv);
35129 }
35130
35131 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
35132         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
35133         int64_t ret_ref = 0;
35134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35136         return ret_ref;
35137 }
35138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35139         LDKMonitorUpdateId arg_conv;
35140         arg_conv.inner = untag_ptr(arg);
35141         arg_conv.is_owned = ptr_is_owned(arg);
35142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35143         arg_conv.is_owned = false;
35144         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
35145         return ret_conv;
35146 }
35147
35148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35149         LDKMonitorUpdateId orig_conv;
35150         orig_conv.inner = untag_ptr(orig);
35151         orig_conv.is_owned = ptr_is_owned(orig);
35152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35153         orig_conv.is_owned = false;
35154         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
35155         int64_t ret_ref = 0;
35156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35158         return ret_ref;
35159 }
35160
35161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
35162         LDKMonitorUpdateId o_conv;
35163         o_conv.inner = untag_ptr(o);
35164         o_conv.is_owned = ptr_is_owned(o);
35165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35166         o_conv.is_owned = false;
35167         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
35168         return ret_conv;
35169 }
35170
35171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35172         LDKMonitorUpdateId a_conv;
35173         a_conv.inner = untag_ptr(a);
35174         a_conv.is_owned = ptr_is_owned(a);
35175         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35176         a_conv.is_owned = false;
35177         LDKMonitorUpdateId b_conv;
35178         b_conv.inner = untag_ptr(b);
35179         b_conv.is_owned = ptr_is_owned(b);
35180         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35181         b_conv.is_owned = false;
35182         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
35183         return ret_conv;
35184 }
35185
35186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35187         if (!ptr_is_owned(this_ptr)) return;
35188         void* this_ptr_ptr = untag_ptr(this_ptr);
35189         CHECK_ACCESS(this_ptr_ptr);
35190         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
35191         FREE(untag_ptr(this_ptr));
35192         Persist_free(this_ptr_conv);
35193 }
35194
35195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35196         LDKLockedChannelMonitor this_obj_conv;
35197         this_obj_conv.inner = untag_ptr(this_obj);
35198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35200         LockedChannelMonitor_free(this_obj_conv);
35201 }
35202
35203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35204         LDKChainMonitor this_obj_conv;
35205         this_obj_conv.inner = untag_ptr(this_obj);
35206         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35208         ChainMonitor_free(this_obj_conv);
35209 }
35210
35211 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) {
35212         void* chain_source_ptr = untag_ptr(chain_source);
35213         CHECK_ACCESS(chain_source_ptr);
35214         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
35215         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
35216         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
35217                 // Manually implement clone for Java trait instances
35218                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
35219                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35220                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
35221                 }
35222         }
35223         void* broadcaster_ptr = untag_ptr(broadcaster);
35224         CHECK_ACCESS(broadcaster_ptr);
35225         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35226         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35227                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35228                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35229         }
35230         void* logger_ptr = untag_ptr(logger);
35231         CHECK_ACCESS(logger_ptr);
35232         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35233         if (logger_conv.free == LDKLogger_JCalls_free) {
35234                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35235                 LDKLogger_JCalls_cloned(&logger_conv);
35236         }
35237         void* feeest_ptr = untag_ptr(feeest);
35238         CHECK_ACCESS(feeest_ptr);
35239         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
35240         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
35241                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35242                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
35243         }
35244         void* persister_ptr = untag_ptr(persister);
35245         CHECK_ACCESS(persister_ptr);
35246         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
35247         if (persister_conv.free == LDKPersist_JCalls_free) {
35248                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35249                 LDKPersist_JCalls_cloned(&persister_conv);
35250         }
35251         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
35252         int64_t ret_ref = 0;
35253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35255         return ret_ref;
35256 }
35257
35258 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray ignored_channels) {
35259         LDKChainMonitor this_arg_conv;
35260         this_arg_conv.inner = untag_ptr(this_arg);
35261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35263         this_arg_conv.is_owned = false;
35264         LDKCVec_ChannelDetailsZ ignored_channels_constr;
35265         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
35266         if (ignored_channels_constr.datalen > 0)
35267                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
35268         else
35269                 ignored_channels_constr.data = NULL;
35270         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
35271         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
35272                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
35273                 LDKChannelDetails ignored_channels_conv_16_conv;
35274                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
35275                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
35276                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
35277                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
35278                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
35279         }
35280         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
35281         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
35282         int64_tArray ret_arr = NULL;
35283         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35284         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35285         for (size_t j = 0; j < ret_var.datalen; j++) {
35286                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35287                 *ret_conv_9_copy = ret_var.data[j];
35288                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
35289                 ret_arr_ptr[j] = ret_conv_9_ref;
35290         }
35291         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35292         FREE(ret_var.data);
35293         return ret_arr;
35294 }
35295
35296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
35297         LDKChainMonitor this_arg_conv;
35298         this_arg_conv.inner = untag_ptr(this_arg);
35299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35301         this_arg_conv.is_owned = false;
35302         LDKOutPoint funding_txo_conv;
35303         funding_txo_conv.inner = untag_ptr(funding_txo);
35304         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35305         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35306         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35307         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
35308         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
35309         return tag_ptr(ret_conv, true);
35310 }
35311
35312 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
35313         LDKChainMonitor this_arg_conv;
35314         this_arg_conv.inner = untag_ptr(this_arg);
35315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35317         this_arg_conv.is_owned = false;
35318         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
35319         int64_tArray ret_arr = NULL;
35320         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35321         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35322         for (size_t k = 0; k < ret_var.datalen; k++) {
35323                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
35324                 int64_t ret_conv_10_ref = 0;
35325                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
35326                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
35327                 ret_arr_ptr[k] = ret_conv_10_ref;
35328         }
35329         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35330         FREE(ret_var.data);
35331         return ret_arr;
35332 }
35333
35334 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
35335         LDKChainMonitor this_arg_conv;
35336         this_arg_conv.inner = untag_ptr(this_arg);
35337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35339         this_arg_conv.is_owned = false;
35340         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
35341         int64_tArray ret_arr = NULL;
35342         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35343         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35344         for (size_t p = 0; p < ret_var.datalen; p++) {
35345                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35346                 *ret_conv_41_conv = ret_var.data[p];
35347                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
35348         }
35349         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35350         FREE(ret_var.data);
35351         return ret_arr;
35352 }
35353
35354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
35355         LDKChainMonitor this_arg_conv;
35356         this_arg_conv.inner = untag_ptr(this_arg);
35357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35359         this_arg_conv.is_owned = false;
35360         LDKOutPoint funding_txo_conv;
35361         funding_txo_conv.inner = untag_ptr(funding_txo);
35362         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35363         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35364         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35365         LDKMonitorUpdateId completed_update_id_conv;
35366         completed_update_id_conv.inner = untag_ptr(completed_update_id);
35367         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
35368         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
35369         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
35370         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35371         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
35372         return tag_ptr(ret_conv, true);
35373 }
35374
35375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
35376         LDKChainMonitor this_arg_conv;
35377         this_arg_conv.inner = untag_ptr(this_arg);
35378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35380         this_arg_conv.is_owned = false;
35381         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
35382         int64_t ret_ref = 0;
35383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35385         return ret_ref;
35386 }
35387
35388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
35389         LDKChainMonitor this_arg_conv;
35390         this_arg_conv.inner = untag_ptr(this_arg);
35391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35393         this_arg_conv.is_owned = false;
35394         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
35395 }
35396
35397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
35398         LDKChainMonitor this_arg_conv;
35399         this_arg_conv.inner = untag_ptr(this_arg);
35400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35402         this_arg_conv.is_owned = false;
35403         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
35404         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
35405         return tag_ptr(ret_ret, true);
35406 }
35407
35408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
35409         LDKChainMonitor this_arg_conv;
35410         this_arg_conv.inner = untag_ptr(this_arg);
35411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35413         this_arg_conv.is_owned = false;
35414         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
35415         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
35416         return tag_ptr(ret_ret, true);
35417 }
35418
35419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
35420         LDKChainMonitor this_arg_conv;
35421         this_arg_conv.inner = untag_ptr(this_arg);
35422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35424         this_arg_conv.is_owned = false;
35425         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
35426         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
35427         return tag_ptr(ret_ret, true);
35428 }
35429
35430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
35431         LDKChainMonitor this_arg_conv;
35432         this_arg_conv.inner = untag_ptr(this_arg);
35433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35435         this_arg_conv.is_owned = false;
35436         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
35437         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
35438         return tag_ptr(ret_ret, true);
35439 }
35440
35441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35442         LDKChannelMonitorUpdate this_obj_conv;
35443         this_obj_conv.inner = untag_ptr(this_obj);
35444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35446         ChannelMonitorUpdate_free(this_obj_conv);
35447 }
35448
35449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35450         LDKChannelMonitorUpdate this_ptr_conv;
35451         this_ptr_conv.inner = untag_ptr(this_ptr);
35452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35454         this_ptr_conv.is_owned = false;
35455         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
35456         return ret_conv;
35457 }
35458
35459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35460         LDKChannelMonitorUpdate this_ptr_conv;
35461         this_ptr_conv.inner = untag_ptr(this_ptr);
35462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35464         this_ptr_conv.is_owned = false;
35465         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
35466 }
35467
35468 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
35469         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
35470         int64_t ret_ref = 0;
35471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35473         return ret_ref;
35474 }
35475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35476         LDKChannelMonitorUpdate arg_conv;
35477         arg_conv.inner = untag_ptr(arg);
35478         arg_conv.is_owned = ptr_is_owned(arg);
35479         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35480         arg_conv.is_owned = false;
35481         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
35482         return ret_conv;
35483 }
35484
35485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35486         LDKChannelMonitorUpdate orig_conv;
35487         orig_conv.inner = untag_ptr(orig);
35488         orig_conv.is_owned = ptr_is_owned(orig);
35489         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35490         orig_conv.is_owned = false;
35491         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
35492         int64_t ret_ref = 0;
35493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35495         return ret_ref;
35496 }
35497
35498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35499         LDKChannelMonitorUpdate a_conv;
35500         a_conv.inner = untag_ptr(a);
35501         a_conv.is_owned = ptr_is_owned(a);
35502         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35503         a_conv.is_owned = false;
35504         LDKChannelMonitorUpdate b_conv;
35505         b_conv.inner = untag_ptr(b);
35506         b_conv.is_owned = ptr_is_owned(b);
35507         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35508         b_conv.is_owned = false;
35509         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
35510         return ret_conv;
35511 }
35512
35513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35514         LDKChannelMonitorUpdate obj_conv;
35515         obj_conv.inner = untag_ptr(obj);
35516         obj_conv.is_owned = ptr_is_owned(obj);
35517         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35518         obj_conv.is_owned = false;
35519         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
35520         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35521         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35522         CVec_u8Z_free(ret_var);
35523         return ret_arr;
35524 }
35525
35526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35527         LDKu8slice ser_ref;
35528         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35529         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35530         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
35531         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
35532         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35533         return tag_ptr(ret_conv, true);
35534 }
35535
35536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35537         if (!ptr_is_owned(this_ptr)) return;
35538         void* this_ptr_ptr = untag_ptr(this_ptr);
35539         CHECK_ACCESS(this_ptr_ptr);
35540         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
35541         FREE(untag_ptr(this_ptr));
35542         MonitorEvent_free(this_ptr_conv);
35543 }
35544
35545 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
35546         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35547         *ret_copy = MonitorEvent_clone(arg);
35548         int64_t ret_ref = tag_ptr(ret_copy, true);
35549         return ret_ref;
35550 }
35551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35552         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
35553         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
35554         return ret_conv;
35555 }
35556
35557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35558         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
35559         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35560         *ret_copy = MonitorEvent_clone(orig_conv);
35561         int64_t ret_ref = tag_ptr(ret_copy, true);
35562         return ret_ref;
35563 }
35564
35565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
35566         LDKHTLCUpdate a_conv;
35567         a_conv.inner = untag_ptr(a);
35568         a_conv.is_owned = ptr_is_owned(a);
35569         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35570         a_conv = HTLCUpdate_clone(&a_conv);
35571         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35572         *ret_copy = MonitorEvent_htlcevent(a_conv);
35573         int64_t ret_ref = tag_ptr(ret_copy, true);
35574         return ret_ref;
35575 }
35576
35577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
35578         LDKOutPoint a_conv;
35579         a_conv.inner = untag_ptr(a);
35580         a_conv.is_owned = ptr_is_owned(a);
35581         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35582         a_conv = OutPoint_clone(&a_conv);
35583         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35584         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
35585         int64_t ret_ref = tag_ptr(ret_copy, true);
35586         return ret_ref;
35587 }
35588
35589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
35590         LDKOutPoint funding_txo_conv;
35591         funding_txo_conv.inner = untag_ptr(funding_txo);
35592         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35593         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35594         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35595         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35596         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
35597         int64_t ret_ref = tag_ptr(ret_copy, true);
35598         return ret_ref;
35599 }
35600
35601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
35602         LDKOutPoint a_conv;
35603         a_conv.inner = untag_ptr(a);
35604         a_conv.is_owned = ptr_is_owned(a);
35605         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35606         a_conv = OutPoint_clone(&a_conv);
35607         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35608         *ret_copy = MonitorEvent_update_failed(a_conv);
35609         int64_t ret_ref = tag_ptr(ret_copy, true);
35610         return ret_ref;
35611 }
35612
35613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35614         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
35615         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
35616         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
35617         return ret_conv;
35618 }
35619
35620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
35621         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
35622         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
35623         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35624         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35625         CVec_u8Z_free(ret_var);
35626         return ret_arr;
35627 }
35628
35629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35630         LDKu8slice ser_ref;
35631         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35632         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35633         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
35634         *ret_conv = MonitorEvent_read(ser_ref);
35635         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35636         return tag_ptr(ret_conv, true);
35637 }
35638
35639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35640         LDKHTLCUpdate this_obj_conv;
35641         this_obj_conv.inner = untag_ptr(this_obj);
35642         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35644         HTLCUpdate_free(this_obj_conv);
35645 }
35646
35647 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
35648         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
35649         int64_t ret_ref = 0;
35650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35652         return ret_ref;
35653 }
35654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35655         LDKHTLCUpdate arg_conv;
35656         arg_conv.inner = untag_ptr(arg);
35657         arg_conv.is_owned = ptr_is_owned(arg);
35658         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35659         arg_conv.is_owned = false;
35660         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
35661         return ret_conv;
35662 }
35663
35664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35665         LDKHTLCUpdate orig_conv;
35666         orig_conv.inner = untag_ptr(orig);
35667         orig_conv.is_owned = ptr_is_owned(orig);
35668         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35669         orig_conv.is_owned = false;
35670         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
35671         int64_t ret_ref = 0;
35672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35674         return ret_ref;
35675 }
35676
35677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35678         LDKHTLCUpdate a_conv;
35679         a_conv.inner = untag_ptr(a);
35680         a_conv.is_owned = ptr_is_owned(a);
35681         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35682         a_conv.is_owned = false;
35683         LDKHTLCUpdate b_conv;
35684         b_conv.inner = untag_ptr(b);
35685         b_conv.is_owned = ptr_is_owned(b);
35686         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35687         b_conv.is_owned = false;
35688         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
35689         return ret_conv;
35690 }
35691
35692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35693         LDKHTLCUpdate obj_conv;
35694         obj_conv.inner = untag_ptr(obj);
35695         obj_conv.is_owned = ptr_is_owned(obj);
35696         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35697         obj_conv.is_owned = false;
35698         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
35699         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35700         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35701         CVec_u8Z_free(ret_var);
35702         return ret_arr;
35703 }
35704
35705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35706         LDKu8slice ser_ref;
35707         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35708         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35709         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
35710         *ret_conv = HTLCUpdate_read(ser_ref);
35711         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35712         return tag_ptr(ret_conv, true);
35713 }
35714
35715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35716         if (!ptr_is_owned(this_ptr)) return;
35717         void* this_ptr_ptr = untag_ptr(this_ptr);
35718         CHECK_ACCESS(this_ptr_ptr);
35719         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
35720         FREE(untag_ptr(this_ptr));
35721         Balance_free(this_ptr_conv);
35722 }
35723
35724 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
35725         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35726         *ret_copy = Balance_clone(arg);
35727         int64_t ret_ref = tag_ptr(ret_copy, true);
35728         return ret_ref;
35729 }
35730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35731         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
35732         int64_t ret_conv = Balance_clone_ptr(arg_conv);
35733         return ret_conv;
35734 }
35735
35736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35737         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
35738         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35739         *ret_copy = Balance_clone(orig_conv);
35740         int64_t ret_ref = tag_ptr(ret_copy, true);
35741         return ret_ref;
35742 }
35743
35744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
35745         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35746         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
35747         int64_t ret_ref = tag_ptr(ret_copy, true);
35748         return ret_ref;
35749 }
35750
35751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t confirmation_height) {
35752         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35753         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
35754         int64_t ret_ref = tag_ptr(ret_copy, true);
35755         return ret_ref;
35756 }
35757
35758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t timeout_height, int8_tArray payment_hash, int8_tArray payment_preimage) {
35759         LDKThirtyTwoBytes payment_hash_ref;
35760         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
35761         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
35762         LDKThirtyTwoBytes payment_preimage_ref;
35763         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
35764         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
35765         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35766         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
35767         int64_t ret_ref = tag_ptr(ret_copy, true);
35768         return ret_ref;
35769 }
35770
35771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1timeout_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t claimable_height, int8_tArray payment_hash) {
35772         LDKThirtyTwoBytes payment_hash_ref;
35773         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
35774         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
35775         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35776         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
35777         int64_t ret_ref = tag_ptr(ret_copy, true);
35778         return ret_ref;
35779 }
35780
35781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1preimage_1claimable_1htlc(JNIEnv *env, jclass clz, int64_t amount_satoshis, int32_t expiry_height, int8_tArray payment_hash) {
35782         LDKThirtyTwoBytes payment_hash_ref;
35783         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
35784         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
35785         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35786         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
35787         int64_t ret_ref = tag_ptr(ret_copy, true);
35788         return ret_ref;
35789 }
35790
35791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
35792         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35793         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
35794         int64_t ret_ref = tag_ptr(ret_copy, true);
35795         return ret_ref;
35796 }
35797
35798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35799         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
35800         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
35801         jboolean ret_conv = Balance_eq(a_conv, b_conv);
35802         return ret_conv;
35803 }
35804
35805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
35806         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
35807         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
35808         return ret_conv;
35809 }
35810
35811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35812         LDKChannelMonitor this_obj_conv;
35813         this_obj_conv.inner = untag_ptr(this_obj);
35814         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35816         ChannelMonitor_free(this_obj_conv);
35817 }
35818
35819 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
35820         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
35821         int64_t ret_ref = 0;
35822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35824         return ret_ref;
35825 }
35826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35827         LDKChannelMonitor arg_conv;
35828         arg_conv.inner = untag_ptr(arg);
35829         arg_conv.is_owned = ptr_is_owned(arg);
35830         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35831         arg_conv.is_owned = false;
35832         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
35833         return ret_conv;
35834 }
35835
35836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35837         LDKChannelMonitor orig_conv;
35838         orig_conv.inner = untag_ptr(orig);
35839         orig_conv.is_owned = ptr_is_owned(orig);
35840         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35841         orig_conv.is_owned = false;
35842         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
35843         int64_t ret_ref = 0;
35844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35846         return ret_ref;
35847 }
35848
35849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
35850         LDKChannelMonitor obj_conv;
35851         obj_conv.inner = untag_ptr(obj);
35852         obj_conv.is_owned = ptr_is_owned(obj);
35853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35854         obj_conv.is_owned = false;
35855         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
35856         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35857         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35858         CVec_u8Z_free(ret_var);
35859         return ret_arr;
35860 }
35861
35862 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) {
35863         LDKChannelMonitor this_arg_conv;
35864         this_arg_conv.inner = untag_ptr(this_arg);
35865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35867         this_arg_conv.is_owned = false;
35868         LDKChannelMonitorUpdate updates_conv;
35869         updates_conv.inner = untag_ptr(updates);
35870         updates_conv.is_owned = ptr_is_owned(updates);
35871         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
35872         updates_conv.is_owned = false;
35873         void* broadcaster_ptr = untag_ptr(broadcaster);
35874         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35875         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35876         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35877         CHECK_ACCESS(fee_estimator_ptr);
35878         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35879         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35880                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35881                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35882         }
35883         void* logger_ptr = untag_ptr(logger);
35884         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35885         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35886         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
35887         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
35888         return tag_ptr(ret_conv, true);
35889 }
35890
35891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
35892         LDKChannelMonitor this_arg_conv;
35893         this_arg_conv.inner = untag_ptr(this_arg);
35894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35896         this_arg_conv.is_owned = false;
35897         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
35898         return ret_conv;
35899 }
35900
35901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
35902         LDKChannelMonitor this_arg_conv;
35903         this_arg_conv.inner = untag_ptr(this_arg);
35904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35906         this_arg_conv.is_owned = false;
35907         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
35908         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
35909         return tag_ptr(ret_conv, true);
35910 }
35911
35912 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
35913         LDKChannelMonitor this_arg_conv;
35914         this_arg_conv.inner = untag_ptr(this_arg);
35915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35917         this_arg_conv.is_owned = false;
35918         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
35919         int64_tArray ret_arr = NULL;
35920         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35921         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35922         for (size_t o = 0; o < ret_var.datalen; o++) {
35923                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
35924                 *ret_conv_40_conv = ret_var.data[o];
35925                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
35926         }
35927         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35928         FREE(ret_var.data);
35929         return ret_arr;
35930 }
35931
35932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
35933         LDKChannelMonitor this_arg_conv;
35934         this_arg_conv.inner = untag_ptr(this_arg);
35935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35937         this_arg_conv.is_owned = false;
35938         void* filter_ptr = untag_ptr(filter);
35939         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
35940         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
35941         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
35942 }
35943
35944 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
35945         LDKChannelMonitor this_arg_conv;
35946         this_arg_conv.inner = untag_ptr(this_arg);
35947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35949         this_arg_conv.is_owned = false;
35950         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
35951         int64_tArray ret_arr = NULL;
35952         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35953         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35954         for (size_t o = 0; o < ret_var.datalen; o++) {
35955                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35956                 *ret_conv_14_copy = ret_var.data[o];
35957                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
35958                 ret_arr_ptr[o] = ret_conv_14_ref;
35959         }
35960         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35961         FREE(ret_var.data);
35962         return ret_arr;
35963 }
35964
35965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
35966         LDKChannelMonitor this_arg_conv;
35967         this_arg_conv.inner = untag_ptr(this_arg);
35968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35970         this_arg_conv.is_owned = false;
35971         void* handler_ptr = untag_ptr(handler);
35972         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
35973         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
35974         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
35975 }
35976
35977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
35978         LDKChannelMonitor this_arg_conv;
35979         this_arg_conv.inner = untag_ptr(this_arg);
35980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35982         this_arg_conv.is_owned = false;
35983         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35984         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
35985         return ret_arr;
35986 }
35987
35988 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) {
35989         LDKChannelMonitor this_arg_conv;
35990         this_arg_conv.inner = untag_ptr(this_arg);
35991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35993         this_arg_conv.is_owned = false;
35994         void* logger_ptr = untag_ptr(logger);
35995         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35996         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35997         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
35998         jobjectArray ret_arr = NULL;
35999         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
36000         ;
36001         for (size_t i = 0; i < ret_var.datalen; i++) {
36002                 LDKTransaction ret_conv_8_var = ret_var.data[i];
36003                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
36004                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
36005                 Transaction_free(ret_conv_8_var);
36006                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
36007         }
36008         
36009         FREE(ret_var.data);
36010         return ret_arr;
36011 }
36012
36013 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) {
36014         LDKChannelMonitor this_arg_conv;
36015         this_arg_conv.inner = untag_ptr(this_arg);
36016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36018         this_arg_conv.is_owned = false;
36019         uint8_t header_arr[80];
36020         CHECK((*env)->GetArrayLength(env, header) == 80);
36021         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
36022         uint8_t (*header_ref)[80] = &header_arr;
36023         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
36024         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
36025         if (txdata_constr.datalen > 0)
36026                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
36027         else
36028                 txdata_constr.data = NULL;
36029         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
36030         for (size_t c = 0; c < txdata_constr.datalen; c++) {
36031                 int64_t txdata_conv_28 = txdata_vals[c];
36032                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
36033                 CHECK_ACCESS(txdata_conv_28_ptr);
36034                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
36035                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
36036                 txdata_constr.data[c] = txdata_conv_28_conv;
36037         }
36038         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
36039         void* broadcaster_ptr = untag_ptr(broadcaster);
36040         CHECK_ACCESS(broadcaster_ptr);
36041         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36042         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36043                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36044                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36045         }
36046         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36047         CHECK_ACCESS(fee_estimator_ptr);
36048         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36049         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36050                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36051                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36052         }
36053         void* logger_ptr = untag_ptr(logger);
36054         CHECK_ACCESS(logger_ptr);
36055         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36056         if (logger_conv.free == LDKLogger_JCalls_free) {
36057                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36058                 LDKLogger_JCalls_cloned(&logger_conv);
36059         }
36060         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);
36061         int64_tArray ret_arr = NULL;
36062         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36063         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36064         for (size_t n = 0; n < ret_var.datalen; n++) {
36065                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
36066                 *ret_conv_39_conv = ret_var.data[n];
36067                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
36068         }
36069         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36070         FREE(ret_var.data);
36071         return ret_arr;
36072 }
36073
36074 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) {
36075         LDKChannelMonitor this_arg_conv;
36076         this_arg_conv.inner = untag_ptr(this_arg);
36077         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36079         this_arg_conv.is_owned = false;
36080         uint8_t header_arr[80];
36081         CHECK((*env)->GetArrayLength(env, header) == 80);
36082         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
36083         uint8_t (*header_ref)[80] = &header_arr;
36084         void* broadcaster_ptr = untag_ptr(broadcaster);
36085         CHECK_ACCESS(broadcaster_ptr);
36086         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36087         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36088                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36089                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36090         }
36091         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36092         CHECK_ACCESS(fee_estimator_ptr);
36093         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36094         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36095                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36096                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36097         }
36098         void* logger_ptr = untag_ptr(logger);
36099         CHECK_ACCESS(logger_ptr);
36100         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36101         if (logger_conv.free == LDKLogger_JCalls_free) {
36102                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36103                 LDKLogger_JCalls_cloned(&logger_conv);
36104         }
36105         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
36106 }
36107
36108 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
36109         LDKChannelMonitor this_arg_conv;
36110         this_arg_conv.inner = untag_ptr(this_arg);
36111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36113         this_arg_conv.is_owned = false;
36114         uint8_t header_arr[80];
36115         CHECK((*env)->GetArrayLength(env, header) == 80);
36116         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
36117         uint8_t (*header_ref)[80] = &header_arr;
36118         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
36119         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
36120         if (txdata_constr.datalen > 0)
36121                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
36122         else
36123                 txdata_constr.data = NULL;
36124         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
36125         for (size_t c = 0; c < txdata_constr.datalen; c++) {
36126                 int64_t txdata_conv_28 = txdata_vals[c];
36127                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
36128                 CHECK_ACCESS(txdata_conv_28_ptr);
36129                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
36130                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
36131                 txdata_constr.data[c] = txdata_conv_28_conv;
36132         }
36133         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
36134         void* broadcaster_ptr = untag_ptr(broadcaster);
36135         CHECK_ACCESS(broadcaster_ptr);
36136         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36137         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36138                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36139                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36140         }
36141         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36142         CHECK_ACCESS(fee_estimator_ptr);
36143         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36144         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36145                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36146                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36147         }
36148         void* logger_ptr = untag_ptr(logger);
36149         CHECK_ACCESS(logger_ptr);
36150         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36151         if (logger_conv.free == LDKLogger_JCalls_free) {
36152                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36153                 LDKLogger_JCalls_cloned(&logger_conv);
36154         }
36155         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
36156         int64_tArray ret_arr = NULL;
36157         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36158         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36159         for (size_t n = 0; n < ret_var.datalen; n++) {
36160                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
36161                 *ret_conv_39_conv = ret_var.data[n];
36162                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
36163         }
36164         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36165         FREE(ret_var.data);
36166         return ret_arr;
36167 }
36168
36169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
36170         LDKChannelMonitor this_arg_conv;
36171         this_arg_conv.inner = untag_ptr(this_arg);
36172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36174         this_arg_conv.is_owned = false;
36175         uint8_t txid_arr[32];
36176         CHECK((*env)->GetArrayLength(env, txid) == 32);
36177         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
36178         uint8_t (*txid_ref)[32] = &txid_arr;
36179         void* broadcaster_ptr = untag_ptr(broadcaster);
36180         CHECK_ACCESS(broadcaster_ptr);
36181         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36182         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36183                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36184                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36185         }
36186         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36187         CHECK_ACCESS(fee_estimator_ptr);
36188         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36189         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36190                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36191                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36192         }
36193         void* logger_ptr = untag_ptr(logger);
36194         CHECK_ACCESS(logger_ptr);
36195         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36196         if (logger_conv.free == LDKLogger_JCalls_free) {
36197                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36198                 LDKLogger_JCalls_cloned(&logger_conv);
36199         }
36200         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
36201 }
36202
36203 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
36204         LDKChannelMonitor this_arg_conv;
36205         this_arg_conv.inner = untag_ptr(this_arg);
36206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36208         this_arg_conv.is_owned = false;
36209         uint8_t header_arr[80];
36210         CHECK((*env)->GetArrayLength(env, header) == 80);
36211         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
36212         uint8_t (*header_ref)[80] = &header_arr;
36213         void* broadcaster_ptr = untag_ptr(broadcaster);
36214         CHECK_ACCESS(broadcaster_ptr);
36215         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36216         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36217                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36218                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36219         }
36220         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36221         CHECK_ACCESS(fee_estimator_ptr);
36222         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36223         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36224                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36225                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36226         }
36227         void* logger_ptr = untag_ptr(logger);
36228         CHECK_ACCESS(logger_ptr);
36229         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36230         if (logger_conv.free == LDKLogger_JCalls_free) {
36231                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36232                 LDKLogger_JCalls_cloned(&logger_conv);
36233         }
36234         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
36235         int64_tArray ret_arr = NULL;
36236         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36237         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36238         for (size_t n = 0; n < ret_var.datalen; n++) {
36239                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
36240                 *ret_conv_39_conv = ret_var.data[n];
36241                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
36242         }
36243         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36244         FREE(ret_var.data);
36245         return ret_arr;
36246 }
36247
36248 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
36249         LDKChannelMonitor this_arg_conv;
36250         this_arg_conv.inner = untag_ptr(this_arg);
36251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36253         this_arg_conv.is_owned = false;
36254         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
36255         int64_tArray ret_arr = NULL;
36256         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36257         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36258         for (size_t i = 0; i < ret_var.datalen; i++) {
36259                 LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv_34_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
36260                 *ret_conv_34_conv = ret_var.data[i];
36261                 ret_arr_ptr[i] = tag_ptr(ret_conv_34_conv, true);
36262         }
36263         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36264         FREE(ret_var.data);
36265         return ret_arr;
36266 }
36267
36268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
36269         LDKChannelMonitor this_arg_conv;
36270         this_arg_conv.inner = untag_ptr(this_arg);
36271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36273         this_arg_conv.is_owned = false;
36274         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
36275         int64_t ret_ref = 0;
36276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36278         return ret_ref;
36279 }
36280
36281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
36282         LDKChannelMonitor this_arg_conv;
36283         this_arg_conv.inner = untag_ptr(this_arg);
36284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36286         this_arg_conv.is_owned = false;
36287         void* broadcaster_ptr = untag_ptr(broadcaster);
36288         CHECK_ACCESS(broadcaster_ptr);
36289         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36290         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36291                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36292                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36293         }
36294         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36295         CHECK_ACCESS(fee_estimator_ptr);
36296         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36297         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36298                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36299                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36300         }
36301         void* logger_ptr = untag_ptr(logger);
36302         CHECK_ACCESS(logger_ptr);
36303         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36304         if (logger_conv.free == LDKLogger_JCalls_free) {
36305                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36306                 LDKLogger_JCalls_cloned(&logger_conv);
36307         }
36308         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
36309 }
36310
36311 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
36312         LDKChannelMonitor this_arg_conv;
36313         this_arg_conv.inner = untag_ptr(this_arg);
36314         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36316         this_arg_conv.is_owned = false;
36317         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
36318         int64_tArray ret_arr = NULL;
36319         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36320         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36321         for (size_t j = 0; j < ret_var.datalen; j++) {
36322                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
36323                 *ret_conv_9_copy = ret_var.data[j];
36324                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
36325                 ret_arr_ptr[j] = ret_conv_9_ref;
36326         }
36327         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36328         FREE(ret_var.data);
36329         return ret_arr;
36330 }
36331
36332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) {
36333         LDKu8slice ser_ref;
36334         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36335         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36336         void* arg_a_ptr = untag_ptr(arg_a);
36337         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
36338         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
36339         void* arg_b_ptr = untag_ptr(arg_b);
36340         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
36341         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
36342         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
36343         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
36344         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36345         return tag_ptr(ret_conv, true);
36346 }
36347
36348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36349         LDKOutPoint this_obj_conv;
36350         this_obj_conv.inner = untag_ptr(this_obj);
36351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36353         OutPoint_free(this_obj_conv);
36354 }
36355
36356 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
36357         LDKOutPoint this_ptr_conv;
36358         this_ptr_conv.inner = untag_ptr(this_ptr);
36359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36361         this_ptr_conv.is_owned = false;
36362         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36363         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
36364         return ret_arr;
36365 }
36366
36367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36368         LDKOutPoint this_ptr_conv;
36369         this_ptr_conv.inner = untag_ptr(this_ptr);
36370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36372         this_ptr_conv.is_owned = false;
36373         LDKThirtyTwoBytes val_ref;
36374         CHECK((*env)->GetArrayLength(env, val) == 32);
36375         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36376         OutPoint_set_txid(&this_ptr_conv, val_ref);
36377 }
36378
36379 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
36380         LDKOutPoint this_ptr_conv;
36381         this_ptr_conv.inner = untag_ptr(this_ptr);
36382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36384         this_ptr_conv.is_owned = false;
36385         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
36386         return ret_conv;
36387 }
36388
36389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36390         LDKOutPoint this_ptr_conv;
36391         this_ptr_conv.inner = untag_ptr(this_ptr);
36392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36394         this_ptr_conv.is_owned = false;
36395         OutPoint_set_index(&this_ptr_conv, val);
36396 }
36397
36398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
36399         LDKThirtyTwoBytes txid_arg_ref;
36400         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
36401         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
36402         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
36403         int64_t ret_ref = 0;
36404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36406         return ret_ref;
36407 }
36408
36409 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
36410         LDKOutPoint ret_var = OutPoint_clone(arg);
36411         int64_t ret_ref = 0;
36412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36414         return ret_ref;
36415 }
36416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36417         LDKOutPoint arg_conv;
36418         arg_conv.inner = untag_ptr(arg);
36419         arg_conv.is_owned = ptr_is_owned(arg);
36420         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36421         arg_conv.is_owned = false;
36422         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
36423         return ret_conv;
36424 }
36425
36426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36427         LDKOutPoint orig_conv;
36428         orig_conv.inner = untag_ptr(orig);
36429         orig_conv.is_owned = ptr_is_owned(orig);
36430         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36431         orig_conv.is_owned = false;
36432         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
36433         int64_t ret_ref = 0;
36434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36436         return ret_ref;
36437 }
36438
36439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36440         LDKOutPoint a_conv;
36441         a_conv.inner = untag_ptr(a);
36442         a_conv.is_owned = ptr_is_owned(a);
36443         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36444         a_conv.is_owned = false;
36445         LDKOutPoint b_conv;
36446         b_conv.inner = untag_ptr(b);
36447         b_conv.is_owned = ptr_is_owned(b);
36448         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36449         b_conv.is_owned = false;
36450         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
36451         return ret_conv;
36452 }
36453
36454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
36455         LDKOutPoint o_conv;
36456         o_conv.inner = untag_ptr(o);
36457         o_conv.is_owned = ptr_is_owned(o);
36458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36459         o_conv.is_owned = false;
36460         int64_t ret_conv = OutPoint_hash(&o_conv);
36461         return ret_conv;
36462 }
36463
36464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
36465         LDKOutPoint this_arg_conv;
36466         this_arg_conv.inner = untag_ptr(this_arg);
36467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36469         this_arg_conv.is_owned = false;
36470         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36471         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
36472         return ret_arr;
36473 }
36474
36475 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
36476         LDKOutPoint obj_conv;
36477         obj_conv.inner = untag_ptr(obj);
36478         obj_conv.is_owned = ptr_is_owned(obj);
36479         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36480         obj_conv.is_owned = false;
36481         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
36482         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36483         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36484         CVec_u8Z_free(ret_var);
36485         return ret_arr;
36486 }
36487
36488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36489         LDKu8slice ser_ref;
36490         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36491         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36492         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
36493         *ret_conv = OutPoint_read(ser_ref);
36494         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36495         return tag_ptr(ret_conv, true);
36496 }
36497
36498 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36499         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
36500         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_clone(orig_conv));
36501         return ret_conv;
36502 }
36503
36504 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
36505         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_temporary_node_failure());
36506         return ret_conv;
36507 }
36508
36509 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
36510         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_required_node_feature_missing());
36511         return ret_conv;
36512 }
36513
36514 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
36515         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_incorrect_or_unknown_payment_details());
36516         return ret_conv;
36517 }
36518
36519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36520         LDKChannelManager this_obj_conv;
36521         this_obj_conv.inner = untag_ptr(this_obj);
36522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36524         ChannelManager_free(this_obj_conv);
36525 }
36526
36527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36528         LDKChainParameters this_obj_conv;
36529         this_obj_conv.inner = untag_ptr(this_obj);
36530         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36532         ChainParameters_free(this_obj_conv);
36533 }
36534
36535 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
36536         LDKChainParameters this_ptr_conv;
36537         this_ptr_conv.inner = untag_ptr(this_ptr);
36538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36540         this_ptr_conv.is_owned = false;
36541         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
36542         return ret_conv;
36543 }
36544
36545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
36546         LDKChainParameters this_ptr_conv;
36547         this_ptr_conv.inner = untag_ptr(this_ptr);
36548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36550         this_ptr_conv.is_owned = false;
36551         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
36552         ChainParameters_set_network(&this_ptr_conv, val_conv);
36553 }
36554
36555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
36556         LDKChainParameters this_ptr_conv;
36557         this_ptr_conv.inner = untag_ptr(this_ptr);
36558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36560         this_ptr_conv.is_owned = false;
36561         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
36562         int64_t ret_ref = 0;
36563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36565         return ret_ref;
36566 }
36567
36568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36569         LDKChainParameters this_ptr_conv;
36570         this_ptr_conv.inner = untag_ptr(this_ptr);
36571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36573         this_ptr_conv.is_owned = false;
36574         LDKBestBlock val_conv;
36575         val_conv.inner = untag_ptr(val);
36576         val_conv.is_owned = ptr_is_owned(val);
36577         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36578         val_conv = BestBlock_clone(&val_conv);
36579         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
36580 }
36581
36582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
36583         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
36584         LDKBestBlock best_block_arg_conv;
36585         best_block_arg_conv.inner = untag_ptr(best_block_arg);
36586         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
36587         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
36588         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
36589         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
36590         int64_t ret_ref = 0;
36591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36593         return ret_ref;
36594 }
36595
36596 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
36597         LDKChainParameters ret_var = ChainParameters_clone(arg);
36598         int64_t ret_ref = 0;
36599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36601         return ret_ref;
36602 }
36603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36604         LDKChainParameters arg_conv;
36605         arg_conv.inner = untag_ptr(arg);
36606         arg_conv.is_owned = ptr_is_owned(arg);
36607         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36608         arg_conv.is_owned = false;
36609         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
36610         return ret_conv;
36611 }
36612
36613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36614         LDKChainParameters orig_conv;
36615         orig_conv.inner = untag_ptr(orig);
36616         orig_conv.is_owned = ptr_is_owned(orig);
36617         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36618         orig_conv.is_owned = false;
36619         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
36620         int64_t ret_ref = 0;
36621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36623         return ret_ref;
36624 }
36625
36626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36627         LDKCounterpartyForwardingInfo this_obj_conv;
36628         this_obj_conv.inner = untag_ptr(this_obj);
36629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36631         CounterpartyForwardingInfo_free(this_obj_conv);
36632 }
36633
36634 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36635         LDKCounterpartyForwardingInfo this_ptr_conv;
36636         this_ptr_conv.inner = untag_ptr(this_ptr);
36637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36639         this_ptr_conv.is_owned = false;
36640         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
36641         return ret_conv;
36642 }
36643
36644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36645         LDKCounterpartyForwardingInfo this_ptr_conv;
36646         this_ptr_conv.inner = untag_ptr(this_ptr);
36647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36649         this_ptr_conv.is_owned = false;
36650         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
36651 }
36652
36653 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36654         LDKCounterpartyForwardingInfo this_ptr_conv;
36655         this_ptr_conv.inner = untag_ptr(this_ptr);
36656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36658         this_ptr_conv.is_owned = false;
36659         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
36660         return ret_conv;
36661 }
36662
36663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36664         LDKCounterpartyForwardingInfo this_ptr_conv;
36665         this_ptr_conv.inner = untag_ptr(this_ptr);
36666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36668         this_ptr_conv.is_owned = false;
36669         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
36670 }
36671
36672 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36673         LDKCounterpartyForwardingInfo this_ptr_conv;
36674         this_ptr_conv.inner = untag_ptr(this_ptr);
36675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36677         this_ptr_conv.is_owned = false;
36678         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
36679         return ret_conv;
36680 }
36681
36682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36683         LDKCounterpartyForwardingInfo this_ptr_conv;
36684         this_ptr_conv.inner = untag_ptr(this_ptr);
36685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36687         this_ptr_conv.is_owned = false;
36688         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
36689 }
36690
36691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
36692         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
36693         int64_t ret_ref = 0;
36694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36696         return ret_ref;
36697 }
36698
36699 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
36700         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
36701         int64_t ret_ref = 0;
36702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36704         return ret_ref;
36705 }
36706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36707         LDKCounterpartyForwardingInfo arg_conv;
36708         arg_conv.inner = untag_ptr(arg);
36709         arg_conv.is_owned = ptr_is_owned(arg);
36710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36711         arg_conv.is_owned = false;
36712         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
36713         return ret_conv;
36714 }
36715
36716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36717         LDKCounterpartyForwardingInfo orig_conv;
36718         orig_conv.inner = untag_ptr(orig);
36719         orig_conv.is_owned = ptr_is_owned(orig);
36720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36721         orig_conv.is_owned = false;
36722         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
36723         int64_t ret_ref = 0;
36724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36726         return ret_ref;
36727 }
36728
36729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36730         LDKChannelCounterparty this_obj_conv;
36731         this_obj_conv.inner = untag_ptr(this_obj);
36732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36734         ChannelCounterparty_free(this_obj_conv);
36735 }
36736
36737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36738         LDKChannelCounterparty this_ptr_conv;
36739         this_ptr_conv.inner = untag_ptr(this_ptr);
36740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36742         this_ptr_conv.is_owned = false;
36743         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36744         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
36745         return ret_arr;
36746 }
36747
36748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36749         LDKChannelCounterparty this_ptr_conv;
36750         this_ptr_conv.inner = untag_ptr(this_ptr);
36751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36753         this_ptr_conv.is_owned = false;
36754         LDKPublicKey val_ref;
36755         CHECK((*env)->GetArrayLength(env, val) == 33);
36756         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36757         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
36758 }
36759
36760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
36761         LDKChannelCounterparty this_ptr_conv;
36762         this_ptr_conv.inner = untag_ptr(this_ptr);
36763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36765         this_ptr_conv.is_owned = false;
36766         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
36767         int64_t ret_ref = 0;
36768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36770         return ret_ref;
36771 }
36772
36773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36774         LDKChannelCounterparty this_ptr_conv;
36775         this_ptr_conv.inner = untag_ptr(this_ptr);
36776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36778         this_ptr_conv.is_owned = false;
36779         LDKInitFeatures val_conv;
36780         val_conv.inner = untag_ptr(val);
36781         val_conv.is_owned = ptr_is_owned(val);
36782         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36783         val_conv = InitFeatures_clone(&val_conv);
36784         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
36785 }
36786
36787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
36788         LDKChannelCounterparty this_ptr_conv;
36789         this_ptr_conv.inner = untag_ptr(this_ptr);
36790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36792         this_ptr_conv.is_owned = false;
36793         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
36794         return ret_conv;
36795 }
36796
36797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36798         LDKChannelCounterparty this_ptr_conv;
36799         this_ptr_conv.inner = untag_ptr(this_ptr);
36800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36802         this_ptr_conv.is_owned = false;
36803         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
36804 }
36805
36806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
36807         LDKChannelCounterparty this_ptr_conv;
36808         this_ptr_conv.inner = untag_ptr(this_ptr);
36809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36811         this_ptr_conv.is_owned = false;
36812         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
36813         int64_t ret_ref = 0;
36814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36816         return ret_ref;
36817 }
36818
36819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36820         LDKChannelCounterparty this_ptr_conv;
36821         this_ptr_conv.inner = untag_ptr(this_ptr);
36822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36824         this_ptr_conv.is_owned = false;
36825         LDKCounterpartyForwardingInfo val_conv;
36826         val_conv.inner = untag_ptr(val);
36827         val_conv.is_owned = ptr_is_owned(val);
36828         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36829         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
36830         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
36831 }
36832
36833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36834         LDKChannelCounterparty this_ptr_conv;
36835         this_ptr_conv.inner = untag_ptr(this_ptr);
36836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36838         this_ptr_conv.is_owned = false;
36839         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36840         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
36841         int64_t ret_ref = tag_ptr(ret_copy, true);
36842         return ret_ref;
36843 }
36844
36845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36846         LDKChannelCounterparty this_ptr_conv;
36847         this_ptr_conv.inner = untag_ptr(this_ptr);
36848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36850         this_ptr_conv.is_owned = false;
36851         void* val_ptr = untag_ptr(val);
36852         CHECK_ACCESS(val_ptr);
36853         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36854         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36855         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
36856 }
36857
36858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36859         LDKChannelCounterparty this_ptr_conv;
36860         this_ptr_conv.inner = untag_ptr(this_ptr);
36861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36863         this_ptr_conv.is_owned = false;
36864         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36865         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
36866         int64_t ret_ref = tag_ptr(ret_copy, true);
36867         return ret_ref;
36868 }
36869
36870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36871         LDKChannelCounterparty this_ptr_conv;
36872         this_ptr_conv.inner = untag_ptr(this_ptr);
36873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36875         this_ptr_conv.is_owned = false;
36876         void* val_ptr = untag_ptr(val);
36877         CHECK_ACCESS(val_ptr);
36878         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36879         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36880         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
36881 }
36882
36883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JNIEnv *env, jclass clz, int8_tArray node_id_arg, int64_t features_arg, int64_t unspendable_punishment_reserve_arg, int64_t forwarding_info_arg, int64_t outbound_htlc_minimum_msat_arg, int64_t outbound_htlc_maximum_msat_arg) {
36884         LDKPublicKey node_id_arg_ref;
36885         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
36886         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
36887         LDKInitFeatures features_arg_conv;
36888         features_arg_conv.inner = untag_ptr(features_arg);
36889         features_arg_conv.is_owned = ptr_is_owned(features_arg);
36890         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36891         features_arg_conv = InitFeatures_clone(&features_arg_conv);
36892         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
36893         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
36894         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
36895         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
36896         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
36897         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
36898         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
36899         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
36900         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
36901         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
36902         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
36903         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
36904         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
36905         LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv, outbound_htlc_minimum_msat_arg_conv, outbound_htlc_maximum_msat_arg_conv);
36906         int64_t ret_ref = 0;
36907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36909         return ret_ref;
36910 }
36911
36912 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
36913         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
36914         int64_t ret_ref = 0;
36915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36917         return ret_ref;
36918 }
36919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36920         LDKChannelCounterparty arg_conv;
36921         arg_conv.inner = untag_ptr(arg);
36922         arg_conv.is_owned = ptr_is_owned(arg);
36923         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36924         arg_conv.is_owned = false;
36925         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
36926         return ret_conv;
36927 }
36928
36929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36930         LDKChannelCounterparty orig_conv;
36931         orig_conv.inner = untag_ptr(orig);
36932         orig_conv.is_owned = ptr_is_owned(orig);
36933         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36934         orig_conv.is_owned = false;
36935         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
36936         int64_t ret_ref = 0;
36937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36939         return ret_ref;
36940 }
36941
36942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36943         LDKChannelDetails this_obj_conv;
36944         this_obj_conv.inner = untag_ptr(this_obj);
36945         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36947         ChannelDetails_free(this_obj_conv);
36948 }
36949
36950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36951         LDKChannelDetails this_ptr_conv;
36952         this_ptr_conv.inner = untag_ptr(this_ptr);
36953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36955         this_ptr_conv.is_owned = false;
36956         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36957         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
36958         return ret_arr;
36959 }
36960
36961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36962         LDKChannelDetails this_ptr_conv;
36963         this_ptr_conv.inner = untag_ptr(this_ptr);
36964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36966         this_ptr_conv.is_owned = false;
36967         LDKThirtyTwoBytes val_ref;
36968         CHECK((*env)->GetArrayLength(env, val) == 32);
36969         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36970         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
36971 }
36972
36973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
36974         LDKChannelDetails this_ptr_conv;
36975         this_ptr_conv.inner = untag_ptr(this_ptr);
36976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36978         this_ptr_conv.is_owned = false;
36979         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
36980         int64_t ret_ref = 0;
36981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36983         return ret_ref;
36984 }
36985
36986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36987         LDKChannelDetails this_ptr_conv;
36988         this_ptr_conv.inner = untag_ptr(this_ptr);
36989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36991         this_ptr_conv.is_owned = false;
36992         LDKChannelCounterparty val_conv;
36993         val_conv.inner = untag_ptr(val);
36994         val_conv.is_owned = ptr_is_owned(val);
36995         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36996         val_conv = ChannelCounterparty_clone(&val_conv);
36997         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
36998 }
36999
37000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
37001         LDKChannelDetails this_ptr_conv;
37002         this_ptr_conv.inner = untag_ptr(this_ptr);
37003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37005         this_ptr_conv.is_owned = false;
37006         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
37007         int64_t ret_ref = 0;
37008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37010         return ret_ref;
37011 }
37012
37013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37014         LDKChannelDetails this_ptr_conv;
37015         this_ptr_conv.inner = untag_ptr(this_ptr);
37016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37018         this_ptr_conv.is_owned = false;
37019         LDKOutPoint val_conv;
37020         val_conv.inner = untag_ptr(val);
37021         val_conv.is_owned = ptr_is_owned(val);
37022         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37023         val_conv = OutPoint_clone(&val_conv);
37024         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
37025 }
37026
37027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
37028         LDKChannelDetails this_ptr_conv;
37029         this_ptr_conv.inner = untag_ptr(this_ptr);
37030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37032         this_ptr_conv.is_owned = false;
37033         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
37034         int64_t ret_ref = 0;
37035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37037         return ret_ref;
37038 }
37039
37040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37041         LDKChannelDetails this_ptr_conv;
37042         this_ptr_conv.inner = untag_ptr(this_ptr);
37043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37045         this_ptr_conv.is_owned = false;
37046         LDKChannelTypeFeatures val_conv;
37047         val_conv.inner = untag_ptr(val);
37048         val_conv.is_owned = ptr_is_owned(val);
37049         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37050         val_conv = ChannelTypeFeatures_clone(&val_conv);
37051         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
37052 }
37053
37054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37055         LDKChannelDetails this_ptr_conv;
37056         this_ptr_conv.inner = untag_ptr(this_ptr);
37057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37059         this_ptr_conv.is_owned = false;
37060         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37061         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
37062         int64_t ret_ref = tag_ptr(ret_copy, true);
37063         return ret_ref;
37064 }
37065
37066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37067         LDKChannelDetails this_ptr_conv;
37068         this_ptr_conv.inner = untag_ptr(this_ptr);
37069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37071         this_ptr_conv.is_owned = false;
37072         void* val_ptr = untag_ptr(val);
37073         CHECK_ACCESS(val_ptr);
37074         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37075         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37076         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
37077 }
37078
37079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
37080         LDKChannelDetails this_ptr_conv;
37081         this_ptr_conv.inner = untag_ptr(this_ptr);
37082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37084         this_ptr_conv.is_owned = false;
37085         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37086         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
37087         int64_t ret_ref = tag_ptr(ret_copy, true);
37088         return ret_ref;
37089 }
37090
37091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37092         LDKChannelDetails this_ptr_conv;
37093         this_ptr_conv.inner = untag_ptr(this_ptr);
37094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37096         this_ptr_conv.is_owned = false;
37097         void* val_ptr = untag_ptr(val);
37098         CHECK_ACCESS(val_ptr);
37099         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37100         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37101         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
37102 }
37103
37104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
37105         LDKChannelDetails this_ptr_conv;
37106         this_ptr_conv.inner = untag_ptr(this_ptr);
37107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37109         this_ptr_conv.is_owned = false;
37110         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37111         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
37112         int64_t ret_ref = tag_ptr(ret_copy, true);
37113         return ret_ref;
37114 }
37115
37116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37117         LDKChannelDetails this_ptr_conv;
37118         this_ptr_conv.inner = untag_ptr(this_ptr);
37119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37121         this_ptr_conv.is_owned = false;
37122         void* val_ptr = untag_ptr(val);
37123         CHECK_ACCESS(val_ptr);
37124         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37125         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37126         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
37127 }
37128
37129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
37130         LDKChannelDetails this_ptr_conv;
37131         this_ptr_conv.inner = untag_ptr(this_ptr);
37132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37134         this_ptr_conv.is_owned = false;
37135         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
37136         return ret_conv;
37137 }
37138
37139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37140         LDKChannelDetails this_ptr_conv;
37141         this_ptr_conv.inner = untag_ptr(this_ptr);
37142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37144         this_ptr_conv.is_owned = false;
37145         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
37146 }
37147
37148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
37149         LDKChannelDetails this_ptr_conv;
37150         this_ptr_conv.inner = untag_ptr(this_ptr);
37151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37153         this_ptr_conv.is_owned = false;
37154         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37155         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
37156         int64_t ret_ref = tag_ptr(ret_copy, true);
37157         return ret_ref;
37158 }
37159
37160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37161         LDKChannelDetails this_ptr_conv;
37162         this_ptr_conv.inner = untag_ptr(this_ptr);
37163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37165         this_ptr_conv.is_owned = false;
37166         void* val_ptr = untag_ptr(val);
37167         CHECK_ACCESS(val_ptr);
37168         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37169         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37170         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
37171 }
37172
37173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37174         LDKChannelDetails this_ptr_conv;
37175         this_ptr_conv.inner = untag_ptr(this_ptr);
37176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37178         this_ptr_conv.is_owned = false;
37179         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
37180         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
37181         return ret_arr;
37182 }
37183
37184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37185         LDKChannelDetails this_ptr_conv;
37186         this_ptr_conv.inner = untag_ptr(this_ptr);
37187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37189         this_ptr_conv.is_owned = false;
37190         LDKU128 val_ref;
37191         CHECK((*env)->GetArrayLength(env, val) == 16);
37192         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
37193         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
37194 }
37195
37196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
37197         LDKChannelDetails this_ptr_conv;
37198         this_ptr_conv.inner = untag_ptr(this_ptr);
37199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37201         this_ptr_conv.is_owned = false;
37202         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37203         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
37204         int64_t ret_ref = tag_ptr(ret_copy, true);
37205         return ret_ref;
37206 }
37207
37208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37209         LDKChannelDetails this_ptr_conv;
37210         this_ptr_conv.inner = untag_ptr(this_ptr);
37211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37213         this_ptr_conv.is_owned = false;
37214         void* val_ptr = untag_ptr(val);
37215         CHECK_ACCESS(val_ptr);
37216         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37217         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37218         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
37219 }
37220
37221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37222         LDKChannelDetails this_ptr_conv;
37223         this_ptr_conv.inner = untag_ptr(this_ptr);
37224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37226         this_ptr_conv.is_owned = false;
37227         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
37228         return ret_conv;
37229 }
37230
37231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37232         LDKChannelDetails this_ptr_conv;
37233         this_ptr_conv.inner = untag_ptr(this_ptr);
37234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37236         this_ptr_conv.is_owned = false;
37237         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
37238 }
37239
37240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37241         LDKChannelDetails this_ptr_conv;
37242         this_ptr_conv.inner = untag_ptr(this_ptr);
37243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37245         this_ptr_conv.is_owned = false;
37246         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
37247         return ret_conv;
37248 }
37249
37250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37251         LDKChannelDetails this_ptr_conv;
37252         this_ptr_conv.inner = untag_ptr(this_ptr);
37253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37255         this_ptr_conv.is_owned = false;
37256         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
37257 }
37258
37259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37260         LDKChannelDetails this_ptr_conv;
37261         this_ptr_conv.inner = untag_ptr(this_ptr);
37262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37264         this_ptr_conv.is_owned = false;
37265         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
37266         return ret_conv;
37267 }
37268
37269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37270         LDKChannelDetails this_ptr_conv;
37271         this_ptr_conv.inner = untag_ptr(this_ptr);
37272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37274         this_ptr_conv.is_owned = false;
37275         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
37276 }
37277
37278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37279         LDKChannelDetails this_ptr_conv;
37280         this_ptr_conv.inner = untag_ptr(this_ptr);
37281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37283         this_ptr_conv.is_owned = false;
37284         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
37285         return ret_conv;
37286 }
37287
37288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37289         LDKChannelDetails this_ptr_conv;
37290         this_ptr_conv.inner = untag_ptr(this_ptr);
37291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37293         this_ptr_conv.is_owned = false;
37294         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
37295 }
37296
37297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37298         LDKChannelDetails this_ptr_conv;
37299         this_ptr_conv.inner = untag_ptr(this_ptr);
37300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37302         this_ptr_conv.is_owned = false;
37303         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
37304         return ret_conv;
37305 }
37306
37307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37308         LDKChannelDetails this_ptr_conv;
37309         this_ptr_conv.inner = untag_ptr(this_ptr);
37310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37312         this_ptr_conv.is_owned = false;
37313         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
37314 }
37315
37316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
37317         LDKChannelDetails this_ptr_conv;
37318         this_ptr_conv.inner = untag_ptr(this_ptr);
37319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37321         this_ptr_conv.is_owned = false;
37322         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37323         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
37324         int64_t ret_ref = tag_ptr(ret_copy, true);
37325         return ret_ref;
37326 }
37327
37328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37329         LDKChannelDetails this_ptr_conv;
37330         this_ptr_conv.inner = untag_ptr(this_ptr);
37331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37333         this_ptr_conv.is_owned = false;
37334         void* val_ptr = untag_ptr(val);
37335         CHECK_ACCESS(val_ptr);
37336         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37337         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37338         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
37339 }
37340
37341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
37342         LDKChannelDetails this_ptr_conv;
37343         this_ptr_conv.inner = untag_ptr(this_ptr);
37344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37346         this_ptr_conv.is_owned = false;
37347         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37348         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
37349         int64_t ret_ref = tag_ptr(ret_copy, true);
37350         return ret_ref;
37351 }
37352
37353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37354         LDKChannelDetails this_ptr_conv;
37355         this_ptr_conv.inner = untag_ptr(this_ptr);
37356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37358         this_ptr_conv.is_owned = false;
37359         void* val_ptr = untag_ptr(val);
37360         CHECK_ACCESS(val_ptr);
37361         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37362         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37363         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
37364 }
37365
37366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
37367         LDKChannelDetails this_ptr_conv;
37368         this_ptr_conv.inner = untag_ptr(this_ptr);
37369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37371         this_ptr_conv.is_owned = false;
37372         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
37373         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
37374         int64_t ret_ref = tag_ptr(ret_copy, true);
37375         return ret_ref;
37376 }
37377
37378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37379         LDKChannelDetails this_ptr_conv;
37380         this_ptr_conv.inner = untag_ptr(this_ptr);
37381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37383         this_ptr_conv.is_owned = false;
37384         void* val_ptr = untag_ptr(val);
37385         CHECK_ACCESS(val_ptr);
37386         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
37387         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
37388         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
37389 }
37390
37391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
37392         LDKChannelDetails this_ptr_conv;
37393         this_ptr_conv.inner = untag_ptr(this_ptr);
37394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37396         this_ptr_conv.is_owned = false;
37397         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
37398         return ret_conv;
37399 }
37400
37401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37402         LDKChannelDetails this_ptr_conv;
37403         this_ptr_conv.inner = untag_ptr(this_ptr);
37404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37406         this_ptr_conv.is_owned = false;
37407         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
37408 }
37409
37410 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
37411         LDKChannelDetails this_ptr_conv;
37412         this_ptr_conv.inner = untag_ptr(this_ptr);
37413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37415         this_ptr_conv.is_owned = false;
37416         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
37417         return ret_conv;
37418 }
37419
37420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37421         LDKChannelDetails this_ptr_conv;
37422         this_ptr_conv.inner = untag_ptr(this_ptr);
37423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37425         this_ptr_conv.is_owned = false;
37426         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
37427 }
37428
37429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
37430         LDKChannelDetails this_ptr_conv;
37431         this_ptr_conv.inner = untag_ptr(this_ptr);
37432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37434         this_ptr_conv.is_owned = false;
37435         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
37436         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
37437         int64_t ret_ref = tag_ptr(ret_copy, true);
37438         return ret_ref;
37439 }
37440
37441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37442         LDKChannelDetails this_ptr_conv;
37443         this_ptr_conv.inner = untag_ptr(this_ptr);
37444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37446         this_ptr_conv.is_owned = false;
37447         void* val_ptr = untag_ptr(val);
37448         CHECK_ACCESS(val_ptr);
37449         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
37450         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
37451         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
37452 }
37453
37454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
37455         LDKChannelDetails this_ptr_conv;
37456         this_ptr_conv.inner = untag_ptr(this_ptr);
37457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37459         this_ptr_conv.is_owned = false;
37460         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
37461         return ret_conv;
37462 }
37463
37464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37465         LDKChannelDetails this_ptr_conv;
37466         this_ptr_conv.inner = untag_ptr(this_ptr);
37467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37469         this_ptr_conv.is_owned = false;
37470         ChannelDetails_set_is_usable(&this_ptr_conv, val);
37471 }
37472
37473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
37474         LDKChannelDetails this_ptr_conv;
37475         this_ptr_conv.inner = untag_ptr(this_ptr);
37476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37478         this_ptr_conv.is_owned = false;
37479         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
37480         return ret_conv;
37481 }
37482
37483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37484         LDKChannelDetails this_ptr_conv;
37485         this_ptr_conv.inner = untag_ptr(this_ptr);
37486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37488         this_ptr_conv.is_owned = false;
37489         ChannelDetails_set_is_public(&this_ptr_conv, val);
37490 }
37491
37492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37493         LDKChannelDetails this_ptr_conv;
37494         this_ptr_conv.inner = untag_ptr(this_ptr);
37495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37497         this_ptr_conv.is_owned = false;
37498         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37499         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
37500         int64_t ret_ref = tag_ptr(ret_copy, true);
37501         return ret_ref;
37502 }
37503
37504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37505         LDKChannelDetails this_ptr_conv;
37506         this_ptr_conv.inner = untag_ptr(this_ptr);
37507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37509         this_ptr_conv.is_owned = false;
37510         void* val_ptr = untag_ptr(val);
37511         CHECK_ACCESS(val_ptr);
37512         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37513         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37514         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
37515 }
37516
37517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37518         LDKChannelDetails this_ptr_conv;
37519         this_ptr_conv.inner = untag_ptr(this_ptr);
37520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37522         this_ptr_conv.is_owned = false;
37523         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37524         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
37525         int64_t ret_ref = tag_ptr(ret_copy, true);
37526         return ret_ref;
37527 }
37528
37529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37530         LDKChannelDetails this_ptr_conv;
37531         this_ptr_conv.inner = untag_ptr(this_ptr);
37532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37534         this_ptr_conv.is_owned = false;
37535         void* val_ptr = untag_ptr(val);
37536         CHECK_ACCESS(val_ptr);
37537         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37538         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37539         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
37540 }
37541
37542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
37543         LDKChannelDetails this_ptr_conv;
37544         this_ptr_conv.inner = untag_ptr(this_ptr);
37545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37547         this_ptr_conv.is_owned = false;
37548         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
37549         int64_t ret_ref = 0;
37550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37552         return ret_ref;
37553 }
37554
37555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37556         LDKChannelDetails this_ptr_conv;
37557         this_ptr_conv.inner = untag_ptr(this_ptr);
37558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37560         this_ptr_conv.is_owned = false;
37561         LDKChannelConfig val_conv;
37562         val_conv.inner = untag_ptr(val);
37563         val_conv.is_owned = ptr_is_owned(val);
37564         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37565         val_conv = ChannelConfig_clone(&val_conv);
37566         ChannelDetails_set_config(&this_ptr_conv, val_conv);
37567 }
37568
37569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t outbound_scid_alias_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t feerate_sat_per_1000_weight_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t next_outbound_htlc_minimum_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t confirmations_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, int64_t channel_shutdown_state_arg, jboolean is_usable_arg, jboolean is_public_arg, int64_t inbound_htlc_minimum_msat_arg, int64_t inbound_htlc_maximum_msat_arg, int64_t config_arg) {
37570         LDKThirtyTwoBytes channel_id_arg_ref;
37571         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
37572         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
37573         LDKChannelCounterparty counterparty_arg_conv;
37574         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
37575         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
37576         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
37577         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
37578         LDKOutPoint funding_txo_arg_conv;
37579         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
37580         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
37581         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
37582         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
37583         LDKChannelTypeFeatures channel_type_arg_conv;
37584         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37585         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37586         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37587         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37588         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
37589         CHECK_ACCESS(short_channel_id_arg_ptr);
37590         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
37591         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
37592         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
37593         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
37594         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
37595         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
37596         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
37597         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
37598         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
37599         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
37600         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
37601         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
37602         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
37603         LDKU128 user_channel_id_arg_ref;
37604         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
37605         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
37606         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
37607         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
37608         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
37609         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
37610         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
37611         CHECK_ACCESS(confirmations_required_arg_ptr);
37612         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
37613         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
37614         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
37615         CHECK_ACCESS(confirmations_arg_ptr);
37616         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
37617         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
37618         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
37619         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
37620         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
37621         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
37622         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
37623         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
37624         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
37625         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
37626         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
37627         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
37628         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
37629         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
37630         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
37631         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
37632         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
37633         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
37634         LDKChannelConfig config_arg_conv;
37635         config_arg_conv.inner = untag_ptr(config_arg);
37636         config_arg_conv.is_owned = ptr_is_owned(config_arg);
37637         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
37638         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
37639         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, feerate_sat_per_1000_weight_arg_conv, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, channel_shutdown_state_arg_conv, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
37640         int64_t ret_ref = 0;
37641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37643         return ret_ref;
37644 }
37645
37646 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
37647         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
37648         int64_t ret_ref = 0;
37649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37651         return ret_ref;
37652 }
37653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37654         LDKChannelDetails arg_conv;
37655         arg_conv.inner = untag_ptr(arg);
37656         arg_conv.is_owned = ptr_is_owned(arg);
37657         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37658         arg_conv.is_owned = false;
37659         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
37660         return ret_conv;
37661 }
37662
37663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37664         LDKChannelDetails orig_conv;
37665         orig_conv.inner = untag_ptr(orig);
37666         orig_conv.is_owned = ptr_is_owned(orig);
37667         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37668         orig_conv.is_owned = false;
37669         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
37670         int64_t ret_ref = 0;
37671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37673         return ret_ref;
37674 }
37675
37676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
37677         LDKChannelDetails this_arg_conv;
37678         this_arg_conv.inner = untag_ptr(this_arg);
37679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37681         this_arg_conv.is_owned = false;
37682         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37683         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
37684         int64_t ret_ref = tag_ptr(ret_copy, true);
37685         return ret_ref;
37686 }
37687
37688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
37689         LDKChannelDetails this_arg_conv;
37690         this_arg_conv.inner = untag_ptr(this_arg);
37691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37693         this_arg_conv.is_owned = false;
37694         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37695         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
37696         int64_t ret_ref = tag_ptr(ret_copy, true);
37697         return ret_ref;
37698 }
37699
37700 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37701         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
37702         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
37703         return ret_conv;
37704 }
37705
37706 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
37707         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
37708         return ret_conv;
37709 }
37710
37711 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
37712         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
37713         return ret_conv;
37714 }
37715
37716 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
37717         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
37718         return ret_conv;
37719 }
37720
37721 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
37722         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
37723         return ret_conv;
37724 }
37725
37726 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
37727         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
37728         return ret_conv;
37729 }
37730
37731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37732         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
37733         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
37734         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
37735         return ret_conv;
37736 }
37737
37738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37739         if (!ptr_is_owned(this_ptr)) return;
37740         void* this_ptr_ptr = untag_ptr(this_ptr);
37741         CHECK_ACCESS(this_ptr_ptr);
37742         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
37743         FREE(untag_ptr(this_ptr));
37744         RecentPaymentDetails_free(this_ptr_conv);
37745 }
37746
37747 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
37748         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37749         *ret_copy = RecentPaymentDetails_clone(arg);
37750         int64_t ret_ref = tag_ptr(ret_copy, true);
37751         return ret_ref;
37752 }
37753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37754         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
37755         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
37756         return ret_conv;
37757 }
37758
37759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37760         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
37761         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37762         *ret_copy = RecentPaymentDetails_clone(orig_conv);
37763         int64_t ret_ref = tag_ptr(ret_copy, true);
37764         return ret_ref;
37765 }
37766
37767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1pending(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t total_msat) {
37768         LDKThirtyTwoBytes payment_hash_ref;
37769         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37770         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37771         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37772         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
37773         int64_t ret_ref = tag_ptr(ret_copy, true);
37774         return ret_ref;
37775 }
37776
37777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int64_t payment_hash) {
37778         void* payment_hash_ptr = untag_ptr(payment_hash);
37779         CHECK_ACCESS(payment_hash_ptr);
37780         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
37781         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
37782         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37783         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_conv);
37784         int64_t ret_ref = tag_ptr(ret_copy, true);
37785         return ret_ref;
37786 }
37787
37788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
37789         LDKThirtyTwoBytes payment_hash_ref;
37790         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37791         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37792         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37793         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
37794         int64_t ret_ref = tag_ptr(ret_copy, true);
37795         return ret_ref;
37796 }
37797
37798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37799         LDKPhantomRouteHints this_obj_conv;
37800         this_obj_conv.inner = untag_ptr(this_obj);
37801         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37803         PhantomRouteHints_free(this_obj_conv);
37804 }
37805
37806 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
37807         LDKPhantomRouteHints this_ptr_conv;
37808         this_ptr_conv.inner = untag_ptr(this_ptr);
37809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37811         this_ptr_conv.is_owned = false;
37812         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
37813         int64_tArray ret_arr = NULL;
37814         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37815         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37816         for (size_t q = 0; q < ret_var.datalen; q++) {
37817                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
37818                 int64_t ret_conv_16_ref = 0;
37819                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
37820                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
37821                 ret_arr_ptr[q] = ret_conv_16_ref;
37822         }
37823         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37824         FREE(ret_var.data);
37825         return ret_arr;
37826 }
37827
37828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37829         LDKPhantomRouteHints this_ptr_conv;
37830         this_ptr_conv.inner = untag_ptr(this_ptr);
37831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37833         this_ptr_conv.is_owned = false;
37834         LDKCVec_ChannelDetailsZ val_constr;
37835         val_constr.datalen = (*env)->GetArrayLength(env, val);
37836         if (val_constr.datalen > 0)
37837                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37838         else
37839                 val_constr.data = NULL;
37840         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37841         for (size_t q = 0; q < val_constr.datalen; q++) {
37842                 int64_t val_conv_16 = val_vals[q];
37843                 LDKChannelDetails val_conv_16_conv;
37844                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
37845                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
37846                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
37847                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
37848                 val_constr.data[q] = val_conv_16_conv;
37849         }
37850         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37851         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
37852 }
37853
37854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
37855         LDKPhantomRouteHints this_ptr_conv;
37856         this_ptr_conv.inner = untag_ptr(this_ptr);
37857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37859         this_ptr_conv.is_owned = false;
37860         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
37861         return ret_conv;
37862 }
37863
37864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37865         LDKPhantomRouteHints this_ptr_conv;
37866         this_ptr_conv.inner = untag_ptr(this_ptr);
37867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37869         this_ptr_conv.is_owned = false;
37870         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
37871 }
37872
37873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37874         LDKPhantomRouteHints this_ptr_conv;
37875         this_ptr_conv.inner = untag_ptr(this_ptr);
37876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37878         this_ptr_conv.is_owned = false;
37879         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37880         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
37881         return ret_arr;
37882 }
37883
37884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37885         LDKPhantomRouteHints this_ptr_conv;
37886         this_ptr_conv.inner = untag_ptr(this_ptr);
37887         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37889         this_ptr_conv.is_owned = false;
37890         LDKPublicKey val_ref;
37891         CHECK((*env)->GetArrayLength(env, val) == 33);
37892         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37893         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
37894 }
37895
37896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
37897         LDKCVec_ChannelDetailsZ channels_arg_constr;
37898         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
37899         if (channels_arg_constr.datalen > 0)
37900                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37901         else
37902                 channels_arg_constr.data = NULL;
37903         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
37904         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
37905                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
37906                 LDKChannelDetails channels_arg_conv_16_conv;
37907                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
37908                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
37909                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
37910                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
37911                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
37912         }
37913         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
37914         LDKPublicKey real_node_pubkey_arg_ref;
37915         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
37916         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
37917         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
37918         int64_t ret_ref = 0;
37919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37921         return ret_ref;
37922 }
37923
37924 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
37925         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
37926         int64_t ret_ref = 0;
37927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37929         return ret_ref;
37930 }
37931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37932         LDKPhantomRouteHints arg_conv;
37933         arg_conv.inner = untag_ptr(arg);
37934         arg_conv.is_owned = ptr_is_owned(arg);
37935         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37936         arg_conv.is_owned = false;
37937         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
37938         return ret_conv;
37939 }
37940
37941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37942         LDKPhantomRouteHints orig_conv;
37943         orig_conv.inner = untag_ptr(orig);
37944         orig_conv.is_owned = ptr_is_owned(orig);
37945         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37946         orig_conv.is_owned = false;
37947         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
37948         int64_t ret_ref = 0;
37949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37951         return ret_ref;
37952 }
37953
37954 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 router, int64_t logger, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t config, int64_t params, int32_t current_timestamp) {
37955         void* fee_est_ptr = untag_ptr(fee_est);
37956         CHECK_ACCESS(fee_est_ptr);
37957         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
37958         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
37959                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37960                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
37961         }
37962         void* chain_monitor_ptr = untag_ptr(chain_monitor);
37963         CHECK_ACCESS(chain_monitor_ptr);
37964         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
37965         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
37966                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37967                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
37968         }
37969         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
37970         CHECK_ACCESS(tx_broadcaster_ptr);
37971         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
37972         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
37973                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37974                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
37975         }
37976         void* router_ptr = untag_ptr(router);
37977         CHECK_ACCESS(router_ptr);
37978         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
37979         if (router_conv.free == LDKRouter_JCalls_free) {
37980                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37981                 LDKRouter_JCalls_cloned(&router_conv);
37982         }
37983         void* logger_ptr = untag_ptr(logger);
37984         CHECK_ACCESS(logger_ptr);
37985         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37986         if (logger_conv.free == LDKLogger_JCalls_free) {
37987                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37988                 LDKLogger_JCalls_cloned(&logger_conv);
37989         }
37990         void* entropy_source_ptr = untag_ptr(entropy_source);
37991         CHECK_ACCESS(entropy_source_ptr);
37992         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
37993         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
37994                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37995                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
37996         }
37997         void* node_signer_ptr = untag_ptr(node_signer);
37998         CHECK_ACCESS(node_signer_ptr);
37999         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
38000         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
38001                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38002                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
38003         }
38004         void* signer_provider_ptr = untag_ptr(signer_provider);
38005         CHECK_ACCESS(signer_provider_ptr);
38006         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
38007         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
38008                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38009                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
38010         }
38011         LDKUserConfig config_conv;
38012         config_conv.inner = untag_ptr(config);
38013         config_conv.is_owned = ptr_is_owned(config);
38014         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38015         config_conv = UserConfig_clone(&config_conv);
38016         LDKChainParameters params_conv;
38017         params_conv.inner = untag_ptr(params);
38018         params_conv.is_owned = ptr_is_owned(params);
38019         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38020         params_conv = ChainParameters_clone(&params_conv);
38021         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, entropy_source_conv, node_signer_conv, signer_provider_conv, config_conv, params_conv, current_timestamp);
38022         int64_t ret_ref = 0;
38023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38025         return ret_ref;
38026 }
38027
38028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
38029         LDKChannelManager this_arg_conv;
38030         this_arg_conv.inner = untag_ptr(this_arg);
38031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38033         this_arg_conv.is_owned = false;
38034         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
38035         int64_t ret_ref = 0;
38036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38038         return ret_ref;
38039 }
38040
38041 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, int8_tArray user_channel_id, int64_t override_config) {
38042         LDKChannelManager this_arg_conv;
38043         this_arg_conv.inner = untag_ptr(this_arg);
38044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38046         this_arg_conv.is_owned = false;
38047         LDKPublicKey their_network_key_ref;
38048         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
38049         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
38050         LDKU128 user_channel_id_ref;
38051         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
38052         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
38053         LDKUserConfig override_config_conv;
38054         override_config_conv.inner = untag_ptr(override_config);
38055         override_config_conv.is_owned = ptr_is_owned(override_config);
38056         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
38057         override_config_conv = UserConfig_clone(&override_config_conv);
38058         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
38059         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
38060         return tag_ptr(ret_conv, true);
38061 }
38062
38063 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
38064         LDKChannelManager this_arg_conv;
38065         this_arg_conv.inner = untag_ptr(this_arg);
38066         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38068         this_arg_conv.is_owned = false;
38069         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
38070         int64_tArray ret_arr = NULL;
38071         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38072         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38073         for (size_t q = 0; q < ret_var.datalen; q++) {
38074                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38075                 int64_t ret_conv_16_ref = 0;
38076                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38077                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38078                 ret_arr_ptr[q] = ret_conv_16_ref;
38079         }
38080         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38081         FREE(ret_var.data);
38082         return ret_arr;
38083 }
38084
38085 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
38086         LDKChannelManager this_arg_conv;
38087         this_arg_conv.inner = untag_ptr(this_arg);
38088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38090         this_arg_conv.is_owned = false;
38091         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
38092         int64_tArray ret_arr = NULL;
38093         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38094         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38095         for (size_t q = 0; q < ret_var.datalen; q++) {
38096                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38097                 int64_t ret_conv_16_ref = 0;
38098                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38099                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38100                 ret_arr_ptr[q] = ret_conv_16_ref;
38101         }
38102         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38103         FREE(ret_var.data);
38104         return ret_arr;
38105 }
38106
38107 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels_1with_1counterparty(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id) {
38108         LDKChannelManager this_arg_conv;
38109         this_arg_conv.inner = untag_ptr(this_arg);
38110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38112         this_arg_conv.is_owned = false;
38113         LDKPublicKey counterparty_node_id_ref;
38114         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38115         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38116         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
38117         int64_tArray ret_arr = NULL;
38118         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38119         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38120         for (size_t q = 0; q < ret_var.datalen; q++) {
38121                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38122                 int64_t ret_conv_16_ref = 0;
38123                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38124                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38125                 ret_arr_ptr[q] = ret_conv_16_ref;
38126         }
38127         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38128         FREE(ret_var.data);
38129         return ret_arr;
38130 }
38131
38132 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
38133         LDKChannelManager this_arg_conv;
38134         this_arg_conv.inner = untag_ptr(this_arg);
38135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38137         this_arg_conv.is_owned = false;
38138         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
38139         int64_tArray ret_arr = NULL;
38140         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38141         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38142         for (size_t w = 0; w < ret_var.datalen; w++) {
38143                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38144                 *ret_conv_22_copy = ret_var.data[w];
38145                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
38146                 ret_arr_ptr[w] = ret_conv_22_ref;
38147         }
38148         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38149         FREE(ret_var.data);
38150         return ret_arr;
38151 }
38152
38153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
38154         LDKChannelManager this_arg_conv;
38155         this_arg_conv.inner = untag_ptr(this_arg);
38156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38158         this_arg_conv.is_owned = false;
38159         uint8_t channel_id_arr[32];
38160         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
38161         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
38162         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38163         LDKPublicKey counterparty_node_id_ref;
38164         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38165         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38166         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38167         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38168         return tag_ptr(ret_conv, true);
38169 }
38170
38171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1feerate_1and_1script(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
38172         LDKChannelManager this_arg_conv;
38173         this_arg_conv.inner = untag_ptr(this_arg);
38174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38176         this_arg_conv.is_owned = false;
38177         uint8_t channel_id_arr[32];
38178         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
38179         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
38180         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38181         LDKPublicKey counterparty_node_id_ref;
38182         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38183         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38184         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
38185         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
38186         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
38187         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
38188         LDKShutdownScript shutdown_script_conv;
38189         shutdown_script_conv.inner = untag_ptr(shutdown_script);
38190         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
38191         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
38192         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
38193         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38194         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
38195         return tag_ptr(ret_conv, true);
38196 }
38197
38198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
38199         LDKChannelManager this_arg_conv;
38200         this_arg_conv.inner = untag_ptr(this_arg);
38201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38203         this_arg_conv.is_owned = false;
38204         uint8_t channel_id_arr[32];
38205         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
38206         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
38207         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38208         LDKPublicKey counterparty_node_id_ref;
38209         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38210         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38211         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38212         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38213         return tag_ptr(ret_conv, true);
38214 }
38215
38216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_id) {
38217         LDKChannelManager this_arg_conv;
38218         this_arg_conv.inner = untag_ptr(this_arg);
38219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38221         this_arg_conv.is_owned = false;
38222         uint8_t channel_id_arr[32];
38223         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
38224         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
38225         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38226         LDKPublicKey counterparty_node_id_ref;
38227         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38228         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38229         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38230         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38231         return tag_ptr(ret_conv, true);
38232 }
38233
38234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
38235         LDKChannelManager this_arg_conv;
38236         this_arg_conv.inner = untag_ptr(this_arg);
38237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38239         this_arg_conv.is_owned = false;
38240         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
38241 }
38242
38243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
38244         LDKChannelManager this_arg_conv;
38245         this_arg_conv.inner = untag_ptr(this_arg);
38246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38248         this_arg_conv.is_owned = false;
38249         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
38250 }
38251
38252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment_1with_1route(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id) {
38253         LDKChannelManager this_arg_conv;
38254         this_arg_conv.inner = untag_ptr(this_arg);
38255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38257         this_arg_conv.is_owned = false;
38258         LDKRoute route_conv;
38259         route_conv.inner = untag_ptr(route);
38260         route_conv.is_owned = ptr_is_owned(route);
38261         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38262         route_conv.is_owned = false;
38263         LDKThirtyTwoBytes payment_hash_ref;
38264         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38265         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38266         LDKRecipientOnionFields recipient_onion_conv;
38267         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38268         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38269         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38270         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38271         LDKThirtyTwoBytes payment_id_ref;
38272         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38273         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38274         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
38275         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
38276         return tag_ptr(ret_conv, true);
38277 }
38278
38279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
38280         LDKChannelManager this_arg_conv;
38281         this_arg_conv.inner = untag_ptr(this_arg);
38282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38284         this_arg_conv.is_owned = false;
38285         LDKThirtyTwoBytes payment_hash_ref;
38286         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38287         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38288         LDKRecipientOnionFields recipient_onion_conv;
38289         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38290         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38291         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38292         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38293         LDKThirtyTwoBytes payment_id_ref;
38294         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38295         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38296         LDKRouteParameters route_params_conv;
38297         route_params_conv.inner = untag_ptr(route_params);
38298         route_params_conv.is_owned = ptr_is_owned(route_params);
38299         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38300         route_params_conv = RouteParameters_clone(&route_params_conv);
38301         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38302         CHECK_ACCESS(retry_strategy_ptr);
38303         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38304         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38305         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
38306         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
38307         return tag_ptr(ret_conv, true);
38308 }
38309
38310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
38311         LDKChannelManager this_arg_conv;
38312         this_arg_conv.inner = untag_ptr(this_arg);
38313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38315         this_arg_conv.is_owned = false;
38316         LDKThirtyTwoBytes payment_id_ref;
38317         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38318         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38319         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
38320 }
38321
38322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id) {
38323         LDKChannelManager this_arg_conv;
38324         this_arg_conv.inner = untag_ptr(this_arg);
38325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38327         this_arg_conv.is_owned = false;
38328         LDKRoute route_conv;
38329         route_conv.inner = untag_ptr(route);
38330         route_conv.is_owned = ptr_is_owned(route);
38331         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38332         route_conv.is_owned = false;
38333         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38334         CHECK_ACCESS(payment_preimage_ptr);
38335         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
38336         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
38337         LDKRecipientOnionFields recipient_onion_conv;
38338         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38339         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38340         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38341         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38342         LDKThirtyTwoBytes payment_id_ref;
38343         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38344         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38345         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
38346         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
38347         return tag_ptr(ret_conv, true);
38348 }
38349
38350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment_1with_1retry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t payment_preimage, int64_t recipient_onion, int8_tArray payment_id, int64_t route_params, int64_t retry_strategy) {
38351         LDKChannelManager this_arg_conv;
38352         this_arg_conv.inner = untag_ptr(this_arg);
38353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38355         this_arg_conv.is_owned = false;
38356         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38357         CHECK_ACCESS(payment_preimage_ptr);
38358         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
38359         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
38360         LDKRecipientOnionFields recipient_onion_conv;
38361         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38362         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38363         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38364         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38365         LDKThirtyTwoBytes payment_id_ref;
38366         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38367         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38368         LDKRouteParameters route_params_conv;
38369         route_params_conv.inner = untag_ptr(route_params);
38370         route_params_conv.is_owned = ptr_is_owned(route_params);
38371         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38372         route_params_conv = RouteParameters_clone(&route_params_conv);
38373         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38374         CHECK_ACCESS(retry_strategy_ptr);
38375         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38376         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38377         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
38378         *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
38379         return tag_ptr(ret_conv, true);
38380 }
38381
38382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
38383         LDKChannelManager this_arg_conv;
38384         this_arg_conv.inner = untag_ptr(this_arg);
38385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38387         this_arg_conv.is_owned = false;
38388         LDKPath path_conv;
38389         path_conv.inner = untag_ptr(path);
38390         path_conv.is_owned = ptr_is_owned(path);
38391         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
38392         path_conv = Path_clone(&path_conv);
38393         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
38394         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
38395         return tag_ptr(ret_conv, true);
38396 }
38397
38398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
38399         LDKChannelManager this_arg_conv;
38400         this_arg_conv.inner = untag_ptr(this_arg);
38401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38403         this_arg_conv.is_owned = false;
38404         uint8_t temporary_channel_id_arr[32];
38405         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
38406         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
38407         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38408         LDKPublicKey counterparty_node_id_ref;
38409         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38410         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38411         LDKTransaction funding_transaction_ref;
38412         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
38413         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38414         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
38415         funding_transaction_ref.data_is_owned = true;
38416         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38417         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
38418         return tag_ptr(ret_conv, true);
38419 }
38420
38421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1partial_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config_update) {
38422         LDKChannelManager this_arg_conv;
38423         this_arg_conv.inner = untag_ptr(this_arg);
38424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38426         this_arg_conv.is_owned = false;
38427         LDKPublicKey counterparty_node_id_ref;
38428         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38429         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38430         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38431         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
38432         if (channel_ids_constr.datalen > 0)
38433                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38434         else
38435                 channel_ids_constr.data = NULL;
38436         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
38437                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
38438                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
38439                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
38440                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
38441                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
38442         }
38443         LDKChannelConfigUpdate config_update_conv;
38444         config_update_conv.inner = untag_ptr(config_update);
38445         config_update_conv.is_owned = ptr_is_owned(config_update);
38446         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
38447         config_update_conv.is_owned = false;
38448         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38449         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
38450         return tag_ptr(ret_conv, true);
38451 }
38452
38453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, jobjectArray channel_ids, int64_t config) {
38454         LDKChannelManager this_arg_conv;
38455         this_arg_conv.inner = untag_ptr(this_arg);
38456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38458         this_arg_conv.is_owned = false;
38459         LDKPublicKey counterparty_node_id_ref;
38460         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38461         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38462         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38463         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
38464         if (channel_ids_constr.datalen > 0)
38465                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38466         else
38467                 channel_ids_constr.data = NULL;
38468         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
38469                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
38470                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
38471                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
38472                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
38473                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
38474         }
38475         LDKChannelConfig config_conv;
38476         config_conv.inner = untag_ptr(config);
38477         config_conv.is_owned = ptr_is_owned(config);
38478         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38479         config_conv.is_owned = false;
38480         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38481         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
38482         return tag_ptr(ret_conv, true);
38483 }
38484
38485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
38486         LDKChannelManager this_arg_conv;
38487         this_arg_conv.inner = untag_ptr(this_arg);
38488         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38490         this_arg_conv.is_owned = false;
38491         LDKThirtyTwoBytes intercept_id_ref;
38492         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
38493         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
38494         uint8_t next_hop_channel_id_arr[32];
38495         CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32);
38496         (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr);
38497         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
38498         LDKPublicKey next_node_id_ref;
38499         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
38500         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
38501         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38502         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, next_node_id_ref, amt_to_forward_msat);
38503         return tag_ptr(ret_conv, true);
38504 }
38505
38506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id) {
38507         LDKChannelManager this_arg_conv;
38508         this_arg_conv.inner = untag_ptr(this_arg);
38509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38511         this_arg_conv.is_owned = false;
38512         LDKThirtyTwoBytes intercept_id_ref;
38513         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
38514         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
38515         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38516         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
38517         return tag_ptr(ret_conv, true);
38518 }
38519
38520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
38521         LDKChannelManager this_arg_conv;
38522         this_arg_conv.inner = untag_ptr(this_arg);
38523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38525         this_arg_conv.is_owned = false;
38526         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
38527 }
38528
38529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
38530         LDKChannelManager this_arg_conv;
38531         this_arg_conv.inner = untag_ptr(this_arg);
38532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38534         this_arg_conv.is_owned = false;
38535         ChannelManager_timer_tick_occurred(&this_arg_conv);
38536 }
38537
38538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
38539         LDKChannelManager this_arg_conv;
38540         this_arg_conv.inner = untag_ptr(this_arg);
38541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38543         this_arg_conv.is_owned = false;
38544         uint8_t payment_hash_arr[32];
38545         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38546         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
38547         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
38548         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
38549 }
38550
38551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards_1with_1reason(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, jclass failure_code) {
38552         LDKChannelManager this_arg_conv;
38553         this_arg_conv.inner = untag_ptr(this_arg);
38554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38556         this_arg_conv.is_owned = false;
38557         uint8_t payment_hash_arr[32];
38558         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38559         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
38560         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
38561         LDKFailureCode failure_code_conv = LDKFailureCode_from_java(env, failure_code);
38562         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
38563 }
38564
38565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
38566         LDKChannelManager this_arg_conv;
38567         this_arg_conv.inner = untag_ptr(this_arg);
38568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38570         this_arg_conv.is_owned = false;
38571         LDKThirtyTwoBytes payment_preimage_ref;
38572         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
38573         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
38574         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
38575 }
38576
38577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
38578         LDKChannelManager this_arg_conv;
38579         this_arg_conv.inner = untag_ptr(this_arg);
38580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38582         this_arg_conv.is_owned = false;
38583         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38584         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
38585         return ret_arr;
38586 }
38587
38588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
38589         LDKChannelManager this_arg_conv;
38590         this_arg_conv.inner = untag_ptr(this_arg);
38591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38593         this_arg_conv.is_owned = false;
38594         uint8_t temporary_channel_id_arr[32];
38595         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
38596         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
38597         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38598         LDKPublicKey counterparty_node_id_ref;
38599         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38600         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38601         LDKU128 user_channel_id_ref;
38602         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
38603         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
38604         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38605         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
38606         return tag_ptr(ret_conv, true);
38607 }
38608
38609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel_1from_1trusted_1peer_10conf(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
38610         LDKChannelManager this_arg_conv;
38611         this_arg_conv.inner = untag_ptr(this_arg);
38612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38614         this_arg_conv.is_owned = false;
38615         uint8_t temporary_channel_id_arr[32];
38616         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
38617         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
38618         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38619         LDKPublicKey counterparty_node_id_ref;
38620         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38621         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38622         LDKU128 user_channel_id_ref;
38623         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
38624         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
38625         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38626         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
38627         return tag_ptr(ret_conv, true);
38628 }
38629
38630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
38631         LDKChannelManager this_arg_conv;
38632         this_arg_conv.inner = untag_ptr(this_arg);
38633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38635         this_arg_conv.is_owned = false;
38636         void* min_value_msat_ptr = untag_ptr(min_value_msat);
38637         CHECK_ACCESS(min_value_msat_ptr);
38638         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
38639         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
38640         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
38641         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
38642         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
38643         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
38644         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
38645         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
38646         return tag_ptr(ret_conv, true);
38647 }
38648
38649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry) {
38650         LDKChannelManager this_arg_conv;
38651         this_arg_conv.inner = untag_ptr(this_arg);
38652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38654         this_arg_conv.is_owned = false;
38655         LDKThirtyTwoBytes payment_hash_ref;
38656         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38657         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38658         void* min_value_msat_ptr = untag_ptr(min_value_msat);
38659         CHECK_ACCESS(min_value_msat_ptr);
38660         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
38661         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
38662         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
38663         CHECK_ACCESS(min_final_cltv_expiry_ptr);
38664         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
38665         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
38666         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
38667         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_conv);
38668         return tag_ptr(ret_conv, true);
38669 }
38670
38671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
38672         LDKChannelManager this_arg_conv;
38673         this_arg_conv.inner = untag_ptr(this_arg);
38674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38676         this_arg_conv.is_owned = false;
38677         LDKThirtyTwoBytes payment_hash_ref;
38678         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38679         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38680         LDKThirtyTwoBytes payment_secret_ref;
38681         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
38682         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
38683         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
38684         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
38685         return tag_ptr(ret_conv, true);
38686 }
38687
38688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
38689         LDKChannelManager this_arg_conv;
38690         this_arg_conv.inner = untag_ptr(this_arg);
38691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38693         this_arg_conv.is_owned = false;
38694         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
38695         return ret_conv;
38696 }
38697
38698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
38699         LDKChannelManager this_arg_conv;
38700         this_arg_conv.inner = untag_ptr(this_arg);
38701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38703         this_arg_conv.is_owned = false;
38704         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
38705         int64_t ret_ref = 0;
38706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38708         return ret_ref;
38709 }
38710
38711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
38712         LDKChannelManager this_arg_conv;
38713         this_arg_conv.inner = untag_ptr(this_arg);
38714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38716         this_arg_conv.is_owned = false;
38717         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
38718         return ret_conv;
38719 }
38720
38721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
38722         LDKChannelManager this_arg_conv;
38723         this_arg_conv.inner = untag_ptr(this_arg);
38724         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38726         this_arg_conv.is_owned = false;
38727         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
38728         int64_t ret_ref = 0;
38729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38731         return ret_ref;
38732 }
38733
38734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38735         LDKChannelManager this_arg_conv;
38736         this_arg_conv.inner = untag_ptr(this_arg);
38737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38739         this_arg_conv.is_owned = false;
38740         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38741         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
38742         return tag_ptr(ret_ret, true);
38743 }
38744
38745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38746         LDKChannelManager this_arg_conv;
38747         this_arg_conv.inner = untag_ptr(this_arg);
38748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38750         this_arg_conv.is_owned = false;
38751         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
38752         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
38753         return tag_ptr(ret_ret, true);
38754 }
38755
38756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
38757         LDKChannelManager this_arg_conv;
38758         this_arg_conv.inner = untag_ptr(this_arg);
38759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38761         this_arg_conv.is_owned = false;
38762         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
38763         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
38764         return tag_ptr(ret_ret, true);
38765 }
38766
38767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
38768         LDKChannelManager this_arg_conv;
38769         this_arg_conv.inner = untag_ptr(this_arg);
38770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38772         this_arg_conv.is_owned = false;
38773         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
38774         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
38775         return tag_ptr(ret_ret, true);
38776 }
38777
38778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1persistable_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
38779         LDKChannelManager this_arg_conv;
38780         this_arg_conv.inner = untag_ptr(this_arg);
38781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38783         this_arg_conv.is_owned = false;
38784         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
38785         int64_t ret_ref = 0;
38786         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38787         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38788         return ret_ref;
38789 }
38790
38791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
38792         LDKChannelManager this_arg_conv;
38793         this_arg_conv.inner = untag_ptr(this_arg);
38794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38796         this_arg_conv.is_owned = false;
38797         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
38798         int64_t ret_ref = 0;
38799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38801         return ret_ref;
38802 }
38803
38804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
38805         LDKChannelManager this_arg_conv;
38806         this_arg_conv.inner = untag_ptr(this_arg);
38807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38809         this_arg_conv.is_owned = false;
38810         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
38811         int64_t ret_ref = 0;
38812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38814         return ret_ref;
38815 }
38816
38817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
38818         LDKChannelManager this_arg_conv;
38819         this_arg_conv.inner = untag_ptr(this_arg);
38820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38822         this_arg_conv.is_owned = false;
38823         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
38824         int64_t ret_ref = 0;
38825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38827         return ret_ref;
38828 }
38829
38830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
38831         LDKChannelManager this_arg_conv;
38832         this_arg_conv.inner = untag_ptr(this_arg);
38833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38835         this_arg_conv.is_owned = false;
38836         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
38837         int64_t ret_ref = 0;
38838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38840         return ret_ref;
38841 }
38842
38843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
38844         LDKChannelManager this_arg_conv;
38845         this_arg_conv.inner = untag_ptr(this_arg);
38846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38848         this_arg_conv.is_owned = false;
38849         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
38850         int64_t ret_ref = 0;
38851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38853         return ret_ref;
38854 }
38855
38856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38857         LDKChannelManager this_arg_conv;
38858         this_arg_conv.inner = untag_ptr(this_arg);
38859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38861         this_arg_conv.is_owned = false;
38862         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
38863         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
38864         return tag_ptr(ret_ret, true);
38865 }
38866
38867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
38868         LDKUserConfig config_conv;
38869         config_conv.inner = untag_ptr(config);
38870         config_conv.is_owned = ptr_is_owned(config);
38871         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38872         config_conv.is_owned = false;
38873         LDKInitFeatures ret_var = provided_init_features(&config_conv);
38874         int64_t ret_ref = 0;
38875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38877         return ret_ref;
38878 }
38879
38880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
38881         LDKCounterpartyForwardingInfo obj_conv;
38882         obj_conv.inner = untag_ptr(obj);
38883         obj_conv.is_owned = ptr_is_owned(obj);
38884         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38885         obj_conv.is_owned = false;
38886         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
38887         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38888         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38889         CVec_u8Z_free(ret_var);
38890         return ret_arr;
38891 }
38892
38893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38894         LDKu8slice ser_ref;
38895         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38896         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38897         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
38898         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
38899         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38900         return tag_ptr(ret_conv, true);
38901 }
38902
38903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
38904         LDKChannelCounterparty obj_conv;
38905         obj_conv.inner = untag_ptr(obj);
38906         obj_conv.is_owned = ptr_is_owned(obj);
38907         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38908         obj_conv.is_owned = false;
38909         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
38910         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38911         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38912         CVec_u8Z_free(ret_var);
38913         return ret_arr;
38914 }
38915
38916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38917         LDKu8slice ser_ref;
38918         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38919         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38920         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
38921         *ret_conv = ChannelCounterparty_read(ser_ref);
38922         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38923         return tag_ptr(ret_conv, true);
38924 }
38925
38926 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
38927         LDKChannelDetails obj_conv;
38928         obj_conv.inner = untag_ptr(obj);
38929         obj_conv.is_owned = ptr_is_owned(obj);
38930         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38931         obj_conv.is_owned = false;
38932         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
38933         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38934         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38935         CVec_u8Z_free(ret_var);
38936         return ret_arr;
38937 }
38938
38939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38940         LDKu8slice ser_ref;
38941         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38942         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38943         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
38944         *ret_conv = ChannelDetails_read(ser_ref);
38945         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38946         return tag_ptr(ret_conv, true);
38947 }
38948
38949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
38950         LDKPhantomRouteHints obj_conv;
38951         obj_conv.inner = untag_ptr(obj);
38952         obj_conv.is_owned = ptr_is_owned(obj);
38953         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38954         obj_conv.is_owned = false;
38955         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
38956         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38957         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38958         CVec_u8Z_free(ret_var);
38959         return ret_arr;
38960 }
38961
38962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38963         LDKu8slice ser_ref;
38964         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38965         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38966         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
38967         *ret_conv = PhantomRouteHints_read(ser_ref);
38968         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38969         return tag_ptr(ret_conv, true);
38970 }
38971
38972 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
38973         LDKChannelManager obj_conv;
38974         obj_conv.inner = untag_ptr(obj);
38975         obj_conv.is_owned = ptr_is_owned(obj);
38976         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38977         obj_conv.is_owned = false;
38978         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
38979         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38980         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38981         CVec_u8Z_free(ret_var);
38982         return ret_arr;
38983 }
38984
38985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
38986         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
38987         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
38988         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38989         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38990         CVec_u8Z_free(ret_var);
38991         return ret_arr;
38992 }
38993
38994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38995         LDKu8slice ser_ref;
38996         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38997         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38998         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
38999         *ret_conv = ChannelShutdownState_read(ser_ref);
39000         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39001         return tag_ptr(ret_conv, true);
39002 }
39003
39004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39005         LDKChannelManagerReadArgs this_obj_conv;
39006         this_obj_conv.inner = untag_ptr(this_obj);
39007         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39009         ChannelManagerReadArgs_free(this_obj_conv);
39010 }
39011
39012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
39013         LDKChannelManagerReadArgs this_ptr_conv;
39014         this_ptr_conv.inner = untag_ptr(this_ptr);
39015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39017         this_ptr_conv.is_owned = false;
39018         // WARNING: This object doesn't live past this scope, needs clone!
39019         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
39020         return ret_ret;
39021 }
39022
39023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39024         LDKChannelManagerReadArgs this_ptr_conv;
39025         this_ptr_conv.inner = untag_ptr(this_ptr);
39026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39028         this_ptr_conv.is_owned = false;
39029         void* val_ptr = untag_ptr(val);
39030         CHECK_ACCESS(val_ptr);
39031         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
39032         if (val_conv.free == LDKEntropySource_JCalls_free) {
39033                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39034                 LDKEntropySource_JCalls_cloned(&val_conv);
39035         }
39036         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
39037 }
39038
39039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
39040         LDKChannelManagerReadArgs this_ptr_conv;
39041         this_ptr_conv.inner = untag_ptr(this_ptr);
39042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39044         this_ptr_conv.is_owned = false;
39045         // WARNING: This object doesn't live past this scope, needs clone!
39046         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
39047         return ret_ret;
39048 }
39049
39050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39051         LDKChannelManagerReadArgs this_ptr_conv;
39052         this_ptr_conv.inner = untag_ptr(this_ptr);
39053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39055         this_ptr_conv.is_owned = false;
39056         void* val_ptr = untag_ptr(val);
39057         CHECK_ACCESS(val_ptr);
39058         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
39059         if (val_conv.free == LDKNodeSigner_JCalls_free) {
39060                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39061                 LDKNodeSigner_JCalls_cloned(&val_conv);
39062         }
39063         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
39064 }
39065
39066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
39067         LDKChannelManagerReadArgs this_ptr_conv;
39068         this_ptr_conv.inner = untag_ptr(this_ptr);
39069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39071         this_ptr_conv.is_owned = false;
39072         // WARNING: This object doesn't live past this scope, needs clone!
39073         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
39074         return ret_ret;
39075 }
39076
39077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39078         LDKChannelManagerReadArgs this_ptr_conv;
39079         this_ptr_conv.inner = untag_ptr(this_ptr);
39080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39082         this_ptr_conv.is_owned = false;
39083         void* val_ptr = untag_ptr(val);
39084         CHECK_ACCESS(val_ptr);
39085         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
39086         if (val_conv.free == LDKSignerProvider_JCalls_free) {
39087                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39088                 LDKSignerProvider_JCalls_cloned(&val_conv);
39089         }
39090         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
39091 }
39092
39093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
39094         LDKChannelManagerReadArgs this_ptr_conv;
39095         this_ptr_conv.inner = untag_ptr(this_ptr);
39096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39098         this_ptr_conv.is_owned = false;
39099         // WARNING: This object doesn't live past this scope, needs clone!
39100         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
39101         return ret_ret;
39102 }
39103
39104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39105         LDKChannelManagerReadArgs this_ptr_conv;
39106         this_ptr_conv.inner = untag_ptr(this_ptr);
39107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39109         this_ptr_conv.is_owned = false;
39110         void* val_ptr = untag_ptr(val);
39111         CHECK_ACCESS(val_ptr);
39112         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
39113         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
39114                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39115                 LDKFeeEstimator_JCalls_cloned(&val_conv);
39116         }
39117         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
39118 }
39119
39120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
39121         LDKChannelManagerReadArgs this_ptr_conv;
39122         this_ptr_conv.inner = untag_ptr(this_ptr);
39123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39125         this_ptr_conv.is_owned = false;
39126         // WARNING: This object doesn't live past this scope, needs clone!
39127         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
39128         return ret_ret;
39129 }
39130
39131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39132         LDKChannelManagerReadArgs this_ptr_conv;
39133         this_ptr_conv.inner = untag_ptr(this_ptr);
39134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39136         this_ptr_conv.is_owned = false;
39137         void* val_ptr = untag_ptr(val);
39138         CHECK_ACCESS(val_ptr);
39139         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
39140         if (val_conv.free == LDKWatch_JCalls_free) {
39141                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39142                 LDKWatch_JCalls_cloned(&val_conv);
39143         }
39144         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
39145 }
39146
39147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
39148         LDKChannelManagerReadArgs this_ptr_conv;
39149         this_ptr_conv.inner = untag_ptr(this_ptr);
39150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39152         this_ptr_conv.is_owned = false;
39153         // WARNING: This object doesn't live past this scope, needs clone!
39154         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
39155         return ret_ret;
39156 }
39157
39158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39159         LDKChannelManagerReadArgs this_ptr_conv;
39160         this_ptr_conv.inner = untag_ptr(this_ptr);
39161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39163         this_ptr_conv.is_owned = false;
39164         void* val_ptr = untag_ptr(val);
39165         CHECK_ACCESS(val_ptr);
39166         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
39167         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
39168                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39169                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
39170         }
39171         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
39172 }
39173
39174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
39175         LDKChannelManagerReadArgs this_ptr_conv;
39176         this_ptr_conv.inner = untag_ptr(this_ptr);
39177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39179         this_ptr_conv.is_owned = false;
39180         // WARNING: This object doesn't live past this scope, needs clone!
39181         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
39182         return ret_ret;
39183 }
39184
39185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39186         LDKChannelManagerReadArgs this_ptr_conv;
39187         this_ptr_conv.inner = untag_ptr(this_ptr);
39188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39190         this_ptr_conv.is_owned = false;
39191         void* val_ptr = untag_ptr(val);
39192         CHECK_ACCESS(val_ptr);
39193         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
39194         if (val_conv.free == LDKRouter_JCalls_free) {
39195                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39196                 LDKRouter_JCalls_cloned(&val_conv);
39197         }
39198         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
39199 }
39200
39201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
39202         LDKChannelManagerReadArgs this_ptr_conv;
39203         this_ptr_conv.inner = untag_ptr(this_ptr);
39204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39206         this_ptr_conv.is_owned = false;
39207         // WARNING: This object doesn't live past this scope, needs clone!
39208         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
39209         return ret_ret;
39210 }
39211
39212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39213         LDKChannelManagerReadArgs this_ptr_conv;
39214         this_ptr_conv.inner = untag_ptr(this_ptr);
39215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39217         this_ptr_conv.is_owned = false;
39218         void* val_ptr = untag_ptr(val);
39219         CHECK_ACCESS(val_ptr);
39220         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
39221         if (val_conv.free == LDKLogger_JCalls_free) {
39222                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39223                 LDKLogger_JCalls_cloned(&val_conv);
39224         }
39225         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
39226 }
39227
39228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
39229         LDKChannelManagerReadArgs this_ptr_conv;
39230         this_ptr_conv.inner = untag_ptr(this_ptr);
39231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39233         this_ptr_conv.is_owned = false;
39234         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
39235         int64_t ret_ref = 0;
39236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39238         return ret_ref;
39239 }
39240
39241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39242         LDKChannelManagerReadArgs this_ptr_conv;
39243         this_ptr_conv.inner = untag_ptr(this_ptr);
39244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39246         this_ptr_conv.is_owned = false;
39247         LDKUserConfig val_conv;
39248         val_conv.inner = untag_ptr(val);
39249         val_conv.is_owned = ptr_is_owned(val);
39250         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39251         val_conv = UserConfig_clone(&val_conv);
39252         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
39253 }
39254
39255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t signer_provider, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t router, int64_t logger, int64_t default_config, int64_tArray channel_monitors) {
39256         void* entropy_source_ptr = untag_ptr(entropy_source);
39257         CHECK_ACCESS(entropy_source_ptr);
39258         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
39259         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
39260                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39261                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
39262         }
39263         void* node_signer_ptr = untag_ptr(node_signer);
39264         CHECK_ACCESS(node_signer_ptr);
39265         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
39266         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
39267                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39268                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
39269         }
39270         void* signer_provider_ptr = untag_ptr(signer_provider);
39271         CHECK_ACCESS(signer_provider_ptr);
39272         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
39273         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
39274                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39275                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
39276         }
39277         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39278         CHECK_ACCESS(fee_estimator_ptr);
39279         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39280         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39281                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39282                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39283         }
39284         void* chain_monitor_ptr = untag_ptr(chain_monitor);
39285         CHECK_ACCESS(chain_monitor_ptr);
39286         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
39287         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
39288                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39289                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
39290         }
39291         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
39292         CHECK_ACCESS(tx_broadcaster_ptr);
39293         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
39294         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39295                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39296                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
39297         }
39298         void* router_ptr = untag_ptr(router);
39299         CHECK_ACCESS(router_ptr);
39300         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
39301         if (router_conv.free == LDKRouter_JCalls_free) {
39302                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39303                 LDKRouter_JCalls_cloned(&router_conv);
39304         }
39305         void* logger_ptr = untag_ptr(logger);
39306         CHECK_ACCESS(logger_ptr);
39307         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39308         if (logger_conv.free == LDKLogger_JCalls_free) {
39309                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39310                 LDKLogger_JCalls_cloned(&logger_conv);
39311         }
39312         LDKUserConfig default_config_conv;
39313         default_config_conv.inner = untag_ptr(default_config);
39314         default_config_conv.is_owned = ptr_is_owned(default_config);
39315         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
39316         default_config_conv = UserConfig_clone(&default_config_conv);
39317         LDKCVec_ChannelMonitorZ channel_monitors_constr;
39318         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
39319         if (channel_monitors_constr.datalen > 0)
39320                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
39321         else
39322                 channel_monitors_constr.data = NULL;
39323         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
39324         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
39325                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
39326                 LDKChannelMonitor channel_monitors_conv_16_conv;
39327                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
39328                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
39329                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
39330                 channel_monitors_conv_16_conv.is_owned = false;
39331                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
39332         }
39333         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
39334         LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(entropy_source_conv, node_signer_conv, signer_provider_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, default_config_conv, channel_monitors_constr);
39335         int64_t ret_ref = 0;
39336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39338         return ret_ref;
39339 }
39340
39341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
39342         LDKu8slice ser_ref;
39343         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39344         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39345         LDKChannelManagerReadArgs arg_conv;
39346         arg_conv.inner = untag_ptr(arg);
39347         arg_conv.is_owned = ptr_is_owned(arg);
39348         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39349         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
39350         
39351         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
39352         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
39353         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39354         return tag_ptr(ret_conv, true);
39355 }
39356
39357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39358         LDKExpandedKey this_obj_conv;
39359         this_obj_conv.inner = untag_ptr(this_obj);
39360         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39362         ExpandedKey_free(this_obj_conv);
39363 }
39364
39365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
39366         uint8_t key_material_arr[32];
39367         CHECK((*env)->GetArrayLength(env, key_material) == 32);
39368         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
39369         uint8_t (*key_material_ref)[32] = &key_material_arr;
39370         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
39371         int64_t ret_ref = 0;
39372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39374         return ret_ref;
39375 }
39376
39377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t entropy_source, int64_t current_time, int64_t min_final_cltv_expiry_delta) {
39378         LDKExpandedKey keys_conv;
39379         keys_conv.inner = untag_ptr(keys);
39380         keys_conv.is_owned = ptr_is_owned(keys);
39381         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
39382         keys_conv.is_owned = false;
39383         void* min_value_msat_ptr = untag_ptr(min_value_msat);
39384         CHECK_ACCESS(min_value_msat_ptr);
39385         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
39386         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
39387         void* entropy_source_ptr = untag_ptr(entropy_source);
39388         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
39389         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
39390         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
39391         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
39392         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
39393         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
39394         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
39395         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
39396         return tag_ptr(ret_conv, true);
39397 }
39398
39399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1from_1hash(JNIEnv *env, jclass clz, int64_t keys, int64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time, int64_t min_final_cltv_expiry_delta) {
39400         LDKExpandedKey keys_conv;
39401         keys_conv.inner = untag_ptr(keys);
39402         keys_conv.is_owned = ptr_is_owned(keys);
39403         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
39404         keys_conv.is_owned = false;
39405         void* min_value_msat_ptr = untag_ptr(min_value_msat);
39406         CHECK_ACCESS(min_value_msat_ptr);
39407         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
39408         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
39409         LDKThirtyTwoBytes payment_hash_ref;
39410         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
39411         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
39412         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
39413         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
39414         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
39415         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
39416         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
39417         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta_conv);
39418         return tag_ptr(ret_conv, true);
39419 }
39420
39421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39422         if (!ptr_is_owned(this_ptr)) return;
39423         void* this_ptr_ptr = untag_ptr(this_ptr);
39424         CHECK_ACCESS(this_ptr_ptr);
39425         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
39426         FREE(untag_ptr(this_ptr));
39427         DecodeError_free(this_ptr_conv);
39428 }
39429
39430 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
39431         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39432         *ret_copy = DecodeError_clone(arg);
39433         int64_t ret_ref = tag_ptr(ret_copy, true);
39434         return ret_ref;
39435 }
39436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39437         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
39438         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
39439         return ret_conv;
39440 }
39441
39442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39443         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
39444         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39445         *ret_copy = DecodeError_clone(orig_conv);
39446         int64_t ret_ref = tag_ptr(ret_copy, true);
39447         return ret_ref;
39448 }
39449
39450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
39451         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39452         *ret_copy = DecodeError_unknown_version();
39453         int64_t ret_ref = tag_ptr(ret_copy, true);
39454         return ret_ref;
39455 }
39456
39457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
39458         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39459         *ret_copy = DecodeError_unknown_required_feature();
39460         int64_t ret_ref = tag_ptr(ret_copy, true);
39461         return ret_ref;
39462 }
39463
39464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
39465         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39466         *ret_copy = DecodeError_invalid_value();
39467         int64_t ret_ref = tag_ptr(ret_copy, true);
39468         return ret_ref;
39469 }
39470
39471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
39472         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39473         *ret_copy = DecodeError_short_read();
39474         int64_t ret_ref = tag_ptr(ret_copy, true);
39475         return ret_ref;
39476 }
39477
39478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
39479         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39480         *ret_copy = DecodeError_bad_length_descriptor();
39481         int64_t ret_ref = tag_ptr(ret_copy, true);
39482         return ret_ref;
39483 }
39484
39485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
39486         LDKIOError a_conv = LDKIOError_from_java(env, a);
39487         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39488         *ret_copy = DecodeError_io(a_conv);
39489         int64_t ret_ref = tag_ptr(ret_copy, true);
39490         return ret_ref;
39491 }
39492
39493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
39494         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39495         *ret_copy = DecodeError_unsupported_compression();
39496         int64_t ret_ref = tag_ptr(ret_copy, true);
39497         return ret_ref;
39498 }
39499
39500 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39501         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
39502         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
39503         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
39504         return ret_conv;
39505 }
39506
39507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39508         LDKInit this_obj_conv;
39509         this_obj_conv.inner = untag_ptr(this_obj);
39510         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39512         Init_free(this_obj_conv);
39513 }
39514
39515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
39516         LDKInit this_ptr_conv;
39517         this_ptr_conv.inner = untag_ptr(this_ptr);
39518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39520         this_ptr_conv.is_owned = false;
39521         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
39522         int64_t ret_ref = 0;
39523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39525         return ret_ref;
39526 }
39527
39528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39529         LDKInit this_ptr_conv;
39530         this_ptr_conv.inner = untag_ptr(this_ptr);
39531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39533         this_ptr_conv.is_owned = false;
39534         LDKInitFeatures val_conv;
39535         val_conv.inner = untag_ptr(val);
39536         val_conv.is_owned = ptr_is_owned(val);
39537         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39538         val_conv = InitFeatures_clone(&val_conv);
39539         Init_set_features(&this_ptr_conv, val_conv);
39540 }
39541
39542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
39543         LDKInit this_ptr_conv;
39544         this_ptr_conv.inner = untag_ptr(this_ptr);
39545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39547         this_ptr_conv.is_owned = false;
39548         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
39549         *ret_copy = Init_get_networks(&this_ptr_conv);
39550         int64_t ret_ref = tag_ptr(ret_copy, true);
39551         return ret_ref;
39552 }
39553
39554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39555         LDKInit this_ptr_conv;
39556         this_ptr_conv.inner = untag_ptr(this_ptr);
39557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39559         this_ptr_conv.is_owned = false;
39560         void* val_ptr = untag_ptr(val);
39561         CHECK_ACCESS(val_ptr);
39562         LDKCOption_CVec_ChainHashZZ val_conv = *(LDKCOption_CVec_ChainHashZZ*)(val_ptr);
39563         val_conv = COption_CVec_ChainHashZZ_clone((LDKCOption_CVec_ChainHashZZ*)untag_ptr(val));
39564         Init_set_networks(&this_ptr_conv, val_conv);
39565 }
39566
39567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
39568         LDKInit this_ptr_conv;
39569         this_ptr_conv.inner = untag_ptr(this_ptr);
39570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39572         this_ptr_conv.is_owned = false;
39573         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
39574         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
39575         int64_t ret_ref = tag_ptr(ret_copy, true);
39576         return ret_ref;
39577 }
39578
39579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39580         LDKInit this_ptr_conv;
39581         this_ptr_conv.inner = untag_ptr(this_ptr);
39582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39584         this_ptr_conv.is_owned = false;
39585         void* val_ptr = untag_ptr(val);
39586         CHECK_ACCESS(val_ptr);
39587         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
39588         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
39589         Init_set_remote_network_address(&this_ptr_conv, val_conv);
39590 }
39591
39592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t networks_arg, int64_t remote_network_address_arg) {
39593         LDKInitFeatures features_arg_conv;
39594         features_arg_conv.inner = untag_ptr(features_arg);
39595         features_arg_conv.is_owned = ptr_is_owned(features_arg);
39596         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
39597         features_arg_conv = InitFeatures_clone(&features_arg_conv);
39598         void* networks_arg_ptr = untag_ptr(networks_arg);
39599         CHECK_ACCESS(networks_arg_ptr);
39600         LDKCOption_CVec_ChainHashZZ networks_arg_conv = *(LDKCOption_CVec_ChainHashZZ*)(networks_arg_ptr);
39601         networks_arg_conv = COption_CVec_ChainHashZZ_clone((LDKCOption_CVec_ChainHashZZ*)untag_ptr(networks_arg));
39602         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
39603         CHECK_ACCESS(remote_network_address_arg_ptr);
39604         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
39605         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
39606         int64_t ret_ref = 0;
39607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39609         return ret_ref;
39610 }
39611
39612 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
39613         LDKInit ret_var = Init_clone(arg);
39614         int64_t ret_ref = 0;
39615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39617         return ret_ref;
39618 }
39619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39620         LDKInit arg_conv;
39621         arg_conv.inner = untag_ptr(arg);
39622         arg_conv.is_owned = ptr_is_owned(arg);
39623         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39624         arg_conv.is_owned = false;
39625         int64_t ret_conv = Init_clone_ptr(&arg_conv);
39626         return ret_conv;
39627 }
39628
39629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39630         LDKInit orig_conv;
39631         orig_conv.inner = untag_ptr(orig);
39632         orig_conv.is_owned = ptr_is_owned(orig);
39633         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39634         orig_conv.is_owned = false;
39635         LDKInit ret_var = Init_clone(&orig_conv);
39636         int64_t ret_ref = 0;
39637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39639         return ret_ref;
39640 }
39641
39642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39643         LDKInit a_conv;
39644         a_conv.inner = untag_ptr(a);
39645         a_conv.is_owned = ptr_is_owned(a);
39646         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39647         a_conv.is_owned = false;
39648         LDKInit b_conv;
39649         b_conv.inner = untag_ptr(b);
39650         b_conv.is_owned = ptr_is_owned(b);
39651         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39652         b_conv.is_owned = false;
39653         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
39654         return ret_conv;
39655 }
39656
39657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39658         LDKErrorMessage this_obj_conv;
39659         this_obj_conv.inner = untag_ptr(this_obj);
39660         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39662         ErrorMessage_free(this_obj_conv);
39663 }
39664
39665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39666         LDKErrorMessage this_ptr_conv;
39667         this_ptr_conv.inner = untag_ptr(this_ptr);
39668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39670         this_ptr_conv.is_owned = false;
39671         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39672         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
39673         return ret_arr;
39674 }
39675
39676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39677         LDKErrorMessage this_ptr_conv;
39678         this_ptr_conv.inner = untag_ptr(this_ptr);
39679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39681         this_ptr_conv.is_owned = false;
39682         LDKThirtyTwoBytes val_ref;
39683         CHECK((*env)->GetArrayLength(env, val) == 32);
39684         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39685         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
39686 }
39687
39688 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
39689         LDKErrorMessage this_ptr_conv;
39690         this_ptr_conv.inner = untag_ptr(this_ptr);
39691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39693         this_ptr_conv.is_owned = false;
39694         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
39695         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
39696         Str_free(ret_str);
39697         return ret_conv;
39698 }
39699
39700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
39701         LDKErrorMessage this_ptr_conv;
39702         this_ptr_conv.inner = untag_ptr(this_ptr);
39703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39705         this_ptr_conv.is_owned = false;
39706         LDKStr val_conv = java_to_owned_str(env, val);
39707         ErrorMessage_set_data(&this_ptr_conv, val_conv);
39708 }
39709
39710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
39711         LDKThirtyTwoBytes channel_id_arg_ref;
39712         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
39713         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
39714         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
39715         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
39716         int64_t ret_ref = 0;
39717         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39718         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39719         return ret_ref;
39720 }
39721
39722 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
39723         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
39724         int64_t ret_ref = 0;
39725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39727         return ret_ref;
39728 }
39729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39730         LDKErrorMessage arg_conv;
39731         arg_conv.inner = untag_ptr(arg);
39732         arg_conv.is_owned = ptr_is_owned(arg);
39733         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39734         arg_conv.is_owned = false;
39735         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
39736         return ret_conv;
39737 }
39738
39739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39740         LDKErrorMessage orig_conv;
39741         orig_conv.inner = untag_ptr(orig);
39742         orig_conv.is_owned = ptr_is_owned(orig);
39743         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39744         orig_conv.is_owned = false;
39745         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
39746         int64_t ret_ref = 0;
39747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39749         return ret_ref;
39750 }
39751
39752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39753         LDKErrorMessage a_conv;
39754         a_conv.inner = untag_ptr(a);
39755         a_conv.is_owned = ptr_is_owned(a);
39756         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39757         a_conv.is_owned = false;
39758         LDKErrorMessage b_conv;
39759         b_conv.inner = untag_ptr(b);
39760         b_conv.is_owned = ptr_is_owned(b);
39761         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39762         b_conv.is_owned = false;
39763         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
39764         return ret_conv;
39765 }
39766
39767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39768         LDKWarningMessage this_obj_conv;
39769         this_obj_conv.inner = untag_ptr(this_obj);
39770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39772         WarningMessage_free(this_obj_conv);
39773 }
39774
39775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39776         LDKWarningMessage this_ptr_conv;
39777         this_ptr_conv.inner = untag_ptr(this_ptr);
39778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39780         this_ptr_conv.is_owned = false;
39781         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39782         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
39783         return ret_arr;
39784 }
39785
39786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39787         LDKWarningMessage this_ptr_conv;
39788         this_ptr_conv.inner = untag_ptr(this_ptr);
39789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39791         this_ptr_conv.is_owned = false;
39792         LDKThirtyTwoBytes val_ref;
39793         CHECK((*env)->GetArrayLength(env, val) == 32);
39794         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39795         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
39796 }
39797
39798 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
39799         LDKWarningMessage this_ptr_conv;
39800         this_ptr_conv.inner = untag_ptr(this_ptr);
39801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39803         this_ptr_conv.is_owned = false;
39804         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
39805         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
39806         Str_free(ret_str);
39807         return ret_conv;
39808 }
39809
39810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
39811         LDKWarningMessage this_ptr_conv;
39812         this_ptr_conv.inner = untag_ptr(this_ptr);
39813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39815         this_ptr_conv.is_owned = false;
39816         LDKStr val_conv = java_to_owned_str(env, val);
39817         WarningMessage_set_data(&this_ptr_conv, val_conv);
39818 }
39819
39820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
39821         LDKThirtyTwoBytes channel_id_arg_ref;
39822         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
39823         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
39824         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
39825         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
39826         int64_t ret_ref = 0;
39827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39829         return ret_ref;
39830 }
39831
39832 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
39833         LDKWarningMessage ret_var = WarningMessage_clone(arg);
39834         int64_t ret_ref = 0;
39835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39837         return ret_ref;
39838 }
39839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39840         LDKWarningMessage arg_conv;
39841         arg_conv.inner = untag_ptr(arg);
39842         arg_conv.is_owned = ptr_is_owned(arg);
39843         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39844         arg_conv.is_owned = false;
39845         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
39846         return ret_conv;
39847 }
39848
39849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39850         LDKWarningMessage orig_conv;
39851         orig_conv.inner = untag_ptr(orig);
39852         orig_conv.is_owned = ptr_is_owned(orig);
39853         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39854         orig_conv.is_owned = false;
39855         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
39856         int64_t ret_ref = 0;
39857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39859         return ret_ref;
39860 }
39861
39862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39863         LDKWarningMessage a_conv;
39864         a_conv.inner = untag_ptr(a);
39865         a_conv.is_owned = ptr_is_owned(a);
39866         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39867         a_conv.is_owned = false;
39868         LDKWarningMessage b_conv;
39869         b_conv.inner = untag_ptr(b);
39870         b_conv.is_owned = ptr_is_owned(b);
39871         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39872         b_conv.is_owned = false;
39873         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
39874         return ret_conv;
39875 }
39876
39877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39878         LDKPing this_obj_conv;
39879         this_obj_conv.inner = untag_ptr(this_obj);
39880         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39882         Ping_free(this_obj_conv);
39883 }
39884
39885 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
39886         LDKPing this_ptr_conv;
39887         this_ptr_conv.inner = untag_ptr(this_ptr);
39888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39890         this_ptr_conv.is_owned = false;
39891         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
39892         return ret_conv;
39893 }
39894
39895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39896         LDKPing this_ptr_conv;
39897         this_ptr_conv.inner = untag_ptr(this_ptr);
39898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39900         this_ptr_conv.is_owned = false;
39901         Ping_set_ponglen(&this_ptr_conv, val);
39902 }
39903
39904 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
39905         LDKPing this_ptr_conv;
39906         this_ptr_conv.inner = untag_ptr(this_ptr);
39907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39909         this_ptr_conv.is_owned = false;
39910         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
39911         return ret_conv;
39912 }
39913
39914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39915         LDKPing this_ptr_conv;
39916         this_ptr_conv.inner = untag_ptr(this_ptr);
39917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39919         this_ptr_conv.is_owned = false;
39920         Ping_set_byteslen(&this_ptr_conv, val);
39921 }
39922
39923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
39924         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
39925         int64_t ret_ref = 0;
39926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39928         return ret_ref;
39929 }
39930
39931 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
39932         LDKPing ret_var = Ping_clone(arg);
39933         int64_t ret_ref = 0;
39934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39936         return ret_ref;
39937 }
39938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39939         LDKPing arg_conv;
39940         arg_conv.inner = untag_ptr(arg);
39941         arg_conv.is_owned = ptr_is_owned(arg);
39942         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39943         arg_conv.is_owned = false;
39944         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
39945         return ret_conv;
39946 }
39947
39948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39949         LDKPing orig_conv;
39950         orig_conv.inner = untag_ptr(orig);
39951         orig_conv.is_owned = ptr_is_owned(orig);
39952         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39953         orig_conv.is_owned = false;
39954         LDKPing ret_var = Ping_clone(&orig_conv);
39955         int64_t ret_ref = 0;
39956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39958         return ret_ref;
39959 }
39960
39961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39962         LDKPing a_conv;
39963         a_conv.inner = untag_ptr(a);
39964         a_conv.is_owned = ptr_is_owned(a);
39965         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39966         a_conv.is_owned = false;
39967         LDKPing b_conv;
39968         b_conv.inner = untag_ptr(b);
39969         b_conv.is_owned = ptr_is_owned(b);
39970         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39971         b_conv.is_owned = false;
39972         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
39973         return ret_conv;
39974 }
39975
39976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39977         LDKPong this_obj_conv;
39978         this_obj_conv.inner = untag_ptr(this_obj);
39979         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39981         Pong_free(this_obj_conv);
39982 }
39983
39984 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
39985         LDKPong this_ptr_conv;
39986         this_ptr_conv.inner = untag_ptr(this_ptr);
39987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39989         this_ptr_conv.is_owned = false;
39990         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
39991         return ret_conv;
39992 }
39993
39994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39995         LDKPong this_ptr_conv;
39996         this_ptr_conv.inner = untag_ptr(this_ptr);
39997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39999         this_ptr_conv.is_owned = false;
40000         Pong_set_byteslen(&this_ptr_conv, val);
40001 }
40002
40003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
40004         LDKPong ret_var = Pong_new(byteslen_arg);
40005         int64_t ret_ref = 0;
40006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40008         return ret_ref;
40009 }
40010
40011 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
40012         LDKPong ret_var = Pong_clone(arg);
40013         int64_t ret_ref = 0;
40014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40016         return ret_ref;
40017 }
40018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40019         LDKPong arg_conv;
40020         arg_conv.inner = untag_ptr(arg);
40021         arg_conv.is_owned = ptr_is_owned(arg);
40022         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40023         arg_conv.is_owned = false;
40024         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
40025         return ret_conv;
40026 }
40027
40028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40029         LDKPong orig_conv;
40030         orig_conv.inner = untag_ptr(orig);
40031         orig_conv.is_owned = ptr_is_owned(orig);
40032         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40033         orig_conv.is_owned = false;
40034         LDKPong ret_var = Pong_clone(&orig_conv);
40035         int64_t ret_ref = 0;
40036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40038         return ret_ref;
40039 }
40040
40041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40042         LDKPong a_conv;
40043         a_conv.inner = untag_ptr(a);
40044         a_conv.is_owned = ptr_is_owned(a);
40045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40046         a_conv.is_owned = false;
40047         LDKPong b_conv;
40048         b_conv.inner = untag_ptr(b);
40049         b_conv.is_owned = ptr_is_owned(b);
40050         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40051         b_conv.is_owned = false;
40052         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
40053         return ret_conv;
40054 }
40055
40056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40057         LDKOpenChannel this_obj_conv;
40058         this_obj_conv.inner = untag_ptr(this_obj);
40059         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40061         OpenChannel_free(this_obj_conv);
40062 }
40063
40064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
40065         LDKOpenChannel this_ptr_conv;
40066         this_ptr_conv.inner = untag_ptr(this_ptr);
40067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40069         this_ptr_conv.is_owned = false;
40070         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40071         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
40072         return ret_arr;
40073 }
40074
40075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40076         LDKOpenChannel this_ptr_conv;
40077         this_ptr_conv.inner = untag_ptr(this_ptr);
40078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40080         this_ptr_conv.is_owned = false;
40081         LDKThirtyTwoBytes val_ref;
40082         CHECK((*env)->GetArrayLength(env, val) == 32);
40083         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40084         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
40085 }
40086
40087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
40088         LDKOpenChannel this_ptr_conv;
40089         this_ptr_conv.inner = untag_ptr(this_ptr);
40090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40092         this_ptr_conv.is_owned = false;
40093         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40094         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
40095         return ret_arr;
40096 }
40097
40098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40099         LDKOpenChannel this_ptr_conv;
40100         this_ptr_conv.inner = untag_ptr(this_ptr);
40101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40103         this_ptr_conv.is_owned = false;
40104         LDKThirtyTwoBytes val_ref;
40105         CHECK((*env)->GetArrayLength(env, val) == 32);
40106         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40107         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
40108 }
40109
40110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40111         LDKOpenChannel this_ptr_conv;
40112         this_ptr_conv.inner = untag_ptr(this_ptr);
40113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40115         this_ptr_conv.is_owned = false;
40116         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
40117         return ret_conv;
40118 }
40119
40120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40121         LDKOpenChannel this_ptr_conv;
40122         this_ptr_conv.inner = untag_ptr(this_ptr);
40123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40125         this_ptr_conv.is_owned = false;
40126         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
40127 }
40128
40129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40130         LDKOpenChannel this_ptr_conv;
40131         this_ptr_conv.inner = untag_ptr(this_ptr);
40132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40134         this_ptr_conv.is_owned = false;
40135         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
40136         return ret_conv;
40137 }
40138
40139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40140         LDKOpenChannel this_ptr_conv;
40141         this_ptr_conv.inner = untag_ptr(this_ptr);
40142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40144         this_ptr_conv.is_owned = false;
40145         OpenChannel_set_push_msat(&this_ptr_conv, val);
40146 }
40147
40148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40149         LDKOpenChannel this_ptr_conv;
40150         this_ptr_conv.inner = untag_ptr(this_ptr);
40151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40153         this_ptr_conv.is_owned = false;
40154         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
40155         return ret_conv;
40156 }
40157
40158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40159         LDKOpenChannel this_ptr_conv;
40160         this_ptr_conv.inner = untag_ptr(this_ptr);
40161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40163         this_ptr_conv.is_owned = false;
40164         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
40165 }
40166
40167 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) {
40168         LDKOpenChannel this_ptr_conv;
40169         this_ptr_conv.inner = untag_ptr(this_ptr);
40170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40172         this_ptr_conv.is_owned = false;
40173         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
40174         return ret_conv;
40175 }
40176
40177 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) {
40178         LDKOpenChannel this_ptr_conv;
40179         this_ptr_conv.inner = untag_ptr(this_ptr);
40180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40182         this_ptr_conv.is_owned = false;
40183         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
40184 }
40185
40186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40187         LDKOpenChannel this_ptr_conv;
40188         this_ptr_conv.inner = untag_ptr(this_ptr);
40189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40191         this_ptr_conv.is_owned = false;
40192         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
40193         return ret_conv;
40194 }
40195
40196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40197         LDKOpenChannel this_ptr_conv;
40198         this_ptr_conv.inner = untag_ptr(this_ptr);
40199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40201         this_ptr_conv.is_owned = false;
40202         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
40203 }
40204
40205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40206         LDKOpenChannel this_ptr_conv;
40207         this_ptr_conv.inner = untag_ptr(this_ptr);
40208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40210         this_ptr_conv.is_owned = false;
40211         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
40212         return ret_conv;
40213 }
40214
40215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40216         LDKOpenChannel this_ptr_conv;
40217         this_ptr_conv.inner = untag_ptr(this_ptr);
40218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40220         this_ptr_conv.is_owned = false;
40221         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
40222 }
40223
40224 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
40225         LDKOpenChannel this_ptr_conv;
40226         this_ptr_conv.inner = untag_ptr(this_ptr);
40227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40229         this_ptr_conv.is_owned = false;
40230         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
40231         return ret_conv;
40232 }
40233
40234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40235         LDKOpenChannel this_ptr_conv;
40236         this_ptr_conv.inner = untag_ptr(this_ptr);
40237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40239         this_ptr_conv.is_owned = false;
40240         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
40241 }
40242
40243 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
40244         LDKOpenChannel this_ptr_conv;
40245         this_ptr_conv.inner = untag_ptr(this_ptr);
40246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40248         this_ptr_conv.is_owned = false;
40249         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
40250         return ret_conv;
40251 }
40252
40253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40254         LDKOpenChannel this_ptr_conv;
40255         this_ptr_conv.inner = untag_ptr(this_ptr);
40256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40258         this_ptr_conv.is_owned = false;
40259         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
40260 }
40261
40262 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40263         LDKOpenChannel this_ptr_conv;
40264         this_ptr_conv.inner = untag_ptr(this_ptr);
40265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40267         this_ptr_conv.is_owned = false;
40268         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
40269         return ret_conv;
40270 }
40271
40272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40273         LDKOpenChannel this_ptr_conv;
40274         this_ptr_conv.inner = untag_ptr(this_ptr);
40275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40277         this_ptr_conv.is_owned = false;
40278         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
40279 }
40280
40281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40282         LDKOpenChannel this_ptr_conv;
40283         this_ptr_conv.inner = untag_ptr(this_ptr);
40284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40286         this_ptr_conv.is_owned = false;
40287         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40288         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
40289         return ret_arr;
40290 }
40291
40292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40293         LDKOpenChannel this_ptr_conv;
40294         this_ptr_conv.inner = untag_ptr(this_ptr);
40295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40297         this_ptr_conv.is_owned = false;
40298         LDKPublicKey val_ref;
40299         CHECK((*env)->GetArrayLength(env, val) == 33);
40300         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40301         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
40302 }
40303
40304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40305         LDKOpenChannel this_ptr_conv;
40306         this_ptr_conv.inner = untag_ptr(this_ptr);
40307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40309         this_ptr_conv.is_owned = false;
40310         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40311         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
40312         return ret_arr;
40313 }
40314
40315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40316         LDKOpenChannel this_ptr_conv;
40317         this_ptr_conv.inner = untag_ptr(this_ptr);
40318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40320         this_ptr_conv.is_owned = false;
40321         LDKPublicKey val_ref;
40322         CHECK((*env)->GetArrayLength(env, val) == 33);
40323         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40324         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
40325 }
40326
40327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
40328         LDKOpenChannel this_ptr_conv;
40329         this_ptr_conv.inner = untag_ptr(this_ptr);
40330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40332         this_ptr_conv.is_owned = false;
40333         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40334         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
40335         return ret_arr;
40336 }
40337
40338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40339         LDKOpenChannel this_ptr_conv;
40340         this_ptr_conv.inner = untag_ptr(this_ptr);
40341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40343         this_ptr_conv.is_owned = false;
40344         LDKPublicKey val_ref;
40345         CHECK((*env)->GetArrayLength(env, val) == 33);
40346         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40347         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
40348 }
40349
40350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40351         LDKOpenChannel this_ptr_conv;
40352         this_ptr_conv.inner = untag_ptr(this_ptr);
40353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40355         this_ptr_conv.is_owned = false;
40356         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40357         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
40358         return ret_arr;
40359 }
40360
40361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40362         LDKOpenChannel this_ptr_conv;
40363         this_ptr_conv.inner = untag_ptr(this_ptr);
40364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40366         this_ptr_conv.is_owned = false;
40367         LDKPublicKey val_ref;
40368         CHECK((*env)->GetArrayLength(env, val) == 33);
40369         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40370         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
40371 }
40372
40373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40374         LDKOpenChannel this_ptr_conv;
40375         this_ptr_conv.inner = untag_ptr(this_ptr);
40376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40378         this_ptr_conv.is_owned = false;
40379         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40380         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
40381         return ret_arr;
40382 }
40383
40384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40385         LDKOpenChannel this_ptr_conv;
40386         this_ptr_conv.inner = untag_ptr(this_ptr);
40387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40389         this_ptr_conv.is_owned = false;
40390         LDKPublicKey val_ref;
40391         CHECK((*env)->GetArrayLength(env, val) == 33);
40392         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40393         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
40394 }
40395
40396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
40397         LDKOpenChannel this_ptr_conv;
40398         this_ptr_conv.inner = untag_ptr(this_ptr);
40399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40401         this_ptr_conv.is_owned = false;
40402         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40403         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
40404         return ret_arr;
40405 }
40406
40407 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) {
40408         LDKOpenChannel this_ptr_conv;
40409         this_ptr_conv.inner = untag_ptr(this_ptr);
40410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40412         this_ptr_conv.is_owned = false;
40413         LDKPublicKey val_ref;
40414         CHECK((*env)->GetArrayLength(env, val) == 33);
40415         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40416         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
40417 }
40418
40419 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
40420         LDKOpenChannel this_ptr_conv;
40421         this_ptr_conv.inner = untag_ptr(this_ptr);
40422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40424         this_ptr_conv.is_owned = false;
40425         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
40426         return ret_conv;
40427 }
40428
40429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
40430         LDKOpenChannel this_ptr_conv;
40431         this_ptr_conv.inner = untag_ptr(this_ptr);
40432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40434         this_ptr_conv.is_owned = false;
40435         OpenChannel_set_channel_flags(&this_ptr_conv, val);
40436 }
40437
40438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40439         LDKOpenChannel this_ptr_conv;
40440         this_ptr_conv.inner = untag_ptr(this_ptr);
40441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40443         this_ptr_conv.is_owned = false;
40444         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
40445         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
40446         int64_t ret_ref = tag_ptr(ret_copy, true);
40447         return ret_ref;
40448 }
40449
40450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40451         LDKOpenChannel this_ptr_conv;
40452         this_ptr_conv.inner = untag_ptr(this_ptr);
40453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40455         this_ptr_conv.is_owned = false;
40456         void* val_ptr = untag_ptr(val);
40457         CHECK_ACCESS(val_ptr);
40458         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
40459         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
40460         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
40461 }
40462
40463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
40464         LDKOpenChannel this_ptr_conv;
40465         this_ptr_conv.inner = untag_ptr(this_ptr);
40466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40468         this_ptr_conv.is_owned = false;
40469         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
40470         int64_t ret_ref = 0;
40471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40473         return ret_ref;
40474 }
40475
40476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40477         LDKOpenChannel this_ptr_conv;
40478         this_ptr_conv.inner = untag_ptr(this_ptr);
40479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40481         this_ptr_conv.is_owned = false;
40482         LDKChannelTypeFeatures val_conv;
40483         val_conv.inner = untag_ptr(val);
40484         val_conv.is_owned = ptr_is_owned(val);
40485         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40486         val_conv = ChannelTypeFeatures_clone(&val_conv);
40487         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
40488 }
40489
40490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t push_msat_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t feerate_per_kw_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, 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, int8_tArray first_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
40491         LDKThirtyTwoBytes chain_hash_arg_ref;
40492         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
40493         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
40494         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
40495         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
40496         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
40497         LDKPublicKey funding_pubkey_arg_ref;
40498         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
40499         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
40500         LDKPublicKey revocation_basepoint_arg_ref;
40501         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
40502         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
40503         LDKPublicKey payment_point_arg_ref;
40504         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
40505         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
40506         LDKPublicKey delayed_payment_basepoint_arg_ref;
40507         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
40508         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
40509         LDKPublicKey htlc_basepoint_arg_ref;
40510         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
40511         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
40512         LDKPublicKey first_per_commitment_point_arg_ref;
40513         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
40514         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
40515         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
40516         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
40517         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
40518         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
40519         LDKChannelTypeFeatures channel_type_arg_conv;
40520         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
40521         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
40522         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
40523         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
40524         LDKOpenChannel ret_var = OpenChannel_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
40525         int64_t ret_ref = 0;
40526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40528         return ret_ref;
40529 }
40530
40531 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
40532         LDKOpenChannel ret_var = OpenChannel_clone(arg);
40533         int64_t ret_ref = 0;
40534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40536         return ret_ref;
40537 }
40538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40539         LDKOpenChannel arg_conv;
40540         arg_conv.inner = untag_ptr(arg);
40541         arg_conv.is_owned = ptr_is_owned(arg);
40542         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40543         arg_conv.is_owned = false;
40544         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
40545         return ret_conv;
40546 }
40547
40548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40549         LDKOpenChannel orig_conv;
40550         orig_conv.inner = untag_ptr(orig);
40551         orig_conv.is_owned = ptr_is_owned(orig);
40552         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40553         orig_conv.is_owned = false;
40554         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
40555         int64_t ret_ref = 0;
40556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40558         return ret_ref;
40559 }
40560
40561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40562         LDKOpenChannel a_conv;
40563         a_conv.inner = untag_ptr(a);
40564         a_conv.is_owned = ptr_is_owned(a);
40565         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40566         a_conv.is_owned = false;
40567         LDKOpenChannel b_conv;
40568         b_conv.inner = untag_ptr(b);
40569         b_conv.is_owned = ptr_is_owned(b);
40570         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40571         b_conv.is_owned = false;
40572         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
40573         return ret_conv;
40574 }
40575
40576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40577         LDKOpenChannelV2 this_obj_conv;
40578         this_obj_conv.inner = untag_ptr(this_obj);
40579         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40581         OpenChannelV2_free(this_obj_conv);
40582 }
40583
40584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
40585         LDKOpenChannelV2 this_ptr_conv;
40586         this_ptr_conv.inner = untag_ptr(this_ptr);
40587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40589         this_ptr_conv.is_owned = false;
40590         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40591         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_chain_hash(&this_ptr_conv));
40592         return ret_arr;
40593 }
40594
40595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40596         LDKOpenChannelV2 this_ptr_conv;
40597         this_ptr_conv.inner = untag_ptr(this_ptr);
40598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40600         this_ptr_conv.is_owned = false;
40601         LDKThirtyTwoBytes val_ref;
40602         CHECK((*env)->GetArrayLength(env, val) == 32);
40603         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40604         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
40605 }
40606
40607 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
40608         LDKOpenChannelV2 this_ptr_conv;
40609         this_ptr_conv.inner = untag_ptr(this_ptr);
40610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40612         this_ptr_conv.is_owned = false;
40613         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40614         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv));
40615         return ret_arr;
40616 }
40617
40618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40619         LDKOpenChannelV2 this_ptr_conv;
40620         this_ptr_conv.inner = untag_ptr(this_ptr);
40621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40623         this_ptr_conv.is_owned = false;
40624         LDKThirtyTwoBytes val_ref;
40625         CHECK((*env)->GetArrayLength(env, val) == 32);
40626         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40627         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
40628 }
40629
40630 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
40631         LDKOpenChannelV2 this_ptr_conv;
40632         this_ptr_conv.inner = untag_ptr(this_ptr);
40633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40635         this_ptr_conv.is_owned = false;
40636         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
40637         return ret_conv;
40638 }
40639
40640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40641         LDKOpenChannelV2 this_ptr_conv;
40642         this_ptr_conv.inner = untag_ptr(this_ptr);
40643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40645         this_ptr_conv.is_owned = false;
40646         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
40647 }
40648
40649 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
40650         LDKOpenChannelV2 this_ptr_conv;
40651         this_ptr_conv.inner = untag_ptr(this_ptr);
40652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40654         this_ptr_conv.is_owned = false;
40655         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
40656         return ret_conv;
40657 }
40658
40659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40660         LDKOpenChannelV2 this_ptr_conv;
40661         this_ptr_conv.inner = untag_ptr(this_ptr);
40662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40664         this_ptr_conv.is_owned = false;
40665         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
40666 }
40667
40668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40669         LDKOpenChannelV2 this_ptr_conv;
40670         this_ptr_conv.inner = untag_ptr(this_ptr);
40671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40673         this_ptr_conv.is_owned = false;
40674         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
40675         return ret_conv;
40676 }
40677
40678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40679         LDKOpenChannelV2 this_ptr_conv;
40680         this_ptr_conv.inner = untag_ptr(this_ptr);
40681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40683         this_ptr_conv.is_owned = false;
40684         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
40685 }
40686
40687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40688         LDKOpenChannelV2 this_ptr_conv;
40689         this_ptr_conv.inner = untag_ptr(this_ptr);
40690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40692         this_ptr_conv.is_owned = false;
40693         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
40694         return ret_conv;
40695 }
40696
40697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40698         LDKOpenChannelV2 this_ptr_conv;
40699         this_ptr_conv.inner = untag_ptr(this_ptr);
40700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40702         this_ptr_conv.is_owned = false;
40703         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
40704 }
40705
40706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40707         LDKOpenChannelV2 this_ptr_conv;
40708         this_ptr_conv.inner = untag_ptr(this_ptr);
40709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40711         this_ptr_conv.is_owned = false;
40712         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
40713         return ret_conv;
40714 }
40715
40716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40717         LDKOpenChannelV2 this_ptr_conv;
40718         this_ptr_conv.inner = untag_ptr(this_ptr);
40719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40721         this_ptr_conv.is_owned = false;
40722         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
40723 }
40724
40725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40726         LDKOpenChannelV2 this_ptr_conv;
40727         this_ptr_conv.inner = untag_ptr(this_ptr);
40728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40730         this_ptr_conv.is_owned = false;
40731         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
40732         return ret_conv;
40733 }
40734
40735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40736         LDKOpenChannelV2 this_ptr_conv;
40737         this_ptr_conv.inner = untag_ptr(this_ptr);
40738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40740         this_ptr_conv.is_owned = false;
40741         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
40742 }
40743
40744 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
40745         LDKOpenChannelV2 this_ptr_conv;
40746         this_ptr_conv.inner = untag_ptr(this_ptr);
40747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40749         this_ptr_conv.is_owned = false;
40750         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
40751         return ret_conv;
40752 }
40753
40754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40755         LDKOpenChannelV2 this_ptr_conv;
40756         this_ptr_conv.inner = untag_ptr(this_ptr);
40757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40759         this_ptr_conv.is_owned = false;
40760         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
40761 }
40762
40763 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40764         LDKOpenChannelV2 this_ptr_conv;
40765         this_ptr_conv.inner = untag_ptr(this_ptr);
40766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40768         this_ptr_conv.is_owned = false;
40769         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
40770         return ret_conv;
40771 }
40772
40773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40774         LDKOpenChannelV2 this_ptr_conv;
40775         this_ptr_conv.inner = untag_ptr(this_ptr);
40776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40778         this_ptr_conv.is_owned = false;
40779         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
40780 }
40781
40782 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
40783         LDKOpenChannelV2 this_ptr_conv;
40784         this_ptr_conv.inner = untag_ptr(this_ptr);
40785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40787         this_ptr_conv.is_owned = false;
40788         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
40789         return ret_conv;
40790 }
40791
40792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40793         LDKOpenChannelV2 this_ptr_conv;
40794         this_ptr_conv.inner = untag_ptr(this_ptr);
40795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40797         this_ptr_conv.is_owned = false;
40798         OpenChannelV2_set_locktime(&this_ptr_conv, val);
40799 }
40800
40801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40802         LDKOpenChannelV2 this_ptr_conv;
40803         this_ptr_conv.inner = untag_ptr(this_ptr);
40804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40806         this_ptr_conv.is_owned = false;
40807         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40808         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
40809         return ret_arr;
40810 }
40811
40812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40813         LDKOpenChannelV2 this_ptr_conv;
40814         this_ptr_conv.inner = untag_ptr(this_ptr);
40815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40817         this_ptr_conv.is_owned = false;
40818         LDKPublicKey val_ref;
40819         CHECK((*env)->GetArrayLength(env, val) == 33);
40820         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40821         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
40822 }
40823
40824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40825         LDKOpenChannelV2 this_ptr_conv;
40826         this_ptr_conv.inner = untag_ptr(this_ptr);
40827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40829         this_ptr_conv.is_owned = false;
40830         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40831         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
40832         return ret_arr;
40833 }
40834
40835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40836         LDKOpenChannelV2 this_ptr_conv;
40837         this_ptr_conv.inner = untag_ptr(this_ptr);
40838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40840         this_ptr_conv.is_owned = false;
40841         LDKPublicKey val_ref;
40842         CHECK((*env)->GetArrayLength(env, val) == 33);
40843         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40844         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
40845 }
40846
40847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40848         LDKOpenChannelV2 this_ptr_conv;
40849         this_ptr_conv.inner = untag_ptr(this_ptr);
40850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40852         this_ptr_conv.is_owned = false;
40853         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40854         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
40855         return ret_arr;
40856 }
40857
40858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40859         LDKOpenChannelV2 this_ptr_conv;
40860         this_ptr_conv.inner = untag_ptr(this_ptr);
40861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40863         this_ptr_conv.is_owned = false;
40864         LDKPublicKey val_ref;
40865         CHECK((*env)->GetArrayLength(env, val) == 33);
40866         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40867         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
40868 }
40869
40870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40871         LDKOpenChannelV2 this_ptr_conv;
40872         this_ptr_conv.inner = untag_ptr(this_ptr);
40873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40875         this_ptr_conv.is_owned = false;
40876         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40877         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
40878         return ret_arr;
40879 }
40880
40881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40882         LDKOpenChannelV2 this_ptr_conv;
40883         this_ptr_conv.inner = untag_ptr(this_ptr);
40884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40886         this_ptr_conv.is_owned = false;
40887         LDKPublicKey val_ref;
40888         CHECK((*env)->GetArrayLength(env, val) == 33);
40889         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40890         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
40891 }
40892
40893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40894         LDKOpenChannelV2 this_ptr_conv;
40895         this_ptr_conv.inner = untag_ptr(this_ptr);
40896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40898         this_ptr_conv.is_owned = false;
40899         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40900         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
40901         return ret_arr;
40902 }
40903
40904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40905         LDKOpenChannelV2 this_ptr_conv;
40906         this_ptr_conv.inner = untag_ptr(this_ptr);
40907         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40909         this_ptr_conv.is_owned = false;
40910         LDKPublicKey val_ref;
40911         CHECK((*env)->GetArrayLength(env, val) == 33);
40912         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40913         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
40914 }
40915
40916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
40917         LDKOpenChannelV2 this_ptr_conv;
40918         this_ptr_conv.inner = untag_ptr(this_ptr);
40919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40921         this_ptr_conv.is_owned = false;
40922         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40923         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
40924         return ret_arr;
40925 }
40926
40927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40928         LDKOpenChannelV2 this_ptr_conv;
40929         this_ptr_conv.inner = untag_ptr(this_ptr);
40930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40932         this_ptr_conv.is_owned = false;
40933         LDKPublicKey val_ref;
40934         CHECK((*env)->GetArrayLength(env, val) == 33);
40935         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40936         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
40937 }
40938
40939 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
40940         LDKOpenChannelV2 this_ptr_conv;
40941         this_ptr_conv.inner = untag_ptr(this_ptr);
40942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40944         this_ptr_conv.is_owned = false;
40945         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40946         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
40947         return ret_arr;
40948 }
40949
40950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40951         LDKOpenChannelV2 this_ptr_conv;
40952         this_ptr_conv.inner = untag_ptr(this_ptr);
40953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40955         this_ptr_conv.is_owned = false;
40956         LDKPublicKey val_ref;
40957         CHECK((*env)->GetArrayLength(env, val) == 33);
40958         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40959         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
40960 }
40961
40962 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
40963         LDKOpenChannelV2 this_ptr_conv;
40964         this_ptr_conv.inner = untag_ptr(this_ptr);
40965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40967         this_ptr_conv.is_owned = false;
40968         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
40969         return ret_conv;
40970 }
40971
40972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
40973         LDKOpenChannelV2 this_ptr_conv;
40974         this_ptr_conv.inner = untag_ptr(this_ptr);
40975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40977         this_ptr_conv.is_owned = false;
40978         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
40979 }
40980
40981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40982         LDKOpenChannelV2 this_ptr_conv;
40983         this_ptr_conv.inner = untag_ptr(this_ptr);
40984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40986         this_ptr_conv.is_owned = false;
40987         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
40988         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
40989         int64_t ret_ref = tag_ptr(ret_copy, true);
40990         return ret_ref;
40991 }
40992
40993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40994         LDKOpenChannelV2 this_ptr_conv;
40995         this_ptr_conv.inner = untag_ptr(this_ptr);
40996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40998         this_ptr_conv.is_owned = false;
40999         void* val_ptr = untag_ptr(val);
41000         CHECK_ACCESS(val_ptr);
41001         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
41002         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
41003         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
41004 }
41005
41006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
41007         LDKOpenChannelV2 this_ptr_conv;
41008         this_ptr_conv.inner = untag_ptr(this_ptr);
41009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41011         this_ptr_conv.is_owned = false;
41012         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
41013         int64_t ret_ref = 0;
41014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41016         return ret_ref;
41017 }
41018
41019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41020         LDKOpenChannelV2 this_ptr_conv;
41021         this_ptr_conv.inner = untag_ptr(this_ptr);
41022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41024         this_ptr_conv.is_owned = false;
41025         LDKChannelTypeFeatures val_conv;
41026         val_conv.inner = untag_ptr(val);
41027         val_conv.is_owned = ptr_is_owned(val);
41028         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41029         val_conv = ChannelTypeFeatures_clone(&val_conv);
41030         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
41031 }
41032
41033 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
41034         LDKOpenChannelV2 this_ptr_conv;
41035         this_ptr_conv.inner = untag_ptr(this_ptr);
41036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41038         this_ptr_conv.is_owned = false;
41039         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
41040         return ret_conv;
41041 }
41042
41043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
41044         LDKOpenChannelV2 this_ptr_conv;
41045         this_ptr_conv.inner = untag_ptr(this_ptr);
41046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41048         this_ptr_conv.is_owned = false;
41049         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
41050         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
41051 }
41052
41053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int8_tArray temporary_channel_id_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t commitment_feerate_sat_per_1000_weight_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
41054         LDKThirtyTwoBytes chain_hash_arg_ref;
41055         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
41056         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
41057         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
41058         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
41059         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
41060         LDKPublicKey funding_pubkey_arg_ref;
41061         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
41062         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
41063         LDKPublicKey revocation_basepoint_arg_ref;
41064         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
41065         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
41066         LDKPublicKey payment_basepoint_arg_ref;
41067         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
41068         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
41069         LDKPublicKey delayed_payment_basepoint_arg_ref;
41070         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
41071         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
41072         LDKPublicKey htlc_basepoint_arg_ref;
41073         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
41074         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
41075         LDKPublicKey first_per_commitment_point_arg_ref;
41076         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
41077         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
41078         LDKPublicKey second_per_commitment_point_arg_ref;
41079         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
41080         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
41081         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
41082         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
41083         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
41084         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
41085         LDKChannelTypeFeatures channel_type_arg_conv;
41086         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
41087         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
41088         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
41089         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
41090         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
41091         LDKOpenChannelV2 ret_var = OpenChannelV2_new(chain_hash_arg_ref, temporary_channel_id_arg_ref, funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
41092         int64_t ret_ref = 0;
41093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41095         return ret_ref;
41096 }
41097
41098 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
41099         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
41100         int64_t ret_ref = 0;
41101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41103         return ret_ref;
41104 }
41105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41106         LDKOpenChannelV2 arg_conv;
41107         arg_conv.inner = untag_ptr(arg);
41108         arg_conv.is_owned = ptr_is_owned(arg);
41109         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41110         arg_conv.is_owned = false;
41111         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
41112         return ret_conv;
41113 }
41114
41115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41116         LDKOpenChannelV2 orig_conv;
41117         orig_conv.inner = untag_ptr(orig);
41118         orig_conv.is_owned = ptr_is_owned(orig);
41119         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41120         orig_conv.is_owned = false;
41121         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
41122         int64_t ret_ref = 0;
41123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41125         return ret_ref;
41126 }
41127
41128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41129         LDKOpenChannelV2 a_conv;
41130         a_conv.inner = untag_ptr(a);
41131         a_conv.is_owned = ptr_is_owned(a);
41132         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41133         a_conv.is_owned = false;
41134         LDKOpenChannelV2 b_conv;
41135         b_conv.inner = untag_ptr(b);
41136         b_conv.is_owned = ptr_is_owned(b);
41137         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41138         b_conv.is_owned = false;
41139         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
41140         return ret_conv;
41141 }
41142
41143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41144         LDKAcceptChannel this_obj_conv;
41145         this_obj_conv.inner = untag_ptr(this_obj);
41146         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41148         AcceptChannel_free(this_obj_conv);
41149 }
41150
41151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41152         LDKAcceptChannel this_ptr_conv;
41153         this_ptr_conv.inner = untag_ptr(this_ptr);
41154         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41156         this_ptr_conv.is_owned = false;
41157         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41158         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
41159         return ret_arr;
41160 }
41161
41162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41163         LDKAcceptChannel this_ptr_conv;
41164         this_ptr_conv.inner = untag_ptr(this_ptr);
41165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41167         this_ptr_conv.is_owned = false;
41168         LDKThirtyTwoBytes val_ref;
41169         CHECK((*env)->GetArrayLength(env, val) == 32);
41170         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41171         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
41172 }
41173
41174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
41175         LDKAcceptChannel this_ptr_conv;
41176         this_ptr_conv.inner = untag_ptr(this_ptr);
41177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41179         this_ptr_conv.is_owned = false;
41180         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
41181         return ret_conv;
41182 }
41183
41184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41185         LDKAcceptChannel this_ptr_conv;
41186         this_ptr_conv.inner = untag_ptr(this_ptr);
41187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41189         this_ptr_conv.is_owned = false;
41190         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
41191 }
41192
41193 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) {
41194         LDKAcceptChannel this_ptr_conv;
41195         this_ptr_conv.inner = untag_ptr(this_ptr);
41196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41198         this_ptr_conv.is_owned = false;
41199         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41200         return ret_conv;
41201 }
41202
41203 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) {
41204         LDKAcceptChannel this_ptr_conv;
41205         this_ptr_conv.inner = untag_ptr(this_ptr);
41206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41208         this_ptr_conv.is_owned = false;
41209         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41210 }
41211
41212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
41213         LDKAcceptChannel this_ptr_conv;
41214         this_ptr_conv.inner = untag_ptr(this_ptr);
41215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41217         this_ptr_conv.is_owned = false;
41218         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
41219         return ret_conv;
41220 }
41221
41222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41223         LDKAcceptChannel this_ptr_conv;
41224         this_ptr_conv.inner = untag_ptr(this_ptr);
41225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41227         this_ptr_conv.is_owned = false;
41228         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
41229 }
41230
41231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41232         LDKAcceptChannel this_ptr_conv;
41233         this_ptr_conv.inner = untag_ptr(this_ptr);
41234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41236         this_ptr_conv.is_owned = false;
41237         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
41238         return ret_conv;
41239 }
41240
41241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41242         LDKAcceptChannel this_ptr_conv;
41243         this_ptr_conv.inner = untag_ptr(this_ptr);
41244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41246         this_ptr_conv.is_owned = false;
41247         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
41248 }
41249
41250 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
41251         LDKAcceptChannel this_ptr_conv;
41252         this_ptr_conv.inner = untag_ptr(this_ptr);
41253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41255         this_ptr_conv.is_owned = false;
41256         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
41257         return ret_conv;
41258 }
41259
41260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41261         LDKAcceptChannel this_ptr_conv;
41262         this_ptr_conv.inner = untag_ptr(this_ptr);
41263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41265         this_ptr_conv.is_owned = false;
41266         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
41267 }
41268
41269 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
41270         LDKAcceptChannel this_ptr_conv;
41271         this_ptr_conv.inner = untag_ptr(this_ptr);
41272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41274         this_ptr_conv.is_owned = false;
41275         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
41276         return ret_conv;
41277 }
41278
41279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41280         LDKAcceptChannel this_ptr_conv;
41281         this_ptr_conv.inner = untag_ptr(this_ptr);
41282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41284         this_ptr_conv.is_owned = false;
41285         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
41286 }
41287
41288 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
41289         LDKAcceptChannel this_ptr_conv;
41290         this_ptr_conv.inner = untag_ptr(this_ptr);
41291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41293         this_ptr_conv.is_owned = false;
41294         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
41295         return ret_conv;
41296 }
41297
41298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41299         LDKAcceptChannel this_ptr_conv;
41300         this_ptr_conv.inner = untag_ptr(this_ptr);
41301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41303         this_ptr_conv.is_owned = false;
41304         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
41305 }
41306
41307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41308         LDKAcceptChannel this_ptr_conv;
41309         this_ptr_conv.inner = untag_ptr(this_ptr);
41310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41312         this_ptr_conv.is_owned = false;
41313         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41314         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
41315         return ret_arr;
41316 }
41317
41318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41319         LDKAcceptChannel this_ptr_conv;
41320         this_ptr_conv.inner = untag_ptr(this_ptr);
41321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41323         this_ptr_conv.is_owned = false;
41324         LDKPublicKey val_ref;
41325         CHECK((*env)->GetArrayLength(env, val) == 33);
41326         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41327         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
41328 }
41329
41330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41331         LDKAcceptChannel this_ptr_conv;
41332         this_ptr_conv.inner = untag_ptr(this_ptr);
41333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41335         this_ptr_conv.is_owned = false;
41336         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41337         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
41338         return ret_arr;
41339 }
41340
41341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41342         LDKAcceptChannel this_ptr_conv;
41343         this_ptr_conv.inner = untag_ptr(this_ptr);
41344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41346         this_ptr_conv.is_owned = false;
41347         LDKPublicKey val_ref;
41348         CHECK((*env)->GetArrayLength(env, val) == 33);
41349         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41350         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
41351 }
41352
41353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41354         LDKAcceptChannel this_ptr_conv;
41355         this_ptr_conv.inner = untag_ptr(this_ptr);
41356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41358         this_ptr_conv.is_owned = false;
41359         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41360         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
41361         return ret_arr;
41362 }
41363
41364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41365         LDKAcceptChannel this_ptr_conv;
41366         this_ptr_conv.inner = untag_ptr(this_ptr);
41367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41369         this_ptr_conv.is_owned = false;
41370         LDKPublicKey val_ref;
41371         CHECK((*env)->GetArrayLength(env, val) == 33);
41372         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41373         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
41374 }
41375
41376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41377         LDKAcceptChannel this_ptr_conv;
41378         this_ptr_conv.inner = untag_ptr(this_ptr);
41379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41381         this_ptr_conv.is_owned = false;
41382         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41383         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
41384         return ret_arr;
41385 }
41386
41387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41388         LDKAcceptChannel this_ptr_conv;
41389         this_ptr_conv.inner = untag_ptr(this_ptr);
41390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41392         this_ptr_conv.is_owned = false;
41393         LDKPublicKey val_ref;
41394         CHECK((*env)->GetArrayLength(env, val) == 33);
41395         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41396         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
41397 }
41398
41399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41400         LDKAcceptChannel this_ptr_conv;
41401         this_ptr_conv.inner = untag_ptr(this_ptr);
41402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41404         this_ptr_conv.is_owned = false;
41405         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41406         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
41407         return ret_arr;
41408 }
41409
41410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41411         LDKAcceptChannel this_ptr_conv;
41412         this_ptr_conv.inner = untag_ptr(this_ptr);
41413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41415         this_ptr_conv.is_owned = false;
41416         LDKPublicKey val_ref;
41417         CHECK((*env)->GetArrayLength(env, val) == 33);
41418         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41419         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
41420 }
41421
41422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41423         LDKAcceptChannel this_ptr_conv;
41424         this_ptr_conv.inner = untag_ptr(this_ptr);
41425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41427         this_ptr_conv.is_owned = false;
41428         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41429         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
41430         return ret_arr;
41431 }
41432
41433 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) {
41434         LDKAcceptChannel this_ptr_conv;
41435         this_ptr_conv.inner = untag_ptr(this_ptr);
41436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41438         this_ptr_conv.is_owned = false;
41439         LDKPublicKey val_ref;
41440         CHECK((*env)->GetArrayLength(env, val) == 33);
41441         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41442         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
41443 }
41444
41445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41446         LDKAcceptChannel this_ptr_conv;
41447         this_ptr_conv.inner = untag_ptr(this_ptr);
41448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41450         this_ptr_conv.is_owned = false;
41451         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
41452         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
41453         int64_t ret_ref = tag_ptr(ret_copy, true);
41454         return ret_ref;
41455 }
41456
41457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41458         LDKAcceptChannel this_ptr_conv;
41459         this_ptr_conv.inner = untag_ptr(this_ptr);
41460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41462         this_ptr_conv.is_owned = false;
41463         void* val_ptr = untag_ptr(val);
41464         CHECK_ACCESS(val_ptr);
41465         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
41466         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
41467         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
41468 }
41469
41470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
41471         LDKAcceptChannel this_ptr_conv;
41472         this_ptr_conv.inner = untag_ptr(this_ptr);
41473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41475         this_ptr_conv.is_owned = false;
41476         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
41477         int64_t ret_ref = 0;
41478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41480         return ret_ref;
41481 }
41482
41483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41484         LDKAcceptChannel this_ptr_conv;
41485         this_ptr_conv.inner = untag_ptr(this_ptr);
41486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41488         this_ptr_conv.is_owned = false;
41489         LDKChannelTypeFeatures val_conv;
41490         val_conv.inner = untag_ptr(val);
41491         val_conv.is_owned = ptr_is_owned(val);
41492         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41493         val_conv = ChannelTypeFeatures_clone(&val_conv);
41494         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
41495 }
41496
41497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t channel_reserve_satoshis_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, 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, int8_tArray first_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
41498         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
41499         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
41500         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
41501         LDKPublicKey funding_pubkey_arg_ref;
41502         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
41503         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
41504         LDKPublicKey revocation_basepoint_arg_ref;
41505         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
41506         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
41507         LDKPublicKey payment_point_arg_ref;
41508         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
41509         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
41510         LDKPublicKey delayed_payment_basepoint_arg_ref;
41511         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
41512         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
41513         LDKPublicKey htlc_basepoint_arg_ref;
41514         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
41515         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
41516         LDKPublicKey first_per_commitment_point_arg_ref;
41517         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
41518         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
41519         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
41520         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
41521         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
41522         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
41523         LDKChannelTypeFeatures channel_type_arg_conv;
41524         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
41525         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
41526         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
41527         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
41528         LDKAcceptChannel ret_var = AcceptChannel_new(temporary_channel_id_arg_ref, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
41529         int64_t ret_ref = 0;
41530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41532         return ret_ref;
41533 }
41534
41535 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
41536         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
41537         int64_t ret_ref = 0;
41538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41540         return ret_ref;
41541 }
41542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41543         LDKAcceptChannel arg_conv;
41544         arg_conv.inner = untag_ptr(arg);
41545         arg_conv.is_owned = ptr_is_owned(arg);
41546         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41547         arg_conv.is_owned = false;
41548         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
41549         return ret_conv;
41550 }
41551
41552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41553         LDKAcceptChannel orig_conv;
41554         orig_conv.inner = untag_ptr(orig);
41555         orig_conv.is_owned = ptr_is_owned(orig);
41556         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41557         orig_conv.is_owned = false;
41558         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
41559         int64_t ret_ref = 0;
41560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41562         return ret_ref;
41563 }
41564
41565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41566         LDKAcceptChannel a_conv;
41567         a_conv.inner = untag_ptr(a);
41568         a_conv.is_owned = ptr_is_owned(a);
41569         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41570         a_conv.is_owned = false;
41571         LDKAcceptChannel b_conv;
41572         b_conv.inner = untag_ptr(b);
41573         b_conv.is_owned = ptr_is_owned(b);
41574         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41575         b_conv.is_owned = false;
41576         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
41577         return ret_conv;
41578 }
41579
41580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41581         LDKAcceptChannelV2 this_obj_conv;
41582         this_obj_conv.inner = untag_ptr(this_obj);
41583         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41585         AcceptChannelV2_free(this_obj_conv);
41586 }
41587
41588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41589         LDKAcceptChannelV2 this_ptr_conv;
41590         this_ptr_conv.inner = untag_ptr(this_ptr);
41591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41593         this_ptr_conv.is_owned = false;
41594         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41595         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv));
41596         return ret_arr;
41597 }
41598
41599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41600         LDKAcceptChannelV2 this_ptr_conv;
41601         this_ptr_conv.inner = untag_ptr(this_ptr);
41602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41604         this_ptr_conv.is_owned = false;
41605         LDKThirtyTwoBytes val_ref;
41606         CHECK((*env)->GetArrayLength(env, val) == 32);
41607         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41608         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
41609 }
41610
41611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
41612         LDKAcceptChannelV2 this_ptr_conv;
41613         this_ptr_conv.inner = untag_ptr(this_ptr);
41614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41616         this_ptr_conv.is_owned = false;
41617         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
41618         return ret_conv;
41619 }
41620
41621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41622         LDKAcceptChannelV2 this_ptr_conv;
41623         this_ptr_conv.inner = untag_ptr(this_ptr);
41624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41626         this_ptr_conv.is_owned = false;
41627         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
41628 }
41629
41630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
41631         LDKAcceptChannelV2 this_ptr_conv;
41632         this_ptr_conv.inner = untag_ptr(this_ptr);
41633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41635         this_ptr_conv.is_owned = false;
41636         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
41637         return ret_conv;
41638 }
41639
41640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41641         LDKAcceptChannelV2 this_ptr_conv;
41642         this_ptr_conv.inner = untag_ptr(this_ptr);
41643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41645         this_ptr_conv.is_owned = false;
41646         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
41647 }
41648
41649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41650         LDKAcceptChannelV2 this_ptr_conv;
41651         this_ptr_conv.inner = untag_ptr(this_ptr);
41652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41654         this_ptr_conv.is_owned = false;
41655         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41656         return ret_conv;
41657 }
41658
41659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41660         LDKAcceptChannelV2 this_ptr_conv;
41661         this_ptr_conv.inner = untag_ptr(this_ptr);
41662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41664         this_ptr_conv.is_owned = false;
41665         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41666 }
41667
41668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41669         LDKAcceptChannelV2 this_ptr_conv;
41670         this_ptr_conv.inner = untag_ptr(this_ptr);
41671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41673         this_ptr_conv.is_owned = false;
41674         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
41675         return ret_conv;
41676 }
41677
41678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41679         LDKAcceptChannelV2 this_ptr_conv;
41680         this_ptr_conv.inner = untag_ptr(this_ptr);
41681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41683         this_ptr_conv.is_owned = false;
41684         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
41685 }
41686
41687 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
41688         LDKAcceptChannelV2 this_ptr_conv;
41689         this_ptr_conv.inner = untag_ptr(this_ptr);
41690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41692         this_ptr_conv.is_owned = false;
41693         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
41694         return ret_conv;
41695 }
41696
41697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41698         LDKAcceptChannelV2 this_ptr_conv;
41699         this_ptr_conv.inner = untag_ptr(this_ptr);
41700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41702         this_ptr_conv.is_owned = false;
41703         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
41704 }
41705
41706 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
41707         LDKAcceptChannelV2 this_ptr_conv;
41708         this_ptr_conv.inner = untag_ptr(this_ptr);
41709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41711         this_ptr_conv.is_owned = false;
41712         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
41713         return ret_conv;
41714 }
41715
41716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41717         LDKAcceptChannelV2 this_ptr_conv;
41718         this_ptr_conv.inner = untag_ptr(this_ptr);
41719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41721         this_ptr_conv.is_owned = false;
41722         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
41723 }
41724
41725 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
41726         LDKAcceptChannelV2 this_ptr_conv;
41727         this_ptr_conv.inner = untag_ptr(this_ptr);
41728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41730         this_ptr_conv.is_owned = false;
41731         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
41732         return ret_conv;
41733 }
41734
41735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41736         LDKAcceptChannelV2 this_ptr_conv;
41737         this_ptr_conv.inner = untag_ptr(this_ptr);
41738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41740         this_ptr_conv.is_owned = false;
41741         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
41742 }
41743
41744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41745         LDKAcceptChannelV2 this_ptr_conv;
41746         this_ptr_conv.inner = untag_ptr(this_ptr);
41747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41749         this_ptr_conv.is_owned = false;
41750         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41751         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
41752         return ret_arr;
41753 }
41754
41755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41756         LDKAcceptChannelV2 this_ptr_conv;
41757         this_ptr_conv.inner = untag_ptr(this_ptr);
41758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41760         this_ptr_conv.is_owned = false;
41761         LDKPublicKey val_ref;
41762         CHECK((*env)->GetArrayLength(env, val) == 33);
41763         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41764         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
41765 }
41766
41767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41768         LDKAcceptChannelV2 this_ptr_conv;
41769         this_ptr_conv.inner = untag_ptr(this_ptr);
41770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41772         this_ptr_conv.is_owned = false;
41773         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41774         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
41775         return ret_arr;
41776 }
41777
41778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41779         LDKAcceptChannelV2 this_ptr_conv;
41780         this_ptr_conv.inner = untag_ptr(this_ptr);
41781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41783         this_ptr_conv.is_owned = false;
41784         LDKPublicKey val_ref;
41785         CHECK((*env)->GetArrayLength(env, val) == 33);
41786         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41787         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
41788 }
41789
41790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41791         LDKAcceptChannelV2 this_ptr_conv;
41792         this_ptr_conv.inner = untag_ptr(this_ptr);
41793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41795         this_ptr_conv.is_owned = false;
41796         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41797         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
41798         return ret_arr;
41799 }
41800
41801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41802         LDKAcceptChannelV2 this_ptr_conv;
41803         this_ptr_conv.inner = untag_ptr(this_ptr);
41804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41806         this_ptr_conv.is_owned = false;
41807         LDKPublicKey val_ref;
41808         CHECK((*env)->GetArrayLength(env, val) == 33);
41809         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41810         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
41811 }
41812
41813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41814         LDKAcceptChannelV2 this_ptr_conv;
41815         this_ptr_conv.inner = untag_ptr(this_ptr);
41816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41818         this_ptr_conv.is_owned = false;
41819         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41820         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
41821         return ret_arr;
41822 }
41823
41824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41825         LDKAcceptChannelV2 this_ptr_conv;
41826         this_ptr_conv.inner = untag_ptr(this_ptr);
41827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41829         this_ptr_conv.is_owned = false;
41830         LDKPublicKey val_ref;
41831         CHECK((*env)->GetArrayLength(env, val) == 33);
41832         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41833         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
41834 }
41835
41836 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41837         LDKAcceptChannelV2 this_ptr_conv;
41838         this_ptr_conv.inner = untag_ptr(this_ptr);
41839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41841         this_ptr_conv.is_owned = false;
41842         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41843         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
41844         return ret_arr;
41845 }
41846
41847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41848         LDKAcceptChannelV2 this_ptr_conv;
41849         this_ptr_conv.inner = untag_ptr(this_ptr);
41850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41852         this_ptr_conv.is_owned = false;
41853         LDKPublicKey val_ref;
41854         CHECK((*env)->GetArrayLength(env, val) == 33);
41855         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41856         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
41857 }
41858
41859 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41860         LDKAcceptChannelV2 this_ptr_conv;
41861         this_ptr_conv.inner = untag_ptr(this_ptr);
41862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41864         this_ptr_conv.is_owned = false;
41865         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41866         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
41867         return ret_arr;
41868 }
41869
41870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41871         LDKAcceptChannelV2 this_ptr_conv;
41872         this_ptr_conv.inner = untag_ptr(this_ptr);
41873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41875         this_ptr_conv.is_owned = false;
41876         LDKPublicKey val_ref;
41877         CHECK((*env)->GetArrayLength(env, val) == 33);
41878         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41879         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
41880 }
41881
41882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41883         LDKAcceptChannelV2 this_ptr_conv;
41884         this_ptr_conv.inner = untag_ptr(this_ptr);
41885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41887         this_ptr_conv.is_owned = false;
41888         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41889         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
41890         return ret_arr;
41891 }
41892
41893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41894         LDKAcceptChannelV2 this_ptr_conv;
41895         this_ptr_conv.inner = untag_ptr(this_ptr);
41896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41898         this_ptr_conv.is_owned = false;
41899         LDKPublicKey val_ref;
41900         CHECK((*env)->GetArrayLength(env, val) == 33);
41901         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41902         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
41903 }
41904
41905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41906         LDKAcceptChannelV2 this_ptr_conv;
41907         this_ptr_conv.inner = untag_ptr(this_ptr);
41908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41910         this_ptr_conv.is_owned = false;
41911         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
41912         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
41913         int64_t ret_ref = tag_ptr(ret_copy, true);
41914         return ret_ref;
41915 }
41916
41917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41918         LDKAcceptChannelV2 this_ptr_conv;
41919         this_ptr_conv.inner = untag_ptr(this_ptr);
41920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41922         this_ptr_conv.is_owned = false;
41923         void* val_ptr = untag_ptr(val);
41924         CHECK_ACCESS(val_ptr);
41925         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
41926         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
41927         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
41928 }
41929
41930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
41931         LDKAcceptChannelV2 this_ptr_conv;
41932         this_ptr_conv.inner = untag_ptr(this_ptr);
41933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41935         this_ptr_conv.is_owned = false;
41936         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
41937         int64_t ret_ref = 0;
41938         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41939         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41940         return ret_ref;
41941 }
41942
41943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41944         LDKAcceptChannelV2 this_ptr_conv;
41945         this_ptr_conv.inner = untag_ptr(this_ptr);
41946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41948         this_ptr_conv.is_owned = false;
41949         LDKChannelTypeFeatures val_conv;
41950         val_conv.inner = untag_ptr(val);
41951         val_conv.is_owned = ptr_is_owned(val);
41952         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41953         val_conv = ChannelTypeFeatures_clone(&val_conv);
41954         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
41955 }
41956
41957 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
41958         LDKAcceptChannelV2 this_ptr_conv;
41959         this_ptr_conv.inner = untag_ptr(this_ptr);
41960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41962         this_ptr_conv.is_owned = false;
41963         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
41964         return ret_conv;
41965 }
41966
41967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
41968         LDKAcceptChannelV2 this_ptr_conv;
41969         this_ptr_conv.inner = untag_ptr(this_ptr);
41970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41972         this_ptr_conv.is_owned = false;
41973         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
41974         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
41975 }
41976
41977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_tArray second_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg, jclass require_confirmed_inputs_arg) {
41978         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
41979         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
41980         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
41981         LDKPublicKey funding_pubkey_arg_ref;
41982         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
41983         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
41984         LDKPublicKey revocation_basepoint_arg_ref;
41985         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
41986         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
41987         LDKPublicKey payment_basepoint_arg_ref;
41988         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
41989         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
41990         LDKPublicKey delayed_payment_basepoint_arg_ref;
41991         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
41992         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
41993         LDKPublicKey htlc_basepoint_arg_ref;
41994         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
41995         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
41996         LDKPublicKey first_per_commitment_point_arg_ref;
41997         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
41998         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
41999         LDKPublicKey second_per_commitment_point_arg_ref;
42000         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
42001         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
42002         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42003         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42004         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
42005         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
42006         LDKChannelTypeFeatures channel_type_arg_conv;
42007         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42008         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42009         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42010         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42011         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
42012         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(temporary_channel_id_arg_ref, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, second_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv, require_confirmed_inputs_arg_conv);
42013         int64_t ret_ref = 0;
42014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42016         return ret_ref;
42017 }
42018
42019 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
42020         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
42021         int64_t ret_ref = 0;
42022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42024         return ret_ref;
42025 }
42026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42027         LDKAcceptChannelV2 arg_conv;
42028         arg_conv.inner = untag_ptr(arg);
42029         arg_conv.is_owned = ptr_is_owned(arg);
42030         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42031         arg_conv.is_owned = false;
42032         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
42033         return ret_conv;
42034 }
42035
42036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42037         LDKAcceptChannelV2 orig_conv;
42038         orig_conv.inner = untag_ptr(orig);
42039         orig_conv.is_owned = ptr_is_owned(orig);
42040         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42041         orig_conv.is_owned = false;
42042         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
42043         int64_t ret_ref = 0;
42044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42046         return ret_ref;
42047 }
42048
42049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42050         LDKAcceptChannelV2 a_conv;
42051         a_conv.inner = untag_ptr(a);
42052         a_conv.is_owned = ptr_is_owned(a);
42053         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42054         a_conv.is_owned = false;
42055         LDKAcceptChannelV2 b_conv;
42056         b_conv.inner = untag_ptr(b);
42057         b_conv.is_owned = ptr_is_owned(b);
42058         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42059         b_conv.is_owned = false;
42060         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
42061         return ret_conv;
42062 }
42063
42064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42065         LDKFundingCreated this_obj_conv;
42066         this_obj_conv.inner = untag_ptr(this_obj);
42067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42069         FundingCreated_free(this_obj_conv);
42070 }
42071
42072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42073         LDKFundingCreated this_ptr_conv;
42074         this_ptr_conv.inner = untag_ptr(this_ptr);
42075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42077         this_ptr_conv.is_owned = false;
42078         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42079         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
42080         return ret_arr;
42081 }
42082
42083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42084         LDKFundingCreated this_ptr_conv;
42085         this_ptr_conv.inner = untag_ptr(this_ptr);
42086         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42088         this_ptr_conv.is_owned = false;
42089         LDKThirtyTwoBytes val_ref;
42090         CHECK((*env)->GetArrayLength(env, val) == 32);
42091         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42092         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
42093 }
42094
42095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
42096         LDKFundingCreated this_ptr_conv;
42097         this_ptr_conv.inner = untag_ptr(this_ptr);
42098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42100         this_ptr_conv.is_owned = false;
42101         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42102         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
42103         return ret_arr;
42104 }
42105
42106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42107         LDKFundingCreated this_ptr_conv;
42108         this_ptr_conv.inner = untag_ptr(this_ptr);
42109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42111         this_ptr_conv.is_owned = false;
42112         LDKThirtyTwoBytes val_ref;
42113         CHECK((*env)->GetArrayLength(env, val) == 32);
42114         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42115         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
42116 }
42117
42118 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
42119         LDKFundingCreated this_ptr_conv;
42120         this_ptr_conv.inner = untag_ptr(this_ptr);
42121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42123         this_ptr_conv.is_owned = false;
42124         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
42125         return ret_conv;
42126 }
42127
42128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42129         LDKFundingCreated this_ptr_conv;
42130         this_ptr_conv.inner = untag_ptr(this_ptr);
42131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42133         this_ptr_conv.is_owned = false;
42134         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
42135 }
42136
42137 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
42138         LDKFundingCreated this_ptr_conv;
42139         this_ptr_conv.inner = untag_ptr(this_ptr);
42140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42142         this_ptr_conv.is_owned = false;
42143         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
42144         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
42145         return ret_arr;
42146 }
42147
42148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42149         LDKFundingCreated this_ptr_conv;
42150         this_ptr_conv.inner = untag_ptr(this_ptr);
42151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42153         this_ptr_conv.is_owned = false;
42154         LDKSignature val_ref;
42155         CHECK((*env)->GetArrayLength(env, val) == 64);
42156         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
42157         FundingCreated_set_signature(&this_ptr_conv, val_ref);
42158 }
42159
42160 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) {
42161         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42162         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
42163         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
42164         LDKThirtyTwoBytes funding_txid_arg_ref;
42165         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
42166         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
42167         LDKSignature signature_arg_ref;
42168         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
42169         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
42170         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
42171         int64_t ret_ref = 0;
42172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42174         return ret_ref;
42175 }
42176
42177 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
42178         LDKFundingCreated ret_var = FundingCreated_clone(arg);
42179         int64_t ret_ref = 0;
42180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42182         return ret_ref;
42183 }
42184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42185         LDKFundingCreated arg_conv;
42186         arg_conv.inner = untag_ptr(arg);
42187         arg_conv.is_owned = ptr_is_owned(arg);
42188         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42189         arg_conv.is_owned = false;
42190         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
42191         return ret_conv;
42192 }
42193
42194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42195         LDKFundingCreated orig_conv;
42196         orig_conv.inner = untag_ptr(orig);
42197         orig_conv.is_owned = ptr_is_owned(orig);
42198         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42199         orig_conv.is_owned = false;
42200         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
42201         int64_t ret_ref = 0;
42202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42204         return ret_ref;
42205 }
42206
42207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42208         LDKFundingCreated a_conv;
42209         a_conv.inner = untag_ptr(a);
42210         a_conv.is_owned = ptr_is_owned(a);
42211         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42212         a_conv.is_owned = false;
42213         LDKFundingCreated b_conv;
42214         b_conv.inner = untag_ptr(b);
42215         b_conv.is_owned = ptr_is_owned(b);
42216         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42217         b_conv.is_owned = false;
42218         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
42219         return ret_conv;
42220 }
42221
42222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42223         LDKFundingSigned this_obj_conv;
42224         this_obj_conv.inner = untag_ptr(this_obj);
42225         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42227         FundingSigned_free(this_obj_conv);
42228 }
42229
42230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42231         LDKFundingSigned this_ptr_conv;
42232         this_ptr_conv.inner = untag_ptr(this_ptr);
42233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42235         this_ptr_conv.is_owned = false;
42236         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42237         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
42238         return ret_arr;
42239 }
42240
42241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42242         LDKFundingSigned this_ptr_conv;
42243         this_ptr_conv.inner = untag_ptr(this_ptr);
42244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42246         this_ptr_conv.is_owned = false;
42247         LDKThirtyTwoBytes val_ref;
42248         CHECK((*env)->GetArrayLength(env, val) == 32);
42249         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42250         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
42251 }
42252
42253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
42254         LDKFundingSigned this_ptr_conv;
42255         this_ptr_conv.inner = untag_ptr(this_ptr);
42256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42258         this_ptr_conv.is_owned = false;
42259         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
42260         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
42261         return ret_arr;
42262 }
42263
42264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42265         LDKFundingSigned this_ptr_conv;
42266         this_ptr_conv.inner = untag_ptr(this_ptr);
42267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42269         this_ptr_conv.is_owned = false;
42270         LDKSignature val_ref;
42271         CHECK((*env)->GetArrayLength(env, val) == 64);
42272         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
42273         FundingSigned_set_signature(&this_ptr_conv, val_ref);
42274 }
42275
42276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
42277         LDKThirtyTwoBytes channel_id_arg_ref;
42278         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42279         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42280         LDKSignature signature_arg_ref;
42281         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
42282         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
42283         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
42284         int64_t ret_ref = 0;
42285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42287         return ret_ref;
42288 }
42289
42290 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
42291         LDKFundingSigned ret_var = FundingSigned_clone(arg);
42292         int64_t ret_ref = 0;
42293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42295         return ret_ref;
42296 }
42297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42298         LDKFundingSigned arg_conv;
42299         arg_conv.inner = untag_ptr(arg);
42300         arg_conv.is_owned = ptr_is_owned(arg);
42301         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42302         arg_conv.is_owned = false;
42303         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
42304         return ret_conv;
42305 }
42306
42307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42308         LDKFundingSigned orig_conv;
42309         orig_conv.inner = untag_ptr(orig);
42310         orig_conv.is_owned = ptr_is_owned(orig);
42311         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42312         orig_conv.is_owned = false;
42313         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
42314         int64_t ret_ref = 0;
42315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42317         return ret_ref;
42318 }
42319
42320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42321         LDKFundingSigned a_conv;
42322         a_conv.inner = untag_ptr(a);
42323         a_conv.is_owned = ptr_is_owned(a);
42324         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42325         a_conv.is_owned = false;
42326         LDKFundingSigned b_conv;
42327         b_conv.inner = untag_ptr(b);
42328         b_conv.is_owned = ptr_is_owned(b);
42329         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42330         b_conv.is_owned = false;
42331         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
42332         return ret_conv;
42333 }
42334
42335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42336         LDKChannelReady this_obj_conv;
42337         this_obj_conv.inner = untag_ptr(this_obj);
42338         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42340         ChannelReady_free(this_obj_conv);
42341 }
42342
42343 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42344         LDKChannelReady this_ptr_conv;
42345         this_ptr_conv.inner = untag_ptr(this_ptr);
42346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42348         this_ptr_conv.is_owned = false;
42349         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42350         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
42351         return ret_arr;
42352 }
42353
42354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42355         LDKChannelReady this_ptr_conv;
42356         this_ptr_conv.inner = untag_ptr(this_ptr);
42357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42359         this_ptr_conv.is_owned = false;
42360         LDKThirtyTwoBytes val_ref;
42361         CHECK((*env)->GetArrayLength(env, val) == 32);
42362         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42363         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
42364 }
42365
42366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
42367         LDKChannelReady this_ptr_conv;
42368         this_ptr_conv.inner = untag_ptr(this_ptr);
42369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42371         this_ptr_conv.is_owned = false;
42372         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42373         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
42374         return ret_arr;
42375 }
42376
42377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42378         LDKChannelReady this_ptr_conv;
42379         this_ptr_conv.inner = untag_ptr(this_ptr);
42380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42382         this_ptr_conv.is_owned = false;
42383         LDKPublicKey val_ref;
42384         CHECK((*env)->GetArrayLength(env, val) == 33);
42385         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42386         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
42387 }
42388
42389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42390         LDKChannelReady this_ptr_conv;
42391         this_ptr_conv.inner = untag_ptr(this_ptr);
42392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42394         this_ptr_conv.is_owned = false;
42395         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42396         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
42397         int64_t ret_ref = tag_ptr(ret_copy, true);
42398         return ret_ref;
42399 }
42400
42401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42402         LDKChannelReady this_ptr_conv;
42403         this_ptr_conv.inner = untag_ptr(this_ptr);
42404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42406         this_ptr_conv.is_owned = false;
42407         void* val_ptr = untag_ptr(val);
42408         CHECK_ACCESS(val_ptr);
42409         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42410         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42411         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
42412 }
42413
42414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
42415         LDKThirtyTwoBytes channel_id_arg_ref;
42416         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42417         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42418         LDKPublicKey next_per_commitment_point_arg_ref;
42419         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
42420         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
42421         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
42422         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
42423         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
42424         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
42425         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
42426         int64_t ret_ref = 0;
42427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42429         return ret_ref;
42430 }
42431
42432 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
42433         LDKChannelReady ret_var = ChannelReady_clone(arg);
42434         int64_t ret_ref = 0;
42435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42437         return ret_ref;
42438 }
42439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42440         LDKChannelReady arg_conv;
42441         arg_conv.inner = untag_ptr(arg);
42442         arg_conv.is_owned = ptr_is_owned(arg);
42443         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42444         arg_conv.is_owned = false;
42445         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
42446         return ret_conv;
42447 }
42448
42449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42450         LDKChannelReady orig_conv;
42451         orig_conv.inner = untag_ptr(orig);
42452         orig_conv.is_owned = ptr_is_owned(orig);
42453         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42454         orig_conv.is_owned = false;
42455         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
42456         int64_t ret_ref = 0;
42457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42459         return ret_ref;
42460 }
42461
42462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42463         LDKChannelReady a_conv;
42464         a_conv.inner = untag_ptr(a);
42465         a_conv.is_owned = ptr_is_owned(a);
42466         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42467         a_conv.is_owned = false;
42468         LDKChannelReady b_conv;
42469         b_conv.inner = untag_ptr(b);
42470         b_conv.is_owned = ptr_is_owned(b);
42471         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42472         b_conv.is_owned = false;
42473         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
42474         return ret_conv;
42475 }
42476
42477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42478         LDKTxAddInput this_obj_conv;
42479         this_obj_conv.inner = untag_ptr(this_obj);
42480         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42482         TxAddInput_free(this_obj_conv);
42483 }
42484
42485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42486         LDKTxAddInput this_ptr_conv;
42487         this_ptr_conv.inner = untag_ptr(this_ptr);
42488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42490         this_ptr_conv.is_owned = false;
42491         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42492         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddInput_get_channel_id(&this_ptr_conv));
42493         return ret_arr;
42494 }
42495
42496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42497         LDKTxAddInput this_ptr_conv;
42498         this_ptr_conv.inner = untag_ptr(this_ptr);
42499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42501         this_ptr_conv.is_owned = false;
42502         LDKThirtyTwoBytes val_ref;
42503         CHECK((*env)->GetArrayLength(env, val) == 32);
42504         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42505         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
42506 }
42507
42508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42509         LDKTxAddInput this_ptr_conv;
42510         this_ptr_conv.inner = untag_ptr(this_ptr);
42511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42513         this_ptr_conv.is_owned = false;
42514         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
42515         return ret_conv;
42516 }
42517
42518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42519         LDKTxAddInput this_ptr_conv;
42520         this_ptr_conv.inner = untag_ptr(this_ptr);
42521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42523         this_ptr_conv.is_owned = false;
42524         TxAddInput_set_serial_id(&this_ptr_conv, val);
42525 }
42526
42527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
42528         LDKTxAddInput this_ptr_conv;
42529         this_ptr_conv.inner = untag_ptr(this_ptr);
42530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42532         this_ptr_conv.is_owned = false;
42533         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
42534         int64_t ret_ref = 0;
42535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42537         return ret_ref;
42538 }
42539
42540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42541         LDKTxAddInput this_ptr_conv;
42542         this_ptr_conv.inner = untag_ptr(this_ptr);
42543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42545         this_ptr_conv.is_owned = false;
42546         LDKTransactionU16LenLimited val_conv;
42547         val_conv.inner = untag_ptr(val);
42548         val_conv.is_owned = ptr_is_owned(val);
42549         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42550         val_conv = TransactionU16LenLimited_clone(&val_conv);
42551         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
42552 }
42553
42554 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
42555         LDKTxAddInput this_ptr_conv;
42556         this_ptr_conv.inner = untag_ptr(this_ptr);
42557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42559         this_ptr_conv.is_owned = false;
42560         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
42561         return ret_conv;
42562 }
42563
42564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42565         LDKTxAddInput this_ptr_conv;
42566         this_ptr_conv.inner = untag_ptr(this_ptr);
42567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42569         this_ptr_conv.is_owned = false;
42570         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
42571 }
42572
42573 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
42574         LDKTxAddInput this_ptr_conv;
42575         this_ptr_conv.inner = untag_ptr(this_ptr);
42576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42578         this_ptr_conv.is_owned = false;
42579         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
42580         return ret_conv;
42581 }
42582
42583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42584         LDKTxAddInput this_ptr_conv;
42585         this_ptr_conv.inner = untag_ptr(this_ptr);
42586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42588         this_ptr_conv.is_owned = false;
42589         TxAddInput_set_sequence(&this_ptr_conv, val);
42590 }
42591
42592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
42593         LDKThirtyTwoBytes channel_id_arg_ref;
42594         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42595         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42596         LDKTransactionU16LenLimited prevtx_arg_conv;
42597         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
42598         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
42599         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
42600         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
42601         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
42602         int64_t ret_ref = 0;
42603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42605         return ret_ref;
42606 }
42607
42608 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
42609         LDKTxAddInput ret_var = TxAddInput_clone(arg);
42610         int64_t ret_ref = 0;
42611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42613         return ret_ref;
42614 }
42615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42616         LDKTxAddInput arg_conv;
42617         arg_conv.inner = untag_ptr(arg);
42618         arg_conv.is_owned = ptr_is_owned(arg);
42619         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42620         arg_conv.is_owned = false;
42621         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
42622         return ret_conv;
42623 }
42624
42625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42626         LDKTxAddInput orig_conv;
42627         orig_conv.inner = untag_ptr(orig);
42628         orig_conv.is_owned = ptr_is_owned(orig);
42629         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42630         orig_conv.is_owned = false;
42631         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
42632         int64_t ret_ref = 0;
42633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42635         return ret_ref;
42636 }
42637
42638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42639         LDKTxAddInput a_conv;
42640         a_conv.inner = untag_ptr(a);
42641         a_conv.is_owned = ptr_is_owned(a);
42642         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42643         a_conv.is_owned = false;
42644         LDKTxAddInput b_conv;
42645         b_conv.inner = untag_ptr(b);
42646         b_conv.is_owned = ptr_is_owned(b);
42647         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42648         b_conv.is_owned = false;
42649         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
42650         return ret_conv;
42651 }
42652
42653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42654         LDKTxAddOutput this_obj_conv;
42655         this_obj_conv.inner = untag_ptr(this_obj);
42656         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42658         TxAddOutput_free(this_obj_conv);
42659 }
42660
42661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42662         LDKTxAddOutput this_ptr_conv;
42663         this_ptr_conv.inner = untag_ptr(this_ptr);
42664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42666         this_ptr_conv.is_owned = false;
42667         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42668         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddOutput_get_channel_id(&this_ptr_conv));
42669         return ret_arr;
42670 }
42671
42672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42673         LDKTxAddOutput this_ptr_conv;
42674         this_ptr_conv.inner = untag_ptr(this_ptr);
42675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42677         this_ptr_conv.is_owned = false;
42678         LDKThirtyTwoBytes val_ref;
42679         CHECK((*env)->GetArrayLength(env, val) == 32);
42680         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42681         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
42682 }
42683
42684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42685         LDKTxAddOutput this_ptr_conv;
42686         this_ptr_conv.inner = untag_ptr(this_ptr);
42687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42689         this_ptr_conv.is_owned = false;
42690         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
42691         return ret_conv;
42692 }
42693
42694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42695         LDKTxAddOutput this_ptr_conv;
42696         this_ptr_conv.inner = untag_ptr(this_ptr);
42697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42699         this_ptr_conv.is_owned = false;
42700         TxAddOutput_set_serial_id(&this_ptr_conv, val);
42701 }
42702
42703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
42704         LDKTxAddOutput this_ptr_conv;
42705         this_ptr_conv.inner = untag_ptr(this_ptr);
42706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42708         this_ptr_conv.is_owned = false;
42709         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
42710         return ret_conv;
42711 }
42712
42713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42714         LDKTxAddOutput this_ptr_conv;
42715         this_ptr_conv.inner = untag_ptr(this_ptr);
42716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42718         this_ptr_conv.is_owned = false;
42719         TxAddOutput_set_sats(&this_ptr_conv, val);
42720 }
42721
42722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
42723         LDKTxAddOutput this_ptr_conv;
42724         this_ptr_conv.inner = untag_ptr(this_ptr);
42725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42727         this_ptr_conv.is_owned = false;
42728         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
42729         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42730         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42731         return ret_arr;
42732 }
42733
42734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42735         LDKTxAddOutput this_ptr_conv;
42736         this_ptr_conv.inner = untag_ptr(this_ptr);
42737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42739         this_ptr_conv.is_owned = false;
42740         LDKCVec_u8Z val_ref;
42741         val_ref.datalen = (*env)->GetArrayLength(env, val);
42742         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42743         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
42744         TxAddOutput_set_script(&this_ptr_conv, val_ref);
42745 }
42746
42747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
42748         LDKThirtyTwoBytes channel_id_arg_ref;
42749         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42750         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42751         LDKCVec_u8Z script_arg_ref;
42752         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
42753         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42754         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
42755         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
42756         int64_t ret_ref = 0;
42757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42759         return ret_ref;
42760 }
42761
42762 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
42763         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
42764         int64_t ret_ref = 0;
42765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42767         return ret_ref;
42768 }
42769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42770         LDKTxAddOutput arg_conv;
42771         arg_conv.inner = untag_ptr(arg);
42772         arg_conv.is_owned = ptr_is_owned(arg);
42773         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42774         arg_conv.is_owned = false;
42775         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
42776         return ret_conv;
42777 }
42778
42779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42780         LDKTxAddOutput orig_conv;
42781         orig_conv.inner = untag_ptr(orig);
42782         orig_conv.is_owned = ptr_is_owned(orig);
42783         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42784         orig_conv.is_owned = false;
42785         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
42786         int64_t ret_ref = 0;
42787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42789         return ret_ref;
42790 }
42791
42792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42793         LDKTxAddOutput a_conv;
42794         a_conv.inner = untag_ptr(a);
42795         a_conv.is_owned = ptr_is_owned(a);
42796         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42797         a_conv.is_owned = false;
42798         LDKTxAddOutput b_conv;
42799         b_conv.inner = untag_ptr(b);
42800         b_conv.is_owned = ptr_is_owned(b);
42801         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42802         b_conv.is_owned = false;
42803         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
42804         return ret_conv;
42805 }
42806
42807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42808         LDKTxRemoveInput this_obj_conv;
42809         this_obj_conv.inner = untag_ptr(this_obj);
42810         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42812         TxRemoveInput_free(this_obj_conv);
42813 }
42814
42815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42816         LDKTxRemoveInput this_ptr_conv;
42817         this_ptr_conv.inner = untag_ptr(this_ptr);
42818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42820         this_ptr_conv.is_owned = false;
42821         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42822         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveInput_get_channel_id(&this_ptr_conv));
42823         return ret_arr;
42824 }
42825
42826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42827         LDKTxRemoveInput this_ptr_conv;
42828         this_ptr_conv.inner = untag_ptr(this_ptr);
42829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42831         this_ptr_conv.is_owned = false;
42832         LDKThirtyTwoBytes val_ref;
42833         CHECK((*env)->GetArrayLength(env, val) == 32);
42834         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42835         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
42836 }
42837
42838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42839         LDKTxRemoveInput this_ptr_conv;
42840         this_ptr_conv.inner = untag_ptr(this_ptr);
42841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42843         this_ptr_conv.is_owned = false;
42844         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
42845         return ret_conv;
42846 }
42847
42848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42849         LDKTxRemoveInput this_ptr_conv;
42850         this_ptr_conv.inner = untag_ptr(this_ptr);
42851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42853         this_ptr_conv.is_owned = false;
42854         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
42855 }
42856
42857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
42858         LDKThirtyTwoBytes channel_id_arg_ref;
42859         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42860         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42861         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
42862         int64_t ret_ref = 0;
42863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42865         return ret_ref;
42866 }
42867
42868 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
42869         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
42870         int64_t ret_ref = 0;
42871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42873         return ret_ref;
42874 }
42875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42876         LDKTxRemoveInput arg_conv;
42877         arg_conv.inner = untag_ptr(arg);
42878         arg_conv.is_owned = ptr_is_owned(arg);
42879         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42880         arg_conv.is_owned = false;
42881         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
42882         return ret_conv;
42883 }
42884
42885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42886         LDKTxRemoveInput orig_conv;
42887         orig_conv.inner = untag_ptr(orig);
42888         orig_conv.is_owned = ptr_is_owned(orig);
42889         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42890         orig_conv.is_owned = false;
42891         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
42892         int64_t ret_ref = 0;
42893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42895         return ret_ref;
42896 }
42897
42898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42899         LDKTxRemoveInput a_conv;
42900         a_conv.inner = untag_ptr(a);
42901         a_conv.is_owned = ptr_is_owned(a);
42902         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42903         a_conv.is_owned = false;
42904         LDKTxRemoveInput b_conv;
42905         b_conv.inner = untag_ptr(b);
42906         b_conv.is_owned = ptr_is_owned(b);
42907         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42908         b_conv.is_owned = false;
42909         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
42910         return ret_conv;
42911 }
42912
42913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42914         LDKTxRemoveOutput this_obj_conv;
42915         this_obj_conv.inner = untag_ptr(this_obj);
42916         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42918         TxRemoveOutput_free(this_obj_conv);
42919 }
42920
42921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42922         LDKTxRemoveOutput this_ptr_conv;
42923         this_ptr_conv.inner = untag_ptr(this_ptr);
42924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42926         this_ptr_conv.is_owned = false;
42927         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42928         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveOutput_get_channel_id(&this_ptr_conv));
42929         return ret_arr;
42930 }
42931
42932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42933         LDKTxRemoveOutput this_ptr_conv;
42934         this_ptr_conv.inner = untag_ptr(this_ptr);
42935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42937         this_ptr_conv.is_owned = false;
42938         LDKThirtyTwoBytes val_ref;
42939         CHECK((*env)->GetArrayLength(env, val) == 32);
42940         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42941         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
42942 }
42943
42944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42945         LDKTxRemoveOutput this_ptr_conv;
42946         this_ptr_conv.inner = untag_ptr(this_ptr);
42947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42949         this_ptr_conv.is_owned = false;
42950         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
42951         return ret_conv;
42952 }
42953
42954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42955         LDKTxRemoveOutput this_ptr_conv;
42956         this_ptr_conv.inner = untag_ptr(this_ptr);
42957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42959         this_ptr_conv.is_owned = false;
42960         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
42961 }
42962
42963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t serial_id_arg) {
42964         LDKThirtyTwoBytes channel_id_arg_ref;
42965         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42966         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42967         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
42968         int64_t ret_ref = 0;
42969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42971         return ret_ref;
42972 }
42973
42974 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
42975         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
42976         int64_t ret_ref = 0;
42977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42979         return ret_ref;
42980 }
42981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42982         LDKTxRemoveOutput arg_conv;
42983         arg_conv.inner = untag_ptr(arg);
42984         arg_conv.is_owned = ptr_is_owned(arg);
42985         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42986         arg_conv.is_owned = false;
42987         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
42988         return ret_conv;
42989 }
42990
42991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42992         LDKTxRemoveOutput orig_conv;
42993         orig_conv.inner = untag_ptr(orig);
42994         orig_conv.is_owned = ptr_is_owned(orig);
42995         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42996         orig_conv.is_owned = false;
42997         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
42998         int64_t ret_ref = 0;
42999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43001         return ret_ref;
43002 }
43003
43004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43005         LDKTxRemoveOutput a_conv;
43006         a_conv.inner = untag_ptr(a);
43007         a_conv.is_owned = ptr_is_owned(a);
43008         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43009         a_conv.is_owned = false;
43010         LDKTxRemoveOutput b_conv;
43011         b_conv.inner = untag_ptr(b);
43012         b_conv.is_owned = ptr_is_owned(b);
43013         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43014         b_conv.is_owned = false;
43015         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
43016         return ret_conv;
43017 }
43018
43019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43020         LDKTxComplete this_obj_conv;
43021         this_obj_conv.inner = untag_ptr(this_obj);
43022         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43024         TxComplete_free(this_obj_conv);
43025 }
43026
43027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43028         LDKTxComplete this_ptr_conv;
43029         this_ptr_conv.inner = untag_ptr(this_ptr);
43030         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43032         this_ptr_conv.is_owned = false;
43033         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43034         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxComplete_get_channel_id(&this_ptr_conv));
43035         return ret_arr;
43036 }
43037
43038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43039         LDKTxComplete this_ptr_conv;
43040         this_ptr_conv.inner = untag_ptr(this_ptr);
43041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43043         this_ptr_conv.is_owned = false;
43044         LDKThirtyTwoBytes val_ref;
43045         CHECK((*env)->GetArrayLength(env, val) == 32);
43046         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43047         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
43048 }
43049
43050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
43051         LDKThirtyTwoBytes channel_id_arg_ref;
43052         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43053         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43054         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
43055         int64_t ret_ref = 0;
43056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43058         return ret_ref;
43059 }
43060
43061 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
43062         LDKTxComplete ret_var = TxComplete_clone(arg);
43063         int64_t ret_ref = 0;
43064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43066         return ret_ref;
43067 }
43068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43069         LDKTxComplete arg_conv;
43070         arg_conv.inner = untag_ptr(arg);
43071         arg_conv.is_owned = ptr_is_owned(arg);
43072         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43073         arg_conv.is_owned = false;
43074         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
43075         return ret_conv;
43076 }
43077
43078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43079         LDKTxComplete orig_conv;
43080         orig_conv.inner = untag_ptr(orig);
43081         orig_conv.is_owned = ptr_is_owned(orig);
43082         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43083         orig_conv.is_owned = false;
43084         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
43085         int64_t ret_ref = 0;
43086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43088         return ret_ref;
43089 }
43090
43091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43092         LDKTxComplete a_conv;
43093         a_conv.inner = untag_ptr(a);
43094         a_conv.is_owned = ptr_is_owned(a);
43095         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43096         a_conv.is_owned = false;
43097         LDKTxComplete b_conv;
43098         b_conv.inner = untag_ptr(b);
43099         b_conv.is_owned = ptr_is_owned(b);
43100         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43101         b_conv.is_owned = false;
43102         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
43103         return ret_conv;
43104 }
43105
43106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43107         LDKTxSignatures this_obj_conv;
43108         this_obj_conv.inner = untag_ptr(this_obj);
43109         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43111         TxSignatures_free(this_obj_conv);
43112 }
43113
43114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43115         LDKTxSignatures this_ptr_conv;
43116         this_ptr_conv.inner = untag_ptr(this_ptr);
43117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43119         this_ptr_conv.is_owned = false;
43120         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43121         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_channel_id(&this_ptr_conv));
43122         return ret_arr;
43123 }
43124
43125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43126         LDKTxSignatures this_ptr_conv;
43127         this_ptr_conv.inner = untag_ptr(this_ptr);
43128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43130         this_ptr_conv.is_owned = false;
43131         LDKThirtyTwoBytes val_ref;
43132         CHECK((*env)->GetArrayLength(env, val) == 32);
43133         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43134         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
43135 }
43136
43137 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
43138         LDKTxSignatures this_ptr_conv;
43139         this_ptr_conv.inner = untag_ptr(this_ptr);
43140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43142         this_ptr_conv.is_owned = false;
43143         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43144         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
43145         return ret_arr;
43146 }
43147
43148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43149         LDKTxSignatures this_ptr_conv;
43150         this_ptr_conv.inner = untag_ptr(this_ptr);
43151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43153         this_ptr_conv.is_owned = false;
43154         LDKThirtyTwoBytes val_ref;
43155         CHECK((*env)->GetArrayLength(env, val) == 32);
43156         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43157         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
43158 }
43159
43160 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
43161         LDKTxSignatures this_ptr_conv;
43162         this_ptr_conv.inner = untag_ptr(this_ptr);
43163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43165         this_ptr_conv.is_owned = false;
43166         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
43167         jobjectArray ret_arr = NULL;
43168         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
43169         ;
43170         for (size_t i = 0; i < ret_var.datalen; i++) {
43171                 LDKWitness ret_conv_8_var = ret_var.data[i];
43172                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
43173                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
43174                 Witness_free(ret_conv_8_var);
43175                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
43176         }
43177         
43178         FREE(ret_var.data);
43179         return ret_arr;
43180 }
43181
43182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
43183         LDKTxSignatures this_ptr_conv;
43184         this_ptr_conv.inner = untag_ptr(this_ptr);
43185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43187         this_ptr_conv.is_owned = false;
43188         LDKCVec_WitnessZ val_constr;
43189         val_constr.datalen = (*env)->GetArrayLength(env, val);
43190         if (val_constr.datalen > 0)
43191                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
43192         else
43193                 val_constr.data = NULL;
43194         for (size_t i = 0; i < val_constr.datalen; i++) {
43195                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
43196                 LDKWitness val_conv_8_ref;
43197                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
43198                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
43199                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
43200                 val_conv_8_ref.data_is_owned = true;
43201                 val_constr.data[i] = val_conv_8_ref;
43202         }
43203         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
43204 }
43205
43206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray tx_hash_arg, jobjectArray witnesses_arg) {
43207         LDKThirtyTwoBytes channel_id_arg_ref;
43208         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43209         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43210         LDKThirtyTwoBytes tx_hash_arg_ref;
43211         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
43212         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
43213         LDKCVec_WitnessZ witnesses_arg_constr;
43214         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
43215         if (witnesses_arg_constr.datalen > 0)
43216                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
43217         else
43218                 witnesses_arg_constr.data = NULL;
43219         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
43220                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
43221                 LDKWitness witnesses_arg_conv_8_ref;
43222                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
43223                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
43224                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
43225                 witnesses_arg_conv_8_ref.data_is_owned = true;
43226                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
43227         }
43228         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
43229         int64_t ret_ref = 0;
43230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43232         return ret_ref;
43233 }
43234
43235 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
43236         LDKTxSignatures ret_var = TxSignatures_clone(arg);
43237         int64_t ret_ref = 0;
43238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43240         return ret_ref;
43241 }
43242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43243         LDKTxSignatures arg_conv;
43244         arg_conv.inner = untag_ptr(arg);
43245         arg_conv.is_owned = ptr_is_owned(arg);
43246         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43247         arg_conv.is_owned = false;
43248         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
43249         return ret_conv;
43250 }
43251
43252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43253         LDKTxSignatures orig_conv;
43254         orig_conv.inner = untag_ptr(orig);
43255         orig_conv.is_owned = ptr_is_owned(orig);
43256         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43257         orig_conv.is_owned = false;
43258         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
43259         int64_t ret_ref = 0;
43260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43262         return ret_ref;
43263 }
43264
43265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43266         LDKTxSignatures a_conv;
43267         a_conv.inner = untag_ptr(a);
43268         a_conv.is_owned = ptr_is_owned(a);
43269         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43270         a_conv.is_owned = false;
43271         LDKTxSignatures b_conv;
43272         b_conv.inner = untag_ptr(b);
43273         b_conv.is_owned = ptr_is_owned(b);
43274         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43275         b_conv.is_owned = false;
43276         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
43277         return ret_conv;
43278 }
43279
43280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43281         LDKTxInitRbf this_obj_conv;
43282         this_obj_conv.inner = untag_ptr(this_obj);
43283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43285         TxInitRbf_free(this_obj_conv);
43286 }
43287
43288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43289         LDKTxInitRbf this_ptr_conv;
43290         this_ptr_conv.inner = untag_ptr(this_ptr);
43291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43293         this_ptr_conv.is_owned = false;
43294         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43295         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxInitRbf_get_channel_id(&this_ptr_conv));
43296         return ret_arr;
43297 }
43298
43299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43300         LDKTxInitRbf this_ptr_conv;
43301         this_ptr_conv.inner = untag_ptr(this_ptr);
43302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43304         this_ptr_conv.is_owned = false;
43305         LDKThirtyTwoBytes val_ref;
43306         CHECK((*env)->GetArrayLength(env, val) == 32);
43307         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43308         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
43309 }
43310
43311 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
43312         LDKTxInitRbf this_ptr_conv;
43313         this_ptr_conv.inner = untag_ptr(this_ptr);
43314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43316         this_ptr_conv.is_owned = false;
43317         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
43318         return ret_conv;
43319 }
43320
43321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43322         LDKTxInitRbf this_ptr_conv;
43323         this_ptr_conv.inner = untag_ptr(this_ptr);
43324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43326         this_ptr_conv.is_owned = false;
43327         TxInitRbf_set_locktime(&this_ptr_conv, val);
43328 }
43329
43330 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
43331         LDKTxInitRbf this_ptr_conv;
43332         this_ptr_conv.inner = untag_ptr(this_ptr);
43333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43335         this_ptr_conv.is_owned = false;
43336         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
43337         return ret_conv;
43338 }
43339
43340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43341         LDKTxInitRbf this_ptr_conv;
43342         this_ptr_conv.inner = untag_ptr(this_ptr);
43343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43345         this_ptr_conv.is_owned = false;
43346         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
43347 }
43348
43349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
43350         LDKTxInitRbf this_ptr_conv;
43351         this_ptr_conv.inner = untag_ptr(this_ptr);
43352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43354         this_ptr_conv.is_owned = false;
43355         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
43356         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
43357         int64_t ret_ref = tag_ptr(ret_copy, true);
43358         return ret_ref;
43359 }
43360
43361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43362         LDKTxInitRbf this_ptr_conv;
43363         this_ptr_conv.inner = untag_ptr(this_ptr);
43364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43366         this_ptr_conv.is_owned = false;
43367         void* val_ptr = untag_ptr(val);
43368         CHECK_ACCESS(val_ptr);
43369         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
43370         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
43371         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
43372 }
43373
43374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
43375         LDKThirtyTwoBytes channel_id_arg_ref;
43376         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43377         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43378         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
43379         CHECK_ACCESS(funding_output_contribution_arg_ptr);
43380         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
43381         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
43382         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
43383         int64_t ret_ref = 0;
43384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43386         return ret_ref;
43387 }
43388
43389 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
43390         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
43391         int64_t ret_ref = 0;
43392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43394         return ret_ref;
43395 }
43396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43397         LDKTxInitRbf arg_conv;
43398         arg_conv.inner = untag_ptr(arg);
43399         arg_conv.is_owned = ptr_is_owned(arg);
43400         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43401         arg_conv.is_owned = false;
43402         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
43403         return ret_conv;
43404 }
43405
43406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43407         LDKTxInitRbf orig_conv;
43408         orig_conv.inner = untag_ptr(orig);
43409         orig_conv.is_owned = ptr_is_owned(orig);
43410         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43411         orig_conv.is_owned = false;
43412         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
43413         int64_t ret_ref = 0;
43414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43416         return ret_ref;
43417 }
43418
43419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43420         LDKTxInitRbf a_conv;
43421         a_conv.inner = untag_ptr(a);
43422         a_conv.is_owned = ptr_is_owned(a);
43423         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43424         a_conv.is_owned = false;
43425         LDKTxInitRbf b_conv;
43426         b_conv.inner = untag_ptr(b);
43427         b_conv.is_owned = ptr_is_owned(b);
43428         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43429         b_conv.is_owned = false;
43430         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
43431         return ret_conv;
43432 }
43433
43434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43435         LDKTxAckRbf this_obj_conv;
43436         this_obj_conv.inner = untag_ptr(this_obj);
43437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43439         TxAckRbf_free(this_obj_conv);
43440 }
43441
43442 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43443         LDKTxAckRbf this_ptr_conv;
43444         this_ptr_conv.inner = untag_ptr(this_ptr);
43445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43447         this_ptr_conv.is_owned = false;
43448         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43449         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAckRbf_get_channel_id(&this_ptr_conv));
43450         return ret_arr;
43451 }
43452
43453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43454         LDKTxAckRbf this_ptr_conv;
43455         this_ptr_conv.inner = untag_ptr(this_ptr);
43456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43458         this_ptr_conv.is_owned = false;
43459         LDKThirtyTwoBytes val_ref;
43460         CHECK((*env)->GetArrayLength(env, val) == 32);
43461         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43462         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
43463 }
43464
43465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
43466         LDKTxAckRbf this_ptr_conv;
43467         this_ptr_conv.inner = untag_ptr(this_ptr);
43468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43470         this_ptr_conv.is_owned = false;
43471         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
43472         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
43473         int64_t ret_ref = tag_ptr(ret_copy, true);
43474         return ret_ref;
43475 }
43476
43477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43478         LDKTxAckRbf this_ptr_conv;
43479         this_ptr_conv.inner = untag_ptr(this_ptr);
43480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43482         this_ptr_conv.is_owned = false;
43483         void* val_ptr = untag_ptr(val);
43484         CHECK_ACCESS(val_ptr);
43485         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
43486         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
43487         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
43488 }
43489
43490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t funding_output_contribution_arg) {
43491         LDKThirtyTwoBytes channel_id_arg_ref;
43492         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43493         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43494         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
43495         CHECK_ACCESS(funding_output_contribution_arg_ptr);
43496         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
43497         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
43498         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
43499         int64_t ret_ref = 0;
43500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43502         return ret_ref;
43503 }
43504
43505 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
43506         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
43507         int64_t ret_ref = 0;
43508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43510         return ret_ref;
43511 }
43512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43513         LDKTxAckRbf arg_conv;
43514         arg_conv.inner = untag_ptr(arg);
43515         arg_conv.is_owned = ptr_is_owned(arg);
43516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43517         arg_conv.is_owned = false;
43518         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
43519         return ret_conv;
43520 }
43521
43522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43523         LDKTxAckRbf orig_conv;
43524         orig_conv.inner = untag_ptr(orig);
43525         orig_conv.is_owned = ptr_is_owned(orig);
43526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43527         orig_conv.is_owned = false;
43528         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
43529         int64_t ret_ref = 0;
43530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43532         return ret_ref;
43533 }
43534
43535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43536         LDKTxAckRbf a_conv;
43537         a_conv.inner = untag_ptr(a);
43538         a_conv.is_owned = ptr_is_owned(a);
43539         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43540         a_conv.is_owned = false;
43541         LDKTxAckRbf b_conv;
43542         b_conv.inner = untag_ptr(b);
43543         b_conv.is_owned = ptr_is_owned(b);
43544         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43545         b_conv.is_owned = false;
43546         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
43547         return ret_conv;
43548 }
43549
43550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43551         LDKTxAbort this_obj_conv;
43552         this_obj_conv.inner = untag_ptr(this_obj);
43553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43555         TxAbort_free(this_obj_conv);
43556 }
43557
43558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43559         LDKTxAbort this_ptr_conv;
43560         this_ptr_conv.inner = untag_ptr(this_ptr);
43561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43563         this_ptr_conv.is_owned = false;
43564         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43565         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAbort_get_channel_id(&this_ptr_conv));
43566         return ret_arr;
43567 }
43568
43569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43570         LDKTxAbort this_ptr_conv;
43571         this_ptr_conv.inner = untag_ptr(this_ptr);
43572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43574         this_ptr_conv.is_owned = false;
43575         LDKThirtyTwoBytes val_ref;
43576         CHECK((*env)->GetArrayLength(env, val) == 32);
43577         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43578         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
43579 }
43580
43581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
43582         LDKTxAbort this_ptr_conv;
43583         this_ptr_conv.inner = untag_ptr(this_ptr);
43584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43586         this_ptr_conv.is_owned = false;
43587         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
43588         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43589         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43590         CVec_u8Z_free(ret_var);
43591         return ret_arr;
43592 }
43593
43594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43595         LDKTxAbort this_ptr_conv;
43596         this_ptr_conv.inner = untag_ptr(this_ptr);
43597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43599         this_ptr_conv.is_owned = false;
43600         LDKCVec_u8Z val_ref;
43601         val_ref.datalen = (*env)->GetArrayLength(env, val);
43602         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43603         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
43604         TxAbort_set_data(&this_ptr_conv, val_ref);
43605 }
43606
43607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
43608         LDKThirtyTwoBytes channel_id_arg_ref;
43609         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43610         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43611         LDKCVec_u8Z data_arg_ref;
43612         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
43613         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43614         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
43615         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
43616         int64_t ret_ref = 0;
43617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43619         return ret_ref;
43620 }
43621
43622 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
43623         LDKTxAbort ret_var = TxAbort_clone(arg);
43624         int64_t ret_ref = 0;
43625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43627         return ret_ref;
43628 }
43629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43630         LDKTxAbort arg_conv;
43631         arg_conv.inner = untag_ptr(arg);
43632         arg_conv.is_owned = ptr_is_owned(arg);
43633         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43634         arg_conv.is_owned = false;
43635         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
43636         return ret_conv;
43637 }
43638
43639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43640         LDKTxAbort orig_conv;
43641         orig_conv.inner = untag_ptr(orig);
43642         orig_conv.is_owned = ptr_is_owned(orig);
43643         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43644         orig_conv.is_owned = false;
43645         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
43646         int64_t ret_ref = 0;
43647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43649         return ret_ref;
43650 }
43651
43652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43653         LDKTxAbort a_conv;
43654         a_conv.inner = untag_ptr(a);
43655         a_conv.is_owned = ptr_is_owned(a);
43656         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43657         a_conv.is_owned = false;
43658         LDKTxAbort b_conv;
43659         b_conv.inner = untag_ptr(b);
43660         b_conv.is_owned = ptr_is_owned(b);
43661         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43662         b_conv.is_owned = false;
43663         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
43664         return ret_conv;
43665 }
43666
43667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43668         LDKShutdown this_obj_conv;
43669         this_obj_conv.inner = untag_ptr(this_obj);
43670         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43672         Shutdown_free(this_obj_conv);
43673 }
43674
43675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43676         LDKShutdown this_ptr_conv;
43677         this_ptr_conv.inner = untag_ptr(this_ptr);
43678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43680         this_ptr_conv.is_owned = false;
43681         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43682         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
43683         return ret_arr;
43684 }
43685
43686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43687         LDKShutdown this_ptr_conv;
43688         this_ptr_conv.inner = untag_ptr(this_ptr);
43689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43691         this_ptr_conv.is_owned = false;
43692         LDKThirtyTwoBytes val_ref;
43693         CHECK((*env)->GetArrayLength(env, val) == 32);
43694         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43695         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
43696 }
43697
43698 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43699         LDKShutdown this_ptr_conv;
43700         this_ptr_conv.inner = untag_ptr(this_ptr);
43701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43703         this_ptr_conv.is_owned = false;
43704         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
43705         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43706         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43707         return ret_arr;
43708 }
43709
43710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43711         LDKShutdown this_ptr_conv;
43712         this_ptr_conv.inner = untag_ptr(this_ptr);
43713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43715         this_ptr_conv.is_owned = false;
43716         LDKCVec_u8Z val_ref;
43717         val_ref.datalen = (*env)->GetArrayLength(env, val);
43718         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43719         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
43720         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
43721 }
43722
43723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
43724         LDKThirtyTwoBytes channel_id_arg_ref;
43725         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43726         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43727         LDKCVec_u8Z scriptpubkey_arg_ref;
43728         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
43729         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43730         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
43731         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
43732         int64_t ret_ref = 0;
43733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43735         return ret_ref;
43736 }
43737
43738 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
43739         LDKShutdown ret_var = Shutdown_clone(arg);
43740         int64_t ret_ref = 0;
43741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43743         return ret_ref;
43744 }
43745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43746         LDKShutdown arg_conv;
43747         arg_conv.inner = untag_ptr(arg);
43748         arg_conv.is_owned = ptr_is_owned(arg);
43749         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43750         arg_conv.is_owned = false;
43751         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
43752         return ret_conv;
43753 }
43754
43755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43756         LDKShutdown orig_conv;
43757         orig_conv.inner = untag_ptr(orig);
43758         orig_conv.is_owned = ptr_is_owned(orig);
43759         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43760         orig_conv.is_owned = false;
43761         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
43762         int64_t ret_ref = 0;
43763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43765         return ret_ref;
43766 }
43767
43768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43769         LDKShutdown a_conv;
43770         a_conv.inner = untag_ptr(a);
43771         a_conv.is_owned = ptr_is_owned(a);
43772         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43773         a_conv.is_owned = false;
43774         LDKShutdown b_conv;
43775         b_conv.inner = untag_ptr(b);
43776         b_conv.is_owned = ptr_is_owned(b);
43777         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43778         b_conv.is_owned = false;
43779         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
43780         return ret_conv;
43781 }
43782
43783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43784         LDKClosingSignedFeeRange this_obj_conv;
43785         this_obj_conv.inner = untag_ptr(this_obj);
43786         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43788         ClosingSignedFeeRange_free(this_obj_conv);
43789 }
43790
43791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43792         LDKClosingSignedFeeRange this_ptr_conv;
43793         this_ptr_conv.inner = untag_ptr(this_ptr);
43794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43796         this_ptr_conv.is_owned = false;
43797         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
43798         return ret_conv;
43799 }
43800
43801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43802         LDKClosingSignedFeeRange this_ptr_conv;
43803         this_ptr_conv.inner = untag_ptr(this_ptr);
43804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43806         this_ptr_conv.is_owned = false;
43807         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
43808 }
43809
43810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43811         LDKClosingSignedFeeRange this_ptr_conv;
43812         this_ptr_conv.inner = untag_ptr(this_ptr);
43813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43815         this_ptr_conv.is_owned = false;
43816         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
43817         return ret_conv;
43818 }
43819
43820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43821         LDKClosingSignedFeeRange this_ptr_conv;
43822         this_ptr_conv.inner = untag_ptr(this_ptr);
43823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43825         this_ptr_conv.is_owned = false;
43826         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
43827 }
43828
43829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
43830         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
43831         int64_t ret_ref = 0;
43832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43834         return ret_ref;
43835 }
43836
43837 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
43838         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
43839         int64_t ret_ref = 0;
43840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43842         return ret_ref;
43843 }
43844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43845         LDKClosingSignedFeeRange arg_conv;
43846         arg_conv.inner = untag_ptr(arg);
43847         arg_conv.is_owned = ptr_is_owned(arg);
43848         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43849         arg_conv.is_owned = false;
43850         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
43851         return ret_conv;
43852 }
43853
43854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43855         LDKClosingSignedFeeRange orig_conv;
43856         orig_conv.inner = untag_ptr(orig);
43857         orig_conv.is_owned = ptr_is_owned(orig);
43858         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43859         orig_conv.is_owned = false;
43860         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
43861         int64_t ret_ref = 0;
43862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43864         return ret_ref;
43865 }
43866
43867 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43868         LDKClosingSignedFeeRange a_conv;
43869         a_conv.inner = untag_ptr(a);
43870         a_conv.is_owned = ptr_is_owned(a);
43871         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43872         a_conv.is_owned = false;
43873         LDKClosingSignedFeeRange b_conv;
43874         b_conv.inner = untag_ptr(b);
43875         b_conv.is_owned = ptr_is_owned(b);
43876         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43877         b_conv.is_owned = false;
43878         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
43879         return ret_conv;
43880 }
43881
43882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43883         LDKClosingSigned this_obj_conv;
43884         this_obj_conv.inner = untag_ptr(this_obj);
43885         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43887         ClosingSigned_free(this_obj_conv);
43888 }
43889
43890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43891         LDKClosingSigned this_ptr_conv;
43892         this_ptr_conv.inner = untag_ptr(this_ptr);
43893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43895         this_ptr_conv.is_owned = false;
43896         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43897         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
43898         return ret_arr;
43899 }
43900
43901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43902         LDKClosingSigned this_ptr_conv;
43903         this_ptr_conv.inner = untag_ptr(this_ptr);
43904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43906         this_ptr_conv.is_owned = false;
43907         LDKThirtyTwoBytes val_ref;
43908         CHECK((*env)->GetArrayLength(env, val) == 32);
43909         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43910         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
43911 }
43912
43913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43914         LDKClosingSigned this_ptr_conv;
43915         this_ptr_conv.inner = untag_ptr(this_ptr);
43916         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43918         this_ptr_conv.is_owned = false;
43919         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
43920         return ret_conv;
43921 }
43922
43923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43924         LDKClosingSigned this_ptr_conv;
43925         this_ptr_conv.inner = untag_ptr(this_ptr);
43926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43928         this_ptr_conv.is_owned = false;
43929         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
43930 }
43931
43932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
43933         LDKClosingSigned this_ptr_conv;
43934         this_ptr_conv.inner = untag_ptr(this_ptr);
43935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43937         this_ptr_conv.is_owned = false;
43938         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
43939         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
43940         return ret_arr;
43941 }
43942
43943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43944         LDKClosingSigned this_ptr_conv;
43945         this_ptr_conv.inner = untag_ptr(this_ptr);
43946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43948         this_ptr_conv.is_owned = false;
43949         LDKSignature val_ref;
43950         CHECK((*env)->GetArrayLength(env, val) == 64);
43951         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
43952         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
43953 }
43954
43955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
43956         LDKClosingSigned this_ptr_conv;
43957         this_ptr_conv.inner = untag_ptr(this_ptr);
43958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43960         this_ptr_conv.is_owned = false;
43961         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
43962         int64_t ret_ref = 0;
43963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43965         return ret_ref;
43966 }
43967
43968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43969         LDKClosingSigned this_ptr_conv;
43970         this_ptr_conv.inner = untag_ptr(this_ptr);
43971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43973         this_ptr_conv.is_owned = false;
43974         LDKClosingSignedFeeRange val_conv;
43975         val_conv.inner = untag_ptr(val);
43976         val_conv.is_owned = ptr_is_owned(val);
43977         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43978         val_conv = ClosingSignedFeeRange_clone(&val_conv);
43979         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
43980 }
43981
43982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
43983         LDKThirtyTwoBytes channel_id_arg_ref;
43984         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43985         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43986         LDKSignature signature_arg_ref;
43987         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
43988         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
43989         LDKClosingSignedFeeRange fee_range_arg_conv;
43990         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
43991         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
43992         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
43993         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
43994         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
43995         int64_t ret_ref = 0;
43996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43998         return ret_ref;
43999 }
44000
44001 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
44002         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
44003         int64_t ret_ref = 0;
44004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44006         return ret_ref;
44007 }
44008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44009         LDKClosingSigned arg_conv;
44010         arg_conv.inner = untag_ptr(arg);
44011         arg_conv.is_owned = ptr_is_owned(arg);
44012         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44013         arg_conv.is_owned = false;
44014         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
44015         return ret_conv;
44016 }
44017
44018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44019         LDKClosingSigned orig_conv;
44020         orig_conv.inner = untag_ptr(orig);
44021         orig_conv.is_owned = ptr_is_owned(orig);
44022         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44023         orig_conv.is_owned = false;
44024         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
44025         int64_t ret_ref = 0;
44026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44028         return ret_ref;
44029 }
44030
44031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44032         LDKClosingSigned a_conv;
44033         a_conv.inner = untag_ptr(a);
44034         a_conv.is_owned = ptr_is_owned(a);
44035         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44036         a_conv.is_owned = false;
44037         LDKClosingSigned b_conv;
44038         b_conv.inner = untag_ptr(b);
44039         b_conv.is_owned = ptr_is_owned(b);
44040         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44041         b_conv.is_owned = false;
44042         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
44043         return ret_conv;
44044 }
44045
44046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44047         LDKUpdateAddHTLC this_obj_conv;
44048         this_obj_conv.inner = untag_ptr(this_obj);
44049         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44051         UpdateAddHTLC_free(this_obj_conv);
44052 }
44053
44054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44055         LDKUpdateAddHTLC this_ptr_conv;
44056         this_ptr_conv.inner = untag_ptr(this_ptr);
44057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44059         this_ptr_conv.is_owned = false;
44060         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44061         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
44062         return ret_arr;
44063 }
44064
44065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44066         LDKUpdateAddHTLC this_ptr_conv;
44067         this_ptr_conv.inner = untag_ptr(this_ptr);
44068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44070         this_ptr_conv.is_owned = false;
44071         LDKThirtyTwoBytes val_ref;
44072         CHECK((*env)->GetArrayLength(env, val) == 32);
44073         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44074         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
44075 }
44076
44077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44078         LDKUpdateAddHTLC this_ptr_conv;
44079         this_ptr_conv.inner = untag_ptr(this_ptr);
44080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44082         this_ptr_conv.is_owned = false;
44083         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
44084         return ret_conv;
44085 }
44086
44087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44088         LDKUpdateAddHTLC this_ptr_conv;
44089         this_ptr_conv.inner = untag_ptr(this_ptr);
44090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44092         this_ptr_conv.is_owned = false;
44093         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
44094 }
44095
44096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44097         LDKUpdateAddHTLC this_ptr_conv;
44098         this_ptr_conv.inner = untag_ptr(this_ptr);
44099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44101         this_ptr_conv.is_owned = false;
44102         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
44103         return ret_conv;
44104 }
44105
44106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44107         LDKUpdateAddHTLC this_ptr_conv;
44108         this_ptr_conv.inner = untag_ptr(this_ptr);
44109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44111         this_ptr_conv.is_owned = false;
44112         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
44113 }
44114
44115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
44116         LDKUpdateAddHTLC this_ptr_conv;
44117         this_ptr_conv.inner = untag_ptr(this_ptr);
44118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44120         this_ptr_conv.is_owned = false;
44121         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44122         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
44123         return ret_arr;
44124 }
44125
44126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44127         LDKUpdateAddHTLC this_ptr_conv;
44128         this_ptr_conv.inner = untag_ptr(this_ptr);
44129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44131         this_ptr_conv.is_owned = false;
44132         LDKThirtyTwoBytes val_ref;
44133         CHECK((*env)->GetArrayLength(env, val) == 32);
44134         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44135         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
44136 }
44137
44138 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
44139         LDKUpdateAddHTLC this_ptr_conv;
44140         this_ptr_conv.inner = untag_ptr(this_ptr);
44141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44143         this_ptr_conv.is_owned = false;
44144         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
44145         return ret_conv;
44146 }
44147
44148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44149         LDKUpdateAddHTLC this_ptr_conv;
44150         this_ptr_conv.inner = untag_ptr(this_ptr);
44151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44153         this_ptr_conv.is_owned = false;
44154         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
44155 }
44156
44157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44158         LDKUpdateAddHTLC this_ptr_conv;
44159         this_ptr_conv.inner = untag_ptr(this_ptr);
44160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44162         this_ptr_conv.is_owned = false;
44163         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44164         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
44165         int64_t ret_ref = tag_ptr(ret_copy, true);
44166         return ret_ref;
44167 }
44168
44169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44170         LDKUpdateAddHTLC this_ptr_conv;
44171         this_ptr_conv.inner = untag_ptr(this_ptr);
44172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44174         this_ptr_conv.is_owned = false;
44175         void* val_ptr = untag_ptr(val);
44176         CHECK_ACCESS(val_ptr);
44177         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44178         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44179         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
44180 }
44181
44182 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
44183         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
44184         int64_t ret_ref = 0;
44185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44187         return ret_ref;
44188 }
44189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44190         LDKUpdateAddHTLC arg_conv;
44191         arg_conv.inner = untag_ptr(arg);
44192         arg_conv.is_owned = ptr_is_owned(arg);
44193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44194         arg_conv.is_owned = false;
44195         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
44196         return ret_conv;
44197 }
44198
44199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44200         LDKUpdateAddHTLC orig_conv;
44201         orig_conv.inner = untag_ptr(orig);
44202         orig_conv.is_owned = ptr_is_owned(orig);
44203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44204         orig_conv.is_owned = false;
44205         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
44206         int64_t ret_ref = 0;
44207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44209         return ret_ref;
44210 }
44211
44212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44213         LDKUpdateAddHTLC a_conv;
44214         a_conv.inner = untag_ptr(a);
44215         a_conv.is_owned = ptr_is_owned(a);
44216         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44217         a_conv.is_owned = false;
44218         LDKUpdateAddHTLC b_conv;
44219         b_conv.inner = untag_ptr(b);
44220         b_conv.is_owned = ptr_is_owned(b);
44221         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44222         b_conv.is_owned = false;
44223         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
44224         return ret_conv;
44225 }
44226
44227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44228         LDKOnionMessage this_obj_conv;
44229         this_obj_conv.inner = untag_ptr(this_obj);
44230         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44232         OnionMessage_free(this_obj_conv);
44233 }
44234
44235 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44236         LDKOnionMessage this_ptr_conv;
44237         this_ptr_conv.inner = untag_ptr(this_ptr);
44238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44240         this_ptr_conv.is_owned = false;
44241         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44242         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
44243         return ret_arr;
44244 }
44245
44246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44247         LDKOnionMessage this_ptr_conv;
44248         this_ptr_conv.inner = untag_ptr(this_ptr);
44249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44251         this_ptr_conv.is_owned = false;
44252         LDKPublicKey val_ref;
44253         CHECK((*env)->GetArrayLength(env, val) == 33);
44254         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44255         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
44256 }
44257
44258 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
44259         LDKOnionMessage ret_var = OnionMessage_clone(arg);
44260         int64_t ret_ref = 0;
44261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44263         return ret_ref;
44264 }
44265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44266         LDKOnionMessage arg_conv;
44267         arg_conv.inner = untag_ptr(arg);
44268         arg_conv.is_owned = ptr_is_owned(arg);
44269         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44270         arg_conv.is_owned = false;
44271         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
44272         return ret_conv;
44273 }
44274
44275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44276         LDKOnionMessage orig_conv;
44277         orig_conv.inner = untag_ptr(orig);
44278         orig_conv.is_owned = ptr_is_owned(orig);
44279         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44280         orig_conv.is_owned = false;
44281         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
44282         int64_t ret_ref = 0;
44283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44285         return ret_ref;
44286 }
44287
44288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44289         LDKOnionMessage a_conv;
44290         a_conv.inner = untag_ptr(a);
44291         a_conv.is_owned = ptr_is_owned(a);
44292         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44293         a_conv.is_owned = false;
44294         LDKOnionMessage b_conv;
44295         b_conv.inner = untag_ptr(b);
44296         b_conv.is_owned = ptr_is_owned(b);
44297         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44298         b_conv.is_owned = false;
44299         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
44300         return ret_conv;
44301 }
44302
44303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44304         LDKUpdateFulfillHTLC this_obj_conv;
44305         this_obj_conv.inner = untag_ptr(this_obj);
44306         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44308         UpdateFulfillHTLC_free(this_obj_conv);
44309 }
44310
44311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44312         LDKUpdateFulfillHTLC this_ptr_conv;
44313         this_ptr_conv.inner = untag_ptr(this_ptr);
44314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44316         this_ptr_conv.is_owned = false;
44317         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44318         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
44319         return ret_arr;
44320 }
44321
44322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44323         LDKUpdateFulfillHTLC this_ptr_conv;
44324         this_ptr_conv.inner = untag_ptr(this_ptr);
44325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44327         this_ptr_conv.is_owned = false;
44328         LDKThirtyTwoBytes val_ref;
44329         CHECK((*env)->GetArrayLength(env, val) == 32);
44330         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44331         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
44332 }
44333
44334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44335         LDKUpdateFulfillHTLC this_ptr_conv;
44336         this_ptr_conv.inner = untag_ptr(this_ptr);
44337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44339         this_ptr_conv.is_owned = false;
44340         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
44341         return ret_conv;
44342 }
44343
44344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44345         LDKUpdateFulfillHTLC this_ptr_conv;
44346         this_ptr_conv.inner = untag_ptr(this_ptr);
44347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44349         this_ptr_conv.is_owned = false;
44350         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
44351 }
44352
44353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
44354         LDKUpdateFulfillHTLC this_ptr_conv;
44355         this_ptr_conv.inner = untag_ptr(this_ptr);
44356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44358         this_ptr_conv.is_owned = false;
44359         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44360         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
44361         return ret_arr;
44362 }
44363
44364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44365         LDKUpdateFulfillHTLC this_ptr_conv;
44366         this_ptr_conv.inner = untag_ptr(this_ptr);
44367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44369         this_ptr_conv.is_owned = false;
44370         LDKThirtyTwoBytes val_ref;
44371         CHECK((*env)->GetArrayLength(env, val) == 32);
44372         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44373         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
44374 }
44375
44376 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) {
44377         LDKThirtyTwoBytes channel_id_arg_ref;
44378         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44379         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44380         LDKThirtyTwoBytes payment_preimage_arg_ref;
44381         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
44382         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
44383         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
44384         int64_t ret_ref = 0;
44385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44387         return ret_ref;
44388 }
44389
44390 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
44391         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
44392         int64_t ret_ref = 0;
44393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44395         return ret_ref;
44396 }
44397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44398         LDKUpdateFulfillHTLC arg_conv;
44399         arg_conv.inner = untag_ptr(arg);
44400         arg_conv.is_owned = ptr_is_owned(arg);
44401         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44402         arg_conv.is_owned = false;
44403         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
44404         return ret_conv;
44405 }
44406
44407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44408         LDKUpdateFulfillHTLC orig_conv;
44409         orig_conv.inner = untag_ptr(orig);
44410         orig_conv.is_owned = ptr_is_owned(orig);
44411         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44412         orig_conv.is_owned = false;
44413         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
44414         int64_t ret_ref = 0;
44415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44417         return ret_ref;
44418 }
44419
44420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44421         LDKUpdateFulfillHTLC a_conv;
44422         a_conv.inner = untag_ptr(a);
44423         a_conv.is_owned = ptr_is_owned(a);
44424         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44425         a_conv.is_owned = false;
44426         LDKUpdateFulfillHTLC b_conv;
44427         b_conv.inner = untag_ptr(b);
44428         b_conv.is_owned = ptr_is_owned(b);
44429         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44430         b_conv.is_owned = false;
44431         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
44432         return ret_conv;
44433 }
44434
44435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44436         LDKUpdateFailHTLC this_obj_conv;
44437         this_obj_conv.inner = untag_ptr(this_obj);
44438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44440         UpdateFailHTLC_free(this_obj_conv);
44441 }
44442
44443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44444         LDKUpdateFailHTLC this_ptr_conv;
44445         this_ptr_conv.inner = untag_ptr(this_ptr);
44446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44448         this_ptr_conv.is_owned = false;
44449         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44450         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
44451         return ret_arr;
44452 }
44453
44454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44455         LDKUpdateFailHTLC this_ptr_conv;
44456         this_ptr_conv.inner = untag_ptr(this_ptr);
44457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44459         this_ptr_conv.is_owned = false;
44460         LDKThirtyTwoBytes val_ref;
44461         CHECK((*env)->GetArrayLength(env, val) == 32);
44462         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44463         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
44464 }
44465
44466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44467         LDKUpdateFailHTLC this_ptr_conv;
44468         this_ptr_conv.inner = untag_ptr(this_ptr);
44469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44471         this_ptr_conv.is_owned = false;
44472         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
44473         return ret_conv;
44474 }
44475
44476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44477         LDKUpdateFailHTLC this_ptr_conv;
44478         this_ptr_conv.inner = untag_ptr(this_ptr);
44479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44481         this_ptr_conv.is_owned = false;
44482         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
44483 }
44484
44485 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
44486         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
44487         int64_t ret_ref = 0;
44488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44490         return ret_ref;
44491 }
44492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44493         LDKUpdateFailHTLC arg_conv;
44494         arg_conv.inner = untag_ptr(arg);
44495         arg_conv.is_owned = ptr_is_owned(arg);
44496         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44497         arg_conv.is_owned = false;
44498         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
44499         return ret_conv;
44500 }
44501
44502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44503         LDKUpdateFailHTLC orig_conv;
44504         orig_conv.inner = untag_ptr(orig);
44505         orig_conv.is_owned = ptr_is_owned(orig);
44506         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44507         orig_conv.is_owned = false;
44508         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
44509         int64_t ret_ref = 0;
44510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44512         return ret_ref;
44513 }
44514
44515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44516         LDKUpdateFailHTLC a_conv;
44517         a_conv.inner = untag_ptr(a);
44518         a_conv.is_owned = ptr_is_owned(a);
44519         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44520         a_conv.is_owned = false;
44521         LDKUpdateFailHTLC b_conv;
44522         b_conv.inner = untag_ptr(b);
44523         b_conv.is_owned = ptr_is_owned(b);
44524         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44525         b_conv.is_owned = false;
44526         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
44527         return ret_conv;
44528 }
44529
44530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44531         LDKUpdateFailMalformedHTLC this_obj_conv;
44532         this_obj_conv.inner = untag_ptr(this_obj);
44533         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44535         UpdateFailMalformedHTLC_free(this_obj_conv);
44536 }
44537
44538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44539         LDKUpdateFailMalformedHTLC this_ptr_conv;
44540         this_ptr_conv.inner = untag_ptr(this_ptr);
44541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44543         this_ptr_conv.is_owned = false;
44544         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44545         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
44546         return ret_arr;
44547 }
44548
44549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44550         LDKUpdateFailMalformedHTLC this_ptr_conv;
44551         this_ptr_conv.inner = untag_ptr(this_ptr);
44552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44554         this_ptr_conv.is_owned = false;
44555         LDKThirtyTwoBytes val_ref;
44556         CHECK((*env)->GetArrayLength(env, val) == 32);
44557         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44558         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
44559 }
44560
44561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44562         LDKUpdateFailMalformedHTLC this_ptr_conv;
44563         this_ptr_conv.inner = untag_ptr(this_ptr);
44564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44566         this_ptr_conv.is_owned = false;
44567         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
44568         return ret_conv;
44569 }
44570
44571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44572         LDKUpdateFailMalformedHTLC this_ptr_conv;
44573         this_ptr_conv.inner = untag_ptr(this_ptr);
44574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44576         this_ptr_conv.is_owned = false;
44577         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
44578 }
44579
44580 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
44581         LDKUpdateFailMalformedHTLC this_ptr_conv;
44582         this_ptr_conv.inner = untag_ptr(this_ptr);
44583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44585         this_ptr_conv.is_owned = false;
44586         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
44587         return ret_conv;
44588 }
44589
44590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44591         LDKUpdateFailMalformedHTLC this_ptr_conv;
44592         this_ptr_conv.inner = untag_ptr(this_ptr);
44593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44595         this_ptr_conv.is_owned = false;
44596         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
44597 }
44598
44599 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
44600         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
44601         int64_t ret_ref = 0;
44602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44604         return ret_ref;
44605 }
44606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44607         LDKUpdateFailMalformedHTLC arg_conv;
44608         arg_conv.inner = untag_ptr(arg);
44609         arg_conv.is_owned = ptr_is_owned(arg);
44610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44611         arg_conv.is_owned = false;
44612         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
44613         return ret_conv;
44614 }
44615
44616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44617         LDKUpdateFailMalformedHTLC orig_conv;
44618         orig_conv.inner = untag_ptr(orig);
44619         orig_conv.is_owned = ptr_is_owned(orig);
44620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44621         orig_conv.is_owned = false;
44622         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
44623         int64_t ret_ref = 0;
44624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44626         return ret_ref;
44627 }
44628
44629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44630         LDKUpdateFailMalformedHTLC a_conv;
44631         a_conv.inner = untag_ptr(a);
44632         a_conv.is_owned = ptr_is_owned(a);
44633         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44634         a_conv.is_owned = false;
44635         LDKUpdateFailMalformedHTLC b_conv;
44636         b_conv.inner = untag_ptr(b);
44637         b_conv.is_owned = ptr_is_owned(b);
44638         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44639         b_conv.is_owned = false;
44640         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
44641         return ret_conv;
44642 }
44643
44644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44645         LDKCommitmentSigned this_obj_conv;
44646         this_obj_conv.inner = untag_ptr(this_obj);
44647         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44649         CommitmentSigned_free(this_obj_conv);
44650 }
44651
44652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44653         LDKCommitmentSigned this_ptr_conv;
44654         this_ptr_conv.inner = untag_ptr(this_ptr);
44655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44657         this_ptr_conv.is_owned = false;
44658         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44659         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
44660         return ret_arr;
44661 }
44662
44663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44664         LDKCommitmentSigned this_ptr_conv;
44665         this_ptr_conv.inner = untag_ptr(this_ptr);
44666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44668         this_ptr_conv.is_owned = false;
44669         LDKThirtyTwoBytes val_ref;
44670         CHECK((*env)->GetArrayLength(env, val) == 32);
44671         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44672         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
44673 }
44674
44675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
44676         LDKCommitmentSigned this_ptr_conv;
44677         this_ptr_conv.inner = untag_ptr(this_ptr);
44678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44680         this_ptr_conv.is_owned = false;
44681         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
44682         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
44683         return ret_arr;
44684 }
44685
44686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44687         LDKCommitmentSigned this_ptr_conv;
44688         this_ptr_conv.inner = untag_ptr(this_ptr);
44689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44691         this_ptr_conv.is_owned = false;
44692         LDKSignature val_ref;
44693         CHECK((*env)->GetArrayLength(env, val) == 64);
44694         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
44695         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
44696 }
44697
44698 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
44699         LDKCommitmentSigned this_ptr_conv;
44700         this_ptr_conv.inner = untag_ptr(this_ptr);
44701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44703         this_ptr_conv.is_owned = false;
44704         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
44705         jobjectArray ret_arr = NULL;
44706         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
44707         ;
44708         for (size_t i = 0; i < ret_var.datalen; i++) {
44709                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
44710                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
44711                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
44712         }
44713         
44714         FREE(ret_var.data);
44715         return ret_arr;
44716 }
44717
44718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
44719         LDKCommitmentSigned this_ptr_conv;
44720         this_ptr_conv.inner = untag_ptr(this_ptr);
44721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44723         this_ptr_conv.is_owned = false;
44724         LDKCVec_SignatureZ val_constr;
44725         val_constr.datalen = (*env)->GetArrayLength(env, val);
44726         if (val_constr.datalen > 0)
44727                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
44728         else
44729                 val_constr.data = NULL;
44730         for (size_t i = 0; i < val_constr.datalen; i++) {
44731                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
44732                 LDKSignature val_conv_8_ref;
44733                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
44734                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
44735                 val_constr.data[i] = val_conv_8_ref;
44736         }
44737         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
44738 }
44739
44740 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) {
44741         LDKThirtyTwoBytes channel_id_arg_ref;
44742         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44743         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44744         LDKSignature signature_arg_ref;
44745         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
44746         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
44747         LDKCVec_SignatureZ htlc_signatures_arg_constr;
44748         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
44749         if (htlc_signatures_arg_constr.datalen > 0)
44750                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
44751         else
44752                 htlc_signatures_arg_constr.data = NULL;
44753         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
44754                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
44755                 LDKSignature htlc_signatures_arg_conv_8_ref;
44756                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
44757                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
44758                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
44759         }
44760         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
44761         int64_t ret_ref = 0;
44762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44764         return ret_ref;
44765 }
44766
44767 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
44768         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
44769         int64_t ret_ref = 0;
44770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44772         return ret_ref;
44773 }
44774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44775         LDKCommitmentSigned arg_conv;
44776         arg_conv.inner = untag_ptr(arg);
44777         arg_conv.is_owned = ptr_is_owned(arg);
44778         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44779         arg_conv.is_owned = false;
44780         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
44781         return ret_conv;
44782 }
44783
44784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44785         LDKCommitmentSigned orig_conv;
44786         orig_conv.inner = untag_ptr(orig);
44787         orig_conv.is_owned = ptr_is_owned(orig);
44788         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44789         orig_conv.is_owned = false;
44790         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
44791         int64_t ret_ref = 0;
44792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44794         return ret_ref;
44795 }
44796
44797 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44798         LDKCommitmentSigned a_conv;
44799         a_conv.inner = untag_ptr(a);
44800         a_conv.is_owned = ptr_is_owned(a);
44801         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44802         a_conv.is_owned = false;
44803         LDKCommitmentSigned b_conv;
44804         b_conv.inner = untag_ptr(b);
44805         b_conv.is_owned = ptr_is_owned(b);
44806         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44807         b_conv.is_owned = false;
44808         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
44809         return ret_conv;
44810 }
44811
44812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44813         LDKRevokeAndACK this_obj_conv;
44814         this_obj_conv.inner = untag_ptr(this_obj);
44815         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44817         RevokeAndACK_free(this_obj_conv);
44818 }
44819
44820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44821         LDKRevokeAndACK this_ptr_conv;
44822         this_ptr_conv.inner = untag_ptr(this_ptr);
44823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44825         this_ptr_conv.is_owned = false;
44826         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44827         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
44828         return ret_arr;
44829 }
44830
44831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44832         LDKRevokeAndACK this_ptr_conv;
44833         this_ptr_conv.inner = untag_ptr(this_ptr);
44834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44836         this_ptr_conv.is_owned = false;
44837         LDKThirtyTwoBytes val_ref;
44838         CHECK((*env)->GetArrayLength(env, val) == 32);
44839         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44840         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
44841 }
44842
44843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
44844         LDKRevokeAndACK this_ptr_conv;
44845         this_ptr_conv.inner = untag_ptr(this_ptr);
44846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44848         this_ptr_conv.is_owned = false;
44849         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44850         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
44851         return ret_arr;
44852 }
44853
44854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44855         LDKRevokeAndACK this_ptr_conv;
44856         this_ptr_conv.inner = untag_ptr(this_ptr);
44857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44859         this_ptr_conv.is_owned = false;
44860         LDKThirtyTwoBytes val_ref;
44861         CHECK((*env)->GetArrayLength(env, val) == 32);
44862         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44863         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
44864 }
44865
44866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44867         LDKRevokeAndACK this_ptr_conv;
44868         this_ptr_conv.inner = untag_ptr(this_ptr);
44869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44871         this_ptr_conv.is_owned = false;
44872         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44873         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
44874         return ret_arr;
44875 }
44876
44877 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) {
44878         LDKRevokeAndACK this_ptr_conv;
44879         this_ptr_conv.inner = untag_ptr(this_ptr);
44880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44882         this_ptr_conv.is_owned = false;
44883         LDKPublicKey val_ref;
44884         CHECK((*env)->GetArrayLength(env, val) == 33);
44885         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44886         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
44887 }
44888
44889 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) {
44890         LDKThirtyTwoBytes channel_id_arg_ref;
44891         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44892         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44893         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
44894         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
44895         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
44896         LDKPublicKey next_per_commitment_point_arg_ref;
44897         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
44898         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
44899         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
44900         int64_t ret_ref = 0;
44901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44903         return ret_ref;
44904 }
44905
44906 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
44907         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
44908         int64_t ret_ref = 0;
44909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44911         return ret_ref;
44912 }
44913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44914         LDKRevokeAndACK arg_conv;
44915         arg_conv.inner = untag_ptr(arg);
44916         arg_conv.is_owned = ptr_is_owned(arg);
44917         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44918         arg_conv.is_owned = false;
44919         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
44920         return ret_conv;
44921 }
44922
44923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44924         LDKRevokeAndACK orig_conv;
44925         orig_conv.inner = untag_ptr(orig);
44926         orig_conv.is_owned = ptr_is_owned(orig);
44927         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44928         orig_conv.is_owned = false;
44929         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
44930         int64_t ret_ref = 0;
44931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44933         return ret_ref;
44934 }
44935
44936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44937         LDKRevokeAndACK a_conv;
44938         a_conv.inner = untag_ptr(a);
44939         a_conv.is_owned = ptr_is_owned(a);
44940         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44941         a_conv.is_owned = false;
44942         LDKRevokeAndACK b_conv;
44943         b_conv.inner = untag_ptr(b);
44944         b_conv.is_owned = ptr_is_owned(b);
44945         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44946         b_conv.is_owned = false;
44947         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
44948         return ret_conv;
44949 }
44950
44951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44952         LDKUpdateFee this_obj_conv;
44953         this_obj_conv.inner = untag_ptr(this_obj);
44954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44956         UpdateFee_free(this_obj_conv);
44957 }
44958
44959 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44960         LDKUpdateFee this_ptr_conv;
44961         this_ptr_conv.inner = untag_ptr(this_ptr);
44962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44964         this_ptr_conv.is_owned = false;
44965         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44966         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
44967         return ret_arr;
44968 }
44969
44970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44971         LDKUpdateFee this_ptr_conv;
44972         this_ptr_conv.inner = untag_ptr(this_ptr);
44973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44975         this_ptr_conv.is_owned = false;
44976         LDKThirtyTwoBytes val_ref;
44977         CHECK((*env)->GetArrayLength(env, val) == 32);
44978         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44979         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
44980 }
44981
44982 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
44983         LDKUpdateFee this_ptr_conv;
44984         this_ptr_conv.inner = untag_ptr(this_ptr);
44985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44987         this_ptr_conv.is_owned = false;
44988         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
44989         return ret_conv;
44990 }
44991
44992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44993         LDKUpdateFee this_ptr_conv;
44994         this_ptr_conv.inner = untag_ptr(this_ptr);
44995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44997         this_ptr_conv.is_owned = false;
44998         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
44999 }
45000
45001 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) {
45002         LDKThirtyTwoBytes channel_id_arg_ref;
45003         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45004         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45005         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
45006         int64_t ret_ref = 0;
45007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45009         return ret_ref;
45010 }
45011
45012 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
45013         LDKUpdateFee ret_var = UpdateFee_clone(arg);
45014         int64_t ret_ref = 0;
45015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45017         return ret_ref;
45018 }
45019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45020         LDKUpdateFee arg_conv;
45021         arg_conv.inner = untag_ptr(arg);
45022         arg_conv.is_owned = ptr_is_owned(arg);
45023         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45024         arg_conv.is_owned = false;
45025         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
45026         return ret_conv;
45027 }
45028
45029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45030         LDKUpdateFee orig_conv;
45031         orig_conv.inner = untag_ptr(orig);
45032         orig_conv.is_owned = ptr_is_owned(orig);
45033         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45034         orig_conv.is_owned = false;
45035         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
45036         int64_t ret_ref = 0;
45037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45039         return ret_ref;
45040 }
45041
45042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45043         LDKUpdateFee a_conv;
45044         a_conv.inner = untag_ptr(a);
45045         a_conv.is_owned = ptr_is_owned(a);
45046         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45047         a_conv.is_owned = false;
45048         LDKUpdateFee b_conv;
45049         b_conv.inner = untag_ptr(b);
45050         b_conv.is_owned = ptr_is_owned(b);
45051         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45052         b_conv.is_owned = false;
45053         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
45054         return ret_conv;
45055 }
45056
45057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45058         LDKChannelReestablish this_obj_conv;
45059         this_obj_conv.inner = untag_ptr(this_obj);
45060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45062         ChannelReestablish_free(this_obj_conv);
45063 }
45064
45065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45066         LDKChannelReestablish this_ptr_conv;
45067         this_ptr_conv.inner = untag_ptr(this_ptr);
45068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45070         this_ptr_conv.is_owned = false;
45071         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45072         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
45073         return ret_arr;
45074 }
45075
45076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45077         LDKChannelReestablish this_ptr_conv;
45078         this_ptr_conv.inner = untag_ptr(this_ptr);
45079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45081         this_ptr_conv.is_owned = false;
45082         LDKThirtyTwoBytes val_ref;
45083         CHECK((*env)->GetArrayLength(env, val) == 32);
45084         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45085         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
45086 }
45087
45088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
45089         LDKChannelReestablish this_ptr_conv;
45090         this_ptr_conv.inner = untag_ptr(this_ptr);
45091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45093         this_ptr_conv.is_owned = false;
45094         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
45095         return ret_conv;
45096 }
45097
45098 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) {
45099         LDKChannelReestablish this_ptr_conv;
45100         this_ptr_conv.inner = untag_ptr(this_ptr);
45101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45103         this_ptr_conv.is_owned = false;
45104         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
45105 }
45106
45107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
45108         LDKChannelReestablish this_ptr_conv;
45109         this_ptr_conv.inner = untag_ptr(this_ptr);
45110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45112         this_ptr_conv.is_owned = false;
45113         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
45114         return ret_conv;
45115 }
45116
45117 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) {
45118         LDKChannelReestablish this_ptr_conv;
45119         this_ptr_conv.inner = untag_ptr(this_ptr);
45120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45122         this_ptr_conv.is_owned = false;
45123         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
45124 }
45125
45126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
45127         LDKChannelReestablish this_ptr_conv;
45128         this_ptr_conv.inner = untag_ptr(this_ptr);
45129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45131         this_ptr_conv.is_owned = false;
45132         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45133         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
45134         return ret_arr;
45135 }
45136
45137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45138         LDKChannelReestablish this_ptr_conv;
45139         this_ptr_conv.inner = untag_ptr(this_ptr);
45140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45142         this_ptr_conv.is_owned = false;
45143         LDKThirtyTwoBytes val_ref;
45144         CHECK((*env)->GetArrayLength(env, val) == 32);
45145         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45146         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
45147 }
45148
45149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
45150         LDKChannelReestablish this_ptr_conv;
45151         this_ptr_conv.inner = untag_ptr(this_ptr);
45152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45154         this_ptr_conv.is_owned = false;
45155         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45156         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
45157         return ret_arr;
45158 }
45159
45160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45161         LDKChannelReestablish this_ptr_conv;
45162         this_ptr_conv.inner = untag_ptr(this_ptr);
45163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45165         this_ptr_conv.is_owned = false;
45166         LDKPublicKey val_ref;
45167         CHECK((*env)->GetArrayLength(env, val) == 33);
45168         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45169         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
45170 }
45171
45172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
45173         LDKChannelReestablish this_ptr_conv;
45174         this_ptr_conv.inner = untag_ptr(this_ptr);
45175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45177         this_ptr_conv.is_owned = false;
45178         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
45179         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
45180         int64_t ret_ref = tag_ptr(ret_copy, true);
45181         return ret_ref;
45182 }
45183
45184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45185         LDKChannelReestablish this_ptr_conv;
45186         this_ptr_conv.inner = untag_ptr(this_ptr);
45187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45189         this_ptr_conv.is_owned = false;
45190         void* val_ptr = untag_ptr(val);
45191         CHECK_ACCESS(val_ptr);
45192         LDKCOption_TxidZ val_conv = *(LDKCOption_TxidZ*)(val_ptr);
45193         val_conv = COption_TxidZ_clone((LDKCOption_TxidZ*)untag_ptr(val));
45194         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
45195 }
45196
45197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t next_local_commitment_number_arg, int64_t next_remote_commitment_number_arg, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg, int64_t next_funding_txid_arg) {
45198         LDKThirtyTwoBytes channel_id_arg_ref;
45199         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45200         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45201         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
45202         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
45203         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
45204         LDKPublicKey my_current_per_commitment_point_arg_ref;
45205         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
45206         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
45207         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
45208         CHECK_ACCESS(next_funding_txid_arg_ptr);
45209         LDKCOption_TxidZ next_funding_txid_arg_conv = *(LDKCOption_TxidZ*)(next_funding_txid_arg_ptr);
45210         next_funding_txid_arg_conv = COption_TxidZ_clone((LDKCOption_TxidZ*)untag_ptr(next_funding_txid_arg));
45211         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_ref, next_local_commitment_number_arg, next_remote_commitment_number_arg, your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref, next_funding_txid_arg_conv);
45212         int64_t ret_ref = 0;
45213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45215         return ret_ref;
45216 }
45217
45218 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
45219         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
45220         int64_t ret_ref = 0;
45221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45223         return ret_ref;
45224 }
45225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45226         LDKChannelReestablish arg_conv;
45227         arg_conv.inner = untag_ptr(arg);
45228         arg_conv.is_owned = ptr_is_owned(arg);
45229         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45230         arg_conv.is_owned = false;
45231         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
45232         return ret_conv;
45233 }
45234
45235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45236         LDKChannelReestablish orig_conv;
45237         orig_conv.inner = untag_ptr(orig);
45238         orig_conv.is_owned = ptr_is_owned(orig);
45239         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45240         orig_conv.is_owned = false;
45241         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
45242         int64_t ret_ref = 0;
45243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45245         return ret_ref;
45246 }
45247
45248 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45249         LDKChannelReestablish a_conv;
45250         a_conv.inner = untag_ptr(a);
45251         a_conv.is_owned = ptr_is_owned(a);
45252         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45253         a_conv.is_owned = false;
45254         LDKChannelReestablish b_conv;
45255         b_conv.inner = untag_ptr(b);
45256         b_conv.is_owned = ptr_is_owned(b);
45257         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45258         b_conv.is_owned = false;
45259         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
45260         return ret_conv;
45261 }
45262
45263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45264         LDKAnnouncementSignatures this_obj_conv;
45265         this_obj_conv.inner = untag_ptr(this_obj);
45266         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45268         AnnouncementSignatures_free(this_obj_conv);
45269 }
45270
45271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45272         LDKAnnouncementSignatures this_ptr_conv;
45273         this_ptr_conv.inner = untag_ptr(this_ptr);
45274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45276         this_ptr_conv.is_owned = false;
45277         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45278         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
45279         return ret_arr;
45280 }
45281
45282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45283         LDKAnnouncementSignatures this_ptr_conv;
45284         this_ptr_conv.inner = untag_ptr(this_ptr);
45285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45287         this_ptr_conv.is_owned = false;
45288         LDKThirtyTwoBytes val_ref;
45289         CHECK((*env)->GetArrayLength(env, val) == 32);
45290         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45291         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
45292 }
45293
45294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45295         LDKAnnouncementSignatures this_ptr_conv;
45296         this_ptr_conv.inner = untag_ptr(this_ptr);
45297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45299         this_ptr_conv.is_owned = false;
45300         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
45301         return ret_conv;
45302 }
45303
45304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45305         LDKAnnouncementSignatures this_ptr_conv;
45306         this_ptr_conv.inner = untag_ptr(this_ptr);
45307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45309         this_ptr_conv.is_owned = false;
45310         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
45311 }
45312
45313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
45314         LDKAnnouncementSignatures this_ptr_conv;
45315         this_ptr_conv.inner = untag_ptr(this_ptr);
45316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45318         this_ptr_conv.is_owned = false;
45319         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
45320         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
45321         return ret_arr;
45322 }
45323
45324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45325         LDKAnnouncementSignatures this_ptr_conv;
45326         this_ptr_conv.inner = untag_ptr(this_ptr);
45327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45329         this_ptr_conv.is_owned = false;
45330         LDKSignature val_ref;
45331         CHECK((*env)->GetArrayLength(env, val) == 64);
45332         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
45333         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
45334 }
45335
45336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
45337         LDKAnnouncementSignatures this_ptr_conv;
45338         this_ptr_conv.inner = untag_ptr(this_ptr);
45339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45341         this_ptr_conv.is_owned = false;
45342         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
45343         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
45344         return ret_arr;
45345 }
45346
45347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45348         LDKAnnouncementSignatures this_ptr_conv;
45349         this_ptr_conv.inner = untag_ptr(this_ptr);
45350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45352         this_ptr_conv.is_owned = false;
45353         LDKSignature val_ref;
45354         CHECK((*env)->GetArrayLength(env, val) == 64);
45355         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
45356         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
45357 }
45358
45359 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) {
45360         LDKThirtyTwoBytes channel_id_arg_ref;
45361         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45362         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45363         LDKSignature node_signature_arg_ref;
45364         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
45365         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
45366         LDKSignature bitcoin_signature_arg_ref;
45367         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
45368         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
45369         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
45370         int64_t ret_ref = 0;
45371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45373         return ret_ref;
45374 }
45375
45376 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
45377         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
45378         int64_t ret_ref = 0;
45379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45381         return ret_ref;
45382 }
45383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45384         LDKAnnouncementSignatures arg_conv;
45385         arg_conv.inner = untag_ptr(arg);
45386         arg_conv.is_owned = ptr_is_owned(arg);
45387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45388         arg_conv.is_owned = false;
45389         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
45390         return ret_conv;
45391 }
45392
45393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45394         LDKAnnouncementSignatures orig_conv;
45395         orig_conv.inner = untag_ptr(orig);
45396         orig_conv.is_owned = ptr_is_owned(orig);
45397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45398         orig_conv.is_owned = false;
45399         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
45400         int64_t ret_ref = 0;
45401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45403         return ret_ref;
45404 }
45405
45406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45407         LDKAnnouncementSignatures a_conv;
45408         a_conv.inner = untag_ptr(a);
45409         a_conv.is_owned = ptr_is_owned(a);
45410         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45411         a_conv.is_owned = false;
45412         LDKAnnouncementSignatures b_conv;
45413         b_conv.inner = untag_ptr(b);
45414         b_conv.is_owned = ptr_is_owned(b);
45415         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45416         b_conv.is_owned = false;
45417         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
45418         return ret_conv;
45419 }
45420
45421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45422         if (!ptr_is_owned(this_ptr)) return;
45423         void* this_ptr_ptr = untag_ptr(this_ptr);
45424         CHECK_ACCESS(this_ptr_ptr);
45425         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
45426         FREE(untag_ptr(this_ptr));
45427         NetAddress_free(this_ptr_conv);
45428 }
45429
45430 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
45431         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45432         *ret_copy = NetAddress_clone(arg);
45433         int64_t ret_ref = tag_ptr(ret_copy, true);
45434         return ret_ref;
45435 }
45436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45437         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
45438         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
45439         return ret_conv;
45440 }
45441
45442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45443         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
45444         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45445         *ret_copy = NetAddress_clone(orig_conv);
45446         int64_t ret_ref = tag_ptr(ret_copy, true);
45447         return ret_ref;
45448 }
45449
45450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
45451         LDKFourBytes addr_ref;
45452         CHECK((*env)->GetArrayLength(env, addr) == 4);
45453         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
45454         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45455         *ret_copy = NetAddress_ipv4(addr_ref, port);
45456         int64_t ret_ref = tag_ptr(ret_copy, true);
45457         return ret_ref;
45458 }
45459
45460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
45461         LDKSixteenBytes addr_ref;
45462         CHECK((*env)->GetArrayLength(env, addr) == 16);
45463         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
45464         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45465         *ret_copy = NetAddress_ipv6(addr_ref, port);
45466         int64_t ret_ref = tag_ptr(ret_copy, true);
45467         return ret_ref;
45468 }
45469
45470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
45471         LDKTwelveBytes a_ref;
45472         CHECK((*env)->GetArrayLength(env, a) == 12);
45473         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
45474         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45475         *ret_copy = NetAddress_onion_v2(a_ref);
45476         int64_t ret_ref = tag_ptr(ret_copy, true);
45477         return ret_ref;
45478 }
45479
45480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
45481         LDKThirtyTwoBytes ed25519_pubkey_ref;
45482         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
45483         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
45484         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45485         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
45486         int64_t ret_ref = tag_ptr(ret_copy, true);
45487         return ret_ref;
45488 }
45489
45490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
45491         LDKHostname hostname_conv;
45492         hostname_conv.inner = untag_ptr(hostname);
45493         hostname_conv.is_owned = ptr_is_owned(hostname);
45494         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
45495         hostname_conv = Hostname_clone(&hostname_conv);
45496         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45497         *ret_copy = NetAddress_hostname(hostname_conv, port);
45498         int64_t ret_ref = tag_ptr(ret_copy, true);
45499         return ret_ref;
45500 }
45501
45502 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45503         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
45504         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
45505         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
45506         return ret_conv;
45507 }
45508
45509 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
45510         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
45511         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
45512         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45513         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45514         CVec_u8Z_free(ret_var);
45515         return ret_arr;
45516 }
45517
45518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45519         LDKu8slice ser_ref;
45520         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45521         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45522         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
45523         *ret_conv = NetAddress_read(ser_ref);
45524         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45525         return tag_ptr(ret_conv, true);
45526 }
45527
45528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45529         if (!ptr_is_owned(this_ptr)) return;
45530         void* this_ptr_ptr = untag_ptr(this_ptr);
45531         CHECK_ACCESS(this_ptr_ptr);
45532         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
45533         FREE(untag_ptr(this_ptr));
45534         UnsignedGossipMessage_free(this_ptr_conv);
45535 }
45536
45537 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
45538         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45539         *ret_copy = UnsignedGossipMessage_clone(arg);
45540         int64_t ret_ref = tag_ptr(ret_copy, true);
45541         return ret_ref;
45542 }
45543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45544         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
45545         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
45546         return ret_conv;
45547 }
45548
45549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45550         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
45551         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45552         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
45553         int64_t ret_ref = tag_ptr(ret_copy, true);
45554         return ret_ref;
45555 }
45556
45557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
45558         LDKUnsignedChannelAnnouncement a_conv;
45559         a_conv.inner = untag_ptr(a);
45560         a_conv.is_owned = ptr_is_owned(a);
45561         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45562         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
45563         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45564         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
45565         int64_t ret_ref = tag_ptr(ret_copy, true);
45566         return ret_ref;
45567 }
45568
45569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
45570         LDKUnsignedChannelUpdate a_conv;
45571         a_conv.inner = untag_ptr(a);
45572         a_conv.is_owned = ptr_is_owned(a);
45573         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45574         a_conv = UnsignedChannelUpdate_clone(&a_conv);
45575         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45576         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
45577         int64_t ret_ref = tag_ptr(ret_copy, true);
45578         return ret_ref;
45579 }
45580
45581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
45582         LDKUnsignedNodeAnnouncement a_conv;
45583         a_conv.inner = untag_ptr(a);
45584         a_conv.is_owned = ptr_is_owned(a);
45585         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45586         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
45587         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45588         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
45589         int64_t ret_ref = tag_ptr(ret_copy, true);
45590         return ret_ref;
45591 }
45592
45593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
45594         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
45595         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
45596         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45597         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45598         CVec_u8Z_free(ret_var);
45599         return ret_arr;
45600 }
45601
45602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45603         LDKUnsignedNodeAnnouncement this_obj_conv;
45604         this_obj_conv.inner = untag_ptr(this_obj);
45605         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45607         UnsignedNodeAnnouncement_free(this_obj_conv);
45608 }
45609
45610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
45611         LDKUnsignedNodeAnnouncement this_ptr_conv;
45612         this_ptr_conv.inner = untag_ptr(this_ptr);
45613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45615         this_ptr_conv.is_owned = false;
45616         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
45617         int64_t ret_ref = 0;
45618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45620         return ret_ref;
45621 }
45622
45623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45624         LDKUnsignedNodeAnnouncement this_ptr_conv;
45625         this_ptr_conv.inner = untag_ptr(this_ptr);
45626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45628         this_ptr_conv.is_owned = false;
45629         LDKNodeFeatures val_conv;
45630         val_conv.inner = untag_ptr(val);
45631         val_conv.is_owned = ptr_is_owned(val);
45632         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45633         val_conv = NodeFeatures_clone(&val_conv);
45634         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
45635 }
45636
45637 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
45638         LDKUnsignedNodeAnnouncement this_ptr_conv;
45639         this_ptr_conv.inner = untag_ptr(this_ptr);
45640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45642         this_ptr_conv.is_owned = false;
45643         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
45644         return ret_conv;
45645 }
45646
45647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45648         LDKUnsignedNodeAnnouncement this_ptr_conv;
45649         this_ptr_conv.inner = untag_ptr(this_ptr);
45650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45652         this_ptr_conv.is_owned = false;
45653         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
45654 }
45655
45656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45657         LDKUnsignedNodeAnnouncement this_ptr_conv;
45658         this_ptr_conv.inner = untag_ptr(this_ptr);
45659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45661         this_ptr_conv.is_owned = false;
45662         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
45663         int64_t ret_ref = 0;
45664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45666         return ret_ref;
45667 }
45668
45669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45670         LDKUnsignedNodeAnnouncement this_ptr_conv;
45671         this_ptr_conv.inner = untag_ptr(this_ptr);
45672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45674         this_ptr_conv.is_owned = false;
45675         LDKNodeId val_conv;
45676         val_conv.inner = untag_ptr(val);
45677         val_conv.is_owned = ptr_is_owned(val);
45678         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45679         val_conv = NodeId_clone(&val_conv);
45680         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
45681 }
45682
45683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
45684         LDKUnsignedNodeAnnouncement this_ptr_conv;
45685         this_ptr_conv.inner = untag_ptr(this_ptr);
45686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45688         this_ptr_conv.is_owned = false;
45689         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
45690         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
45691         return ret_arr;
45692 }
45693
45694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45695         LDKUnsignedNodeAnnouncement this_ptr_conv;
45696         this_ptr_conv.inner = untag_ptr(this_ptr);
45697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45699         this_ptr_conv.is_owned = false;
45700         LDKThreeBytes val_ref;
45701         CHECK((*env)->GetArrayLength(env, val) == 3);
45702         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
45703         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
45704 }
45705
45706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
45707         LDKUnsignedNodeAnnouncement this_ptr_conv;
45708         this_ptr_conv.inner = untag_ptr(this_ptr);
45709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45711         this_ptr_conv.is_owned = false;
45712         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
45713         int64_t ret_ref = 0;
45714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45716         return ret_ref;
45717 }
45718
45719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45720         LDKUnsignedNodeAnnouncement this_ptr_conv;
45721         this_ptr_conv.inner = untag_ptr(this_ptr);
45722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45724         this_ptr_conv.is_owned = false;
45725         LDKNodeAlias val_conv;
45726         val_conv.inner = untag_ptr(val);
45727         val_conv.is_owned = ptr_is_owned(val);
45728         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45729         val_conv = NodeAlias_clone(&val_conv);
45730         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
45731 }
45732
45733 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
45734         LDKUnsignedNodeAnnouncement this_ptr_conv;
45735         this_ptr_conv.inner = untag_ptr(this_ptr);
45736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45738         this_ptr_conv.is_owned = false;
45739         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
45740         int64_tArray ret_arr = NULL;
45741         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45742         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45743         for (size_t m = 0; m < ret_var.datalen; m++) {
45744                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45745                 *ret_conv_12_copy = ret_var.data[m];
45746                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
45747                 ret_arr_ptr[m] = ret_conv_12_ref;
45748         }
45749         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45750         FREE(ret_var.data);
45751         return ret_arr;
45752 }
45753
45754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
45755         LDKUnsignedNodeAnnouncement this_ptr_conv;
45756         this_ptr_conv.inner = untag_ptr(this_ptr);
45757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45759         this_ptr_conv.is_owned = false;
45760         LDKCVec_NetAddressZ val_constr;
45761         val_constr.datalen = (*env)->GetArrayLength(env, val);
45762         if (val_constr.datalen > 0)
45763                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
45764         else
45765                 val_constr.data = NULL;
45766         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
45767         for (size_t m = 0; m < val_constr.datalen; m++) {
45768                 int64_t val_conv_12 = val_vals[m];
45769                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
45770                 CHECK_ACCESS(val_conv_12_ptr);
45771                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
45772                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
45773                 val_constr.data[m] = val_conv_12_conv;
45774         }
45775         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
45776         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
45777 }
45778
45779 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
45780         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
45781         int64_t ret_ref = 0;
45782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45784         return ret_ref;
45785 }
45786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45787         LDKUnsignedNodeAnnouncement arg_conv;
45788         arg_conv.inner = untag_ptr(arg);
45789         arg_conv.is_owned = ptr_is_owned(arg);
45790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45791         arg_conv.is_owned = false;
45792         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
45793         return ret_conv;
45794 }
45795
45796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45797         LDKUnsignedNodeAnnouncement orig_conv;
45798         orig_conv.inner = untag_ptr(orig);
45799         orig_conv.is_owned = ptr_is_owned(orig);
45800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45801         orig_conv.is_owned = false;
45802         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
45803         int64_t ret_ref = 0;
45804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45806         return ret_ref;
45807 }
45808
45809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45810         LDKUnsignedNodeAnnouncement a_conv;
45811         a_conv.inner = untag_ptr(a);
45812         a_conv.is_owned = ptr_is_owned(a);
45813         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45814         a_conv.is_owned = false;
45815         LDKUnsignedNodeAnnouncement b_conv;
45816         b_conv.inner = untag_ptr(b);
45817         b_conv.is_owned = ptr_is_owned(b);
45818         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45819         b_conv.is_owned = false;
45820         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
45821         return ret_conv;
45822 }
45823
45824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45825         LDKNodeAnnouncement this_obj_conv;
45826         this_obj_conv.inner = untag_ptr(this_obj);
45827         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45829         NodeAnnouncement_free(this_obj_conv);
45830 }
45831
45832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
45833         LDKNodeAnnouncement this_ptr_conv;
45834         this_ptr_conv.inner = untag_ptr(this_ptr);
45835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45837         this_ptr_conv.is_owned = false;
45838         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
45839         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
45840         return ret_arr;
45841 }
45842
45843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45844         LDKNodeAnnouncement this_ptr_conv;
45845         this_ptr_conv.inner = untag_ptr(this_ptr);
45846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45848         this_ptr_conv.is_owned = false;
45849         LDKSignature val_ref;
45850         CHECK((*env)->GetArrayLength(env, val) == 64);
45851         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
45852         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
45853 }
45854
45855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
45856         LDKNodeAnnouncement this_ptr_conv;
45857         this_ptr_conv.inner = untag_ptr(this_ptr);
45858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45860         this_ptr_conv.is_owned = false;
45861         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
45862         int64_t ret_ref = 0;
45863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45865         return ret_ref;
45866 }
45867
45868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45869         LDKNodeAnnouncement this_ptr_conv;
45870         this_ptr_conv.inner = untag_ptr(this_ptr);
45871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45873         this_ptr_conv.is_owned = false;
45874         LDKUnsignedNodeAnnouncement val_conv;
45875         val_conv.inner = untag_ptr(val);
45876         val_conv.is_owned = ptr_is_owned(val);
45877         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45878         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
45879         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
45880 }
45881
45882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
45883         LDKSignature signature_arg_ref;
45884         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
45885         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
45886         LDKUnsignedNodeAnnouncement contents_arg_conv;
45887         contents_arg_conv.inner = untag_ptr(contents_arg);
45888         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
45889         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
45890         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
45891         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
45892         int64_t ret_ref = 0;
45893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45895         return ret_ref;
45896 }
45897
45898 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
45899         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
45900         int64_t ret_ref = 0;
45901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45903         return ret_ref;
45904 }
45905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45906         LDKNodeAnnouncement arg_conv;
45907         arg_conv.inner = untag_ptr(arg);
45908         arg_conv.is_owned = ptr_is_owned(arg);
45909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45910         arg_conv.is_owned = false;
45911         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
45912         return ret_conv;
45913 }
45914
45915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45916         LDKNodeAnnouncement orig_conv;
45917         orig_conv.inner = untag_ptr(orig);
45918         orig_conv.is_owned = ptr_is_owned(orig);
45919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45920         orig_conv.is_owned = false;
45921         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
45922         int64_t ret_ref = 0;
45923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45925         return ret_ref;
45926 }
45927
45928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45929         LDKNodeAnnouncement a_conv;
45930         a_conv.inner = untag_ptr(a);
45931         a_conv.is_owned = ptr_is_owned(a);
45932         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45933         a_conv.is_owned = false;
45934         LDKNodeAnnouncement b_conv;
45935         b_conv.inner = untag_ptr(b);
45936         b_conv.is_owned = ptr_is_owned(b);
45937         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45938         b_conv.is_owned = false;
45939         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
45940         return ret_conv;
45941 }
45942
45943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45944         LDKUnsignedChannelAnnouncement this_obj_conv;
45945         this_obj_conv.inner = untag_ptr(this_obj);
45946         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45948         UnsignedChannelAnnouncement_free(this_obj_conv);
45949 }
45950
45951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
45952         LDKUnsignedChannelAnnouncement this_ptr_conv;
45953         this_ptr_conv.inner = untag_ptr(this_ptr);
45954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45956         this_ptr_conv.is_owned = false;
45957         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
45958         int64_t ret_ref = 0;
45959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45961         return ret_ref;
45962 }
45963
45964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45965         LDKUnsignedChannelAnnouncement this_ptr_conv;
45966         this_ptr_conv.inner = untag_ptr(this_ptr);
45967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45969         this_ptr_conv.is_owned = false;
45970         LDKChannelFeatures val_conv;
45971         val_conv.inner = untag_ptr(val);
45972         val_conv.is_owned = ptr_is_owned(val);
45973         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45974         val_conv = ChannelFeatures_clone(&val_conv);
45975         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
45976 }
45977
45978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
45979         LDKUnsignedChannelAnnouncement this_ptr_conv;
45980         this_ptr_conv.inner = untag_ptr(this_ptr);
45981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45983         this_ptr_conv.is_owned = false;
45984         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45985         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
45986         return ret_arr;
45987 }
45988
45989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45990         LDKUnsignedChannelAnnouncement this_ptr_conv;
45991         this_ptr_conv.inner = untag_ptr(this_ptr);
45992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45994         this_ptr_conv.is_owned = false;
45995         LDKThirtyTwoBytes val_ref;
45996         CHECK((*env)->GetArrayLength(env, val) == 32);
45997         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45998         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
45999 }
46000
46001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46002         LDKUnsignedChannelAnnouncement this_ptr_conv;
46003         this_ptr_conv.inner = untag_ptr(this_ptr);
46004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46006         this_ptr_conv.is_owned = false;
46007         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
46008         return ret_conv;
46009 }
46010
46011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46012         LDKUnsignedChannelAnnouncement this_ptr_conv;
46013         this_ptr_conv.inner = untag_ptr(this_ptr);
46014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46016         this_ptr_conv.is_owned = false;
46017         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
46018 }
46019
46020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
46021         LDKUnsignedChannelAnnouncement this_ptr_conv;
46022         this_ptr_conv.inner = untag_ptr(this_ptr);
46023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46025         this_ptr_conv.is_owned = false;
46026         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
46027         int64_t ret_ref = 0;
46028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46030         return ret_ref;
46031 }
46032
46033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46034         LDKUnsignedChannelAnnouncement this_ptr_conv;
46035         this_ptr_conv.inner = untag_ptr(this_ptr);
46036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46038         this_ptr_conv.is_owned = false;
46039         LDKNodeId val_conv;
46040         val_conv.inner = untag_ptr(val);
46041         val_conv.is_owned = ptr_is_owned(val);
46042         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46043         val_conv = NodeId_clone(&val_conv);
46044         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
46045 }
46046
46047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
46048         LDKUnsignedChannelAnnouncement this_ptr_conv;
46049         this_ptr_conv.inner = untag_ptr(this_ptr);
46050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46052         this_ptr_conv.is_owned = false;
46053         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
46054         int64_t ret_ref = 0;
46055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46057         return ret_ref;
46058 }
46059
46060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46061         LDKUnsignedChannelAnnouncement this_ptr_conv;
46062         this_ptr_conv.inner = untag_ptr(this_ptr);
46063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46065         this_ptr_conv.is_owned = false;
46066         LDKNodeId val_conv;
46067         val_conv.inner = untag_ptr(val);
46068         val_conv.is_owned = ptr_is_owned(val);
46069         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46070         val_conv = NodeId_clone(&val_conv);
46071         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
46072 }
46073
46074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
46075         LDKUnsignedChannelAnnouncement this_ptr_conv;
46076         this_ptr_conv.inner = untag_ptr(this_ptr);
46077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46079         this_ptr_conv.is_owned = false;
46080         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
46081         int64_t ret_ref = 0;
46082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46084         return ret_ref;
46085 }
46086
46087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46088         LDKUnsignedChannelAnnouncement this_ptr_conv;
46089         this_ptr_conv.inner = untag_ptr(this_ptr);
46090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46092         this_ptr_conv.is_owned = false;
46093         LDKNodeId val_conv;
46094         val_conv.inner = untag_ptr(val);
46095         val_conv.is_owned = ptr_is_owned(val);
46096         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46097         val_conv = NodeId_clone(&val_conv);
46098         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
46099 }
46100
46101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
46102         LDKUnsignedChannelAnnouncement this_ptr_conv;
46103         this_ptr_conv.inner = untag_ptr(this_ptr);
46104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46106         this_ptr_conv.is_owned = false;
46107         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
46108         int64_t ret_ref = 0;
46109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46111         return ret_ref;
46112 }
46113
46114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46115         LDKUnsignedChannelAnnouncement this_ptr_conv;
46116         this_ptr_conv.inner = untag_ptr(this_ptr);
46117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46119         this_ptr_conv.is_owned = false;
46120         LDKNodeId val_conv;
46121         val_conv.inner = untag_ptr(val);
46122         val_conv.is_owned = ptr_is_owned(val);
46123         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46124         val_conv = NodeId_clone(&val_conv);
46125         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
46126 }
46127
46128 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
46129         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
46130         int64_t ret_ref = 0;
46131         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46132         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46133         return ret_ref;
46134 }
46135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46136         LDKUnsignedChannelAnnouncement arg_conv;
46137         arg_conv.inner = untag_ptr(arg);
46138         arg_conv.is_owned = ptr_is_owned(arg);
46139         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46140         arg_conv.is_owned = false;
46141         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
46142         return ret_conv;
46143 }
46144
46145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46146         LDKUnsignedChannelAnnouncement orig_conv;
46147         orig_conv.inner = untag_ptr(orig);
46148         orig_conv.is_owned = ptr_is_owned(orig);
46149         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46150         orig_conv.is_owned = false;
46151         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
46152         int64_t ret_ref = 0;
46153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46155         return ret_ref;
46156 }
46157
46158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46159         LDKUnsignedChannelAnnouncement a_conv;
46160         a_conv.inner = untag_ptr(a);
46161         a_conv.is_owned = ptr_is_owned(a);
46162         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46163         a_conv.is_owned = false;
46164         LDKUnsignedChannelAnnouncement b_conv;
46165         b_conv.inner = untag_ptr(b);
46166         b_conv.is_owned = ptr_is_owned(b);
46167         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46168         b_conv.is_owned = false;
46169         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
46170         return ret_conv;
46171 }
46172
46173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46174         LDKChannelAnnouncement this_obj_conv;
46175         this_obj_conv.inner = untag_ptr(this_obj);
46176         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46178         ChannelAnnouncement_free(this_obj_conv);
46179 }
46180
46181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
46182         LDKChannelAnnouncement this_ptr_conv;
46183         this_ptr_conv.inner = untag_ptr(this_ptr);
46184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46186         this_ptr_conv.is_owned = false;
46187         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46188         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
46189         return ret_arr;
46190 }
46191
46192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46193         LDKChannelAnnouncement this_ptr_conv;
46194         this_ptr_conv.inner = untag_ptr(this_ptr);
46195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46197         this_ptr_conv.is_owned = false;
46198         LDKSignature val_ref;
46199         CHECK((*env)->GetArrayLength(env, val) == 64);
46200         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46201         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
46202 }
46203
46204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
46205         LDKChannelAnnouncement this_ptr_conv;
46206         this_ptr_conv.inner = untag_ptr(this_ptr);
46207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46209         this_ptr_conv.is_owned = false;
46210         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46211         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
46212         return ret_arr;
46213 }
46214
46215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46216         LDKChannelAnnouncement this_ptr_conv;
46217         this_ptr_conv.inner = untag_ptr(this_ptr);
46218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46220         this_ptr_conv.is_owned = false;
46221         LDKSignature val_ref;
46222         CHECK((*env)->GetArrayLength(env, val) == 64);
46223         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46224         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
46225 }
46226
46227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
46228         LDKChannelAnnouncement this_ptr_conv;
46229         this_ptr_conv.inner = untag_ptr(this_ptr);
46230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46232         this_ptr_conv.is_owned = false;
46233         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46234         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
46235         return ret_arr;
46236 }
46237
46238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46239         LDKChannelAnnouncement this_ptr_conv;
46240         this_ptr_conv.inner = untag_ptr(this_ptr);
46241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46243         this_ptr_conv.is_owned = false;
46244         LDKSignature val_ref;
46245         CHECK((*env)->GetArrayLength(env, val) == 64);
46246         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46247         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
46248 }
46249
46250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
46251         LDKChannelAnnouncement this_ptr_conv;
46252         this_ptr_conv.inner = untag_ptr(this_ptr);
46253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46255         this_ptr_conv.is_owned = false;
46256         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46257         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
46258         return ret_arr;
46259 }
46260
46261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46262         LDKChannelAnnouncement this_ptr_conv;
46263         this_ptr_conv.inner = untag_ptr(this_ptr);
46264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46266         this_ptr_conv.is_owned = false;
46267         LDKSignature val_ref;
46268         CHECK((*env)->GetArrayLength(env, val) == 64);
46269         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46270         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
46271 }
46272
46273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
46274         LDKChannelAnnouncement this_ptr_conv;
46275         this_ptr_conv.inner = untag_ptr(this_ptr);
46276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46278         this_ptr_conv.is_owned = false;
46279         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
46280         int64_t ret_ref = 0;
46281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46283         return ret_ref;
46284 }
46285
46286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46287         LDKChannelAnnouncement this_ptr_conv;
46288         this_ptr_conv.inner = untag_ptr(this_ptr);
46289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46291         this_ptr_conv.is_owned = false;
46292         LDKUnsignedChannelAnnouncement val_conv;
46293         val_conv.inner = untag_ptr(val);
46294         val_conv.is_owned = ptr_is_owned(val);
46295         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46296         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
46297         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
46298 }
46299
46300 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) {
46301         LDKSignature node_signature_1_arg_ref;
46302         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
46303         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
46304         LDKSignature node_signature_2_arg_ref;
46305         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
46306         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
46307         LDKSignature bitcoin_signature_1_arg_ref;
46308         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
46309         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
46310         LDKSignature bitcoin_signature_2_arg_ref;
46311         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
46312         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
46313         LDKUnsignedChannelAnnouncement contents_arg_conv;
46314         contents_arg_conv.inner = untag_ptr(contents_arg);
46315         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
46316         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
46317         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
46318         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);
46319         int64_t ret_ref = 0;
46320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46322         return ret_ref;
46323 }
46324
46325 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
46326         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
46327         int64_t ret_ref = 0;
46328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46330         return ret_ref;
46331 }
46332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46333         LDKChannelAnnouncement arg_conv;
46334         arg_conv.inner = untag_ptr(arg);
46335         arg_conv.is_owned = ptr_is_owned(arg);
46336         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46337         arg_conv.is_owned = false;
46338         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
46339         return ret_conv;
46340 }
46341
46342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46343         LDKChannelAnnouncement orig_conv;
46344         orig_conv.inner = untag_ptr(orig);
46345         orig_conv.is_owned = ptr_is_owned(orig);
46346         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46347         orig_conv.is_owned = false;
46348         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
46349         int64_t ret_ref = 0;
46350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46352         return ret_ref;
46353 }
46354
46355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46356         LDKChannelAnnouncement a_conv;
46357         a_conv.inner = untag_ptr(a);
46358         a_conv.is_owned = ptr_is_owned(a);
46359         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46360         a_conv.is_owned = false;
46361         LDKChannelAnnouncement b_conv;
46362         b_conv.inner = untag_ptr(b);
46363         b_conv.is_owned = ptr_is_owned(b);
46364         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46365         b_conv.is_owned = false;
46366         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
46367         return ret_conv;
46368 }
46369
46370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46371         LDKUnsignedChannelUpdate this_obj_conv;
46372         this_obj_conv.inner = untag_ptr(this_obj);
46373         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46375         UnsignedChannelUpdate_free(this_obj_conv);
46376 }
46377
46378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46379         LDKUnsignedChannelUpdate this_ptr_conv;
46380         this_ptr_conv.inner = untag_ptr(this_ptr);
46381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46383         this_ptr_conv.is_owned = false;
46384         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46385         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
46386         return ret_arr;
46387 }
46388
46389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46390         LDKUnsignedChannelUpdate this_ptr_conv;
46391         this_ptr_conv.inner = untag_ptr(this_ptr);
46392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46394         this_ptr_conv.is_owned = false;
46395         LDKThirtyTwoBytes val_ref;
46396         CHECK((*env)->GetArrayLength(env, val) == 32);
46397         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46398         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
46399 }
46400
46401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46402         LDKUnsignedChannelUpdate this_ptr_conv;
46403         this_ptr_conv.inner = untag_ptr(this_ptr);
46404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46406         this_ptr_conv.is_owned = false;
46407         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
46408         return ret_conv;
46409 }
46410
46411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46412         LDKUnsignedChannelUpdate this_ptr_conv;
46413         this_ptr_conv.inner = untag_ptr(this_ptr);
46414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46416         this_ptr_conv.is_owned = false;
46417         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
46418 }
46419
46420 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
46421         LDKUnsignedChannelUpdate this_ptr_conv;
46422         this_ptr_conv.inner = untag_ptr(this_ptr);
46423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46425         this_ptr_conv.is_owned = false;
46426         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
46427         return ret_conv;
46428 }
46429
46430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46431         LDKUnsignedChannelUpdate this_ptr_conv;
46432         this_ptr_conv.inner = untag_ptr(this_ptr);
46433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46435         this_ptr_conv.is_owned = false;
46436         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
46437 }
46438
46439 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
46440         LDKUnsignedChannelUpdate this_ptr_conv;
46441         this_ptr_conv.inner = untag_ptr(this_ptr);
46442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46444         this_ptr_conv.is_owned = false;
46445         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
46446         return ret_conv;
46447 }
46448
46449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
46450         LDKUnsignedChannelUpdate this_ptr_conv;
46451         this_ptr_conv.inner = untag_ptr(this_ptr);
46452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46454         this_ptr_conv.is_owned = false;
46455         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
46456 }
46457
46458 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
46459         LDKUnsignedChannelUpdate this_ptr_conv;
46460         this_ptr_conv.inner = untag_ptr(this_ptr);
46461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46463         this_ptr_conv.is_owned = false;
46464         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
46465         return ret_conv;
46466 }
46467
46468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46469         LDKUnsignedChannelUpdate this_ptr_conv;
46470         this_ptr_conv.inner = untag_ptr(this_ptr);
46471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46473         this_ptr_conv.is_owned = false;
46474         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
46475 }
46476
46477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46478         LDKUnsignedChannelUpdate this_ptr_conv;
46479         this_ptr_conv.inner = untag_ptr(this_ptr);
46480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46482         this_ptr_conv.is_owned = false;
46483         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
46484         return ret_conv;
46485 }
46486
46487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46488         LDKUnsignedChannelUpdate this_ptr_conv;
46489         this_ptr_conv.inner = untag_ptr(this_ptr);
46490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46492         this_ptr_conv.is_owned = false;
46493         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
46494 }
46495
46496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46497         LDKUnsignedChannelUpdate this_ptr_conv;
46498         this_ptr_conv.inner = untag_ptr(this_ptr);
46499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46501         this_ptr_conv.is_owned = false;
46502         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
46503         return ret_conv;
46504 }
46505
46506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46507         LDKUnsignedChannelUpdate this_ptr_conv;
46508         this_ptr_conv.inner = untag_ptr(this_ptr);
46509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46511         this_ptr_conv.is_owned = false;
46512         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
46513 }
46514
46515 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46516         LDKUnsignedChannelUpdate this_ptr_conv;
46517         this_ptr_conv.inner = untag_ptr(this_ptr);
46518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46520         this_ptr_conv.is_owned = false;
46521         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
46522         return ret_conv;
46523 }
46524
46525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46526         LDKUnsignedChannelUpdate this_ptr_conv;
46527         this_ptr_conv.inner = untag_ptr(this_ptr);
46528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46530         this_ptr_conv.is_owned = false;
46531         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
46532 }
46533
46534 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
46535         LDKUnsignedChannelUpdate this_ptr_conv;
46536         this_ptr_conv.inner = untag_ptr(this_ptr);
46537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46539         this_ptr_conv.is_owned = false;
46540         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
46541         return ret_conv;
46542 }
46543
46544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46545         LDKUnsignedChannelUpdate this_ptr_conv;
46546         this_ptr_conv.inner = untag_ptr(this_ptr);
46547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46549         this_ptr_conv.is_owned = false;
46550         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
46551 }
46552
46553 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46554         LDKUnsignedChannelUpdate this_ptr_conv;
46555         this_ptr_conv.inner = untag_ptr(this_ptr);
46556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46558         this_ptr_conv.is_owned = false;
46559         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
46560         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46561         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46562         CVec_u8Z_free(ret_var);
46563         return ret_arr;
46564 }
46565
46566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46567         LDKUnsignedChannelUpdate this_ptr_conv;
46568         this_ptr_conv.inner = untag_ptr(this_ptr);
46569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46571         this_ptr_conv.is_owned = false;
46572         LDKCVec_u8Z val_ref;
46573         val_ref.datalen = (*env)->GetArrayLength(env, val);
46574         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
46575         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
46576         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
46577 }
46578
46579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t short_channel_id_arg, int32_t timestamp_arg, int8_t flags_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int8_tArray excess_data_arg) {
46580         LDKThirtyTwoBytes chain_hash_arg_ref;
46581         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
46582         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
46583         LDKCVec_u8Z excess_data_arg_ref;
46584         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
46585         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46586         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
46587         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_new(chain_hash_arg_ref, short_channel_id_arg, timestamp_arg, flags_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fee_base_msat_arg, fee_proportional_millionths_arg, excess_data_arg_ref);
46588         int64_t ret_ref = 0;
46589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46591         return ret_ref;
46592 }
46593
46594 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
46595         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
46596         int64_t ret_ref = 0;
46597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46599         return ret_ref;
46600 }
46601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46602         LDKUnsignedChannelUpdate arg_conv;
46603         arg_conv.inner = untag_ptr(arg);
46604         arg_conv.is_owned = ptr_is_owned(arg);
46605         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46606         arg_conv.is_owned = false;
46607         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
46608         return ret_conv;
46609 }
46610
46611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46612         LDKUnsignedChannelUpdate orig_conv;
46613         orig_conv.inner = untag_ptr(orig);
46614         orig_conv.is_owned = ptr_is_owned(orig);
46615         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46616         orig_conv.is_owned = false;
46617         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
46618         int64_t ret_ref = 0;
46619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46621         return ret_ref;
46622 }
46623
46624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46625         LDKUnsignedChannelUpdate a_conv;
46626         a_conv.inner = untag_ptr(a);
46627         a_conv.is_owned = ptr_is_owned(a);
46628         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46629         a_conv.is_owned = false;
46630         LDKUnsignedChannelUpdate b_conv;
46631         b_conv.inner = untag_ptr(b);
46632         b_conv.is_owned = ptr_is_owned(b);
46633         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46634         b_conv.is_owned = false;
46635         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
46636         return ret_conv;
46637 }
46638
46639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46640         LDKChannelUpdate this_obj_conv;
46641         this_obj_conv.inner = untag_ptr(this_obj);
46642         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46644         ChannelUpdate_free(this_obj_conv);
46645 }
46646
46647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
46648         LDKChannelUpdate this_ptr_conv;
46649         this_ptr_conv.inner = untag_ptr(this_ptr);
46650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46652         this_ptr_conv.is_owned = false;
46653         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46654         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
46655         return ret_arr;
46656 }
46657
46658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46659         LDKChannelUpdate this_ptr_conv;
46660         this_ptr_conv.inner = untag_ptr(this_ptr);
46661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46663         this_ptr_conv.is_owned = false;
46664         LDKSignature val_ref;
46665         CHECK((*env)->GetArrayLength(env, val) == 64);
46666         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46667         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
46668 }
46669
46670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
46671         LDKChannelUpdate this_ptr_conv;
46672         this_ptr_conv.inner = untag_ptr(this_ptr);
46673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46675         this_ptr_conv.is_owned = false;
46676         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
46677         int64_t ret_ref = 0;
46678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46680         return ret_ref;
46681 }
46682
46683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46684         LDKChannelUpdate this_ptr_conv;
46685         this_ptr_conv.inner = untag_ptr(this_ptr);
46686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46688         this_ptr_conv.is_owned = false;
46689         LDKUnsignedChannelUpdate val_conv;
46690         val_conv.inner = untag_ptr(val);
46691         val_conv.is_owned = ptr_is_owned(val);
46692         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46693         val_conv = UnsignedChannelUpdate_clone(&val_conv);
46694         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
46695 }
46696
46697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
46698         LDKSignature signature_arg_ref;
46699         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
46700         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
46701         LDKUnsignedChannelUpdate contents_arg_conv;
46702         contents_arg_conv.inner = untag_ptr(contents_arg);
46703         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
46704         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
46705         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
46706         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
46707         int64_t ret_ref = 0;
46708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46710         return ret_ref;
46711 }
46712
46713 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
46714         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
46715         int64_t ret_ref = 0;
46716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46718         return ret_ref;
46719 }
46720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46721         LDKChannelUpdate arg_conv;
46722         arg_conv.inner = untag_ptr(arg);
46723         arg_conv.is_owned = ptr_is_owned(arg);
46724         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46725         arg_conv.is_owned = false;
46726         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
46727         return ret_conv;
46728 }
46729
46730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46731         LDKChannelUpdate orig_conv;
46732         orig_conv.inner = untag_ptr(orig);
46733         orig_conv.is_owned = ptr_is_owned(orig);
46734         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46735         orig_conv.is_owned = false;
46736         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
46737         int64_t ret_ref = 0;
46738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46740         return ret_ref;
46741 }
46742
46743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46744         LDKChannelUpdate a_conv;
46745         a_conv.inner = untag_ptr(a);
46746         a_conv.is_owned = ptr_is_owned(a);
46747         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46748         a_conv.is_owned = false;
46749         LDKChannelUpdate b_conv;
46750         b_conv.inner = untag_ptr(b);
46751         b_conv.is_owned = ptr_is_owned(b);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46753         b_conv.is_owned = false;
46754         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
46755         return ret_conv;
46756 }
46757
46758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46759         LDKQueryChannelRange this_obj_conv;
46760         this_obj_conv.inner = untag_ptr(this_obj);
46761         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46763         QueryChannelRange_free(this_obj_conv);
46764 }
46765
46766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46767         LDKQueryChannelRange this_ptr_conv;
46768         this_ptr_conv.inner = untag_ptr(this_ptr);
46769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46771         this_ptr_conv.is_owned = false;
46772         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46773         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
46774         return ret_arr;
46775 }
46776
46777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46778         LDKQueryChannelRange this_ptr_conv;
46779         this_ptr_conv.inner = untag_ptr(this_ptr);
46780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46782         this_ptr_conv.is_owned = false;
46783         LDKThirtyTwoBytes val_ref;
46784         CHECK((*env)->GetArrayLength(env, val) == 32);
46785         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46786         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
46787 }
46788
46789 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
46790         LDKQueryChannelRange this_ptr_conv;
46791         this_ptr_conv.inner = untag_ptr(this_ptr);
46792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46794         this_ptr_conv.is_owned = false;
46795         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
46796         return ret_conv;
46797 }
46798
46799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46800         LDKQueryChannelRange this_ptr_conv;
46801         this_ptr_conv.inner = untag_ptr(this_ptr);
46802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46804         this_ptr_conv.is_owned = false;
46805         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
46806 }
46807
46808 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
46809         LDKQueryChannelRange this_ptr_conv;
46810         this_ptr_conv.inner = untag_ptr(this_ptr);
46811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46813         this_ptr_conv.is_owned = false;
46814         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
46815         return ret_conv;
46816 }
46817
46818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46819         LDKQueryChannelRange this_ptr_conv;
46820         this_ptr_conv.inner = untag_ptr(this_ptr);
46821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46823         this_ptr_conv.is_owned = false;
46824         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
46825 }
46826
46827 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) {
46828         LDKThirtyTwoBytes chain_hash_arg_ref;
46829         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
46830         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
46831         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
46832         int64_t ret_ref = 0;
46833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46835         return ret_ref;
46836 }
46837
46838 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
46839         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
46840         int64_t ret_ref = 0;
46841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46843         return ret_ref;
46844 }
46845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46846         LDKQueryChannelRange arg_conv;
46847         arg_conv.inner = untag_ptr(arg);
46848         arg_conv.is_owned = ptr_is_owned(arg);
46849         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46850         arg_conv.is_owned = false;
46851         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
46852         return ret_conv;
46853 }
46854
46855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46856         LDKQueryChannelRange orig_conv;
46857         orig_conv.inner = untag_ptr(orig);
46858         orig_conv.is_owned = ptr_is_owned(orig);
46859         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46860         orig_conv.is_owned = false;
46861         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
46862         int64_t ret_ref = 0;
46863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46865         return ret_ref;
46866 }
46867
46868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46869         LDKQueryChannelRange a_conv;
46870         a_conv.inner = untag_ptr(a);
46871         a_conv.is_owned = ptr_is_owned(a);
46872         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46873         a_conv.is_owned = false;
46874         LDKQueryChannelRange b_conv;
46875         b_conv.inner = untag_ptr(b);
46876         b_conv.is_owned = ptr_is_owned(b);
46877         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46878         b_conv.is_owned = false;
46879         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
46880         return ret_conv;
46881 }
46882
46883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46884         LDKReplyChannelRange this_obj_conv;
46885         this_obj_conv.inner = untag_ptr(this_obj);
46886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46888         ReplyChannelRange_free(this_obj_conv);
46889 }
46890
46891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46892         LDKReplyChannelRange this_ptr_conv;
46893         this_ptr_conv.inner = untag_ptr(this_ptr);
46894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46896         this_ptr_conv.is_owned = false;
46897         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46898         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
46899         return ret_arr;
46900 }
46901
46902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46903         LDKReplyChannelRange this_ptr_conv;
46904         this_ptr_conv.inner = untag_ptr(this_ptr);
46905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46907         this_ptr_conv.is_owned = false;
46908         LDKThirtyTwoBytes val_ref;
46909         CHECK((*env)->GetArrayLength(env, val) == 32);
46910         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46911         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
46912 }
46913
46914 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
46915         LDKReplyChannelRange this_ptr_conv;
46916         this_ptr_conv.inner = untag_ptr(this_ptr);
46917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46919         this_ptr_conv.is_owned = false;
46920         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
46921         return ret_conv;
46922 }
46923
46924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46925         LDKReplyChannelRange this_ptr_conv;
46926         this_ptr_conv.inner = untag_ptr(this_ptr);
46927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46929         this_ptr_conv.is_owned = false;
46930         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
46931 }
46932
46933 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
46934         LDKReplyChannelRange this_ptr_conv;
46935         this_ptr_conv.inner = untag_ptr(this_ptr);
46936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46938         this_ptr_conv.is_owned = false;
46939         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
46940         return ret_conv;
46941 }
46942
46943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46944         LDKReplyChannelRange this_ptr_conv;
46945         this_ptr_conv.inner = untag_ptr(this_ptr);
46946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46948         this_ptr_conv.is_owned = false;
46949         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
46950 }
46951
46952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
46953         LDKReplyChannelRange this_ptr_conv;
46954         this_ptr_conv.inner = untag_ptr(this_ptr);
46955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46957         this_ptr_conv.is_owned = false;
46958         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
46959         return ret_conv;
46960 }
46961
46962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
46963         LDKReplyChannelRange this_ptr_conv;
46964         this_ptr_conv.inner = untag_ptr(this_ptr);
46965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46967         this_ptr_conv.is_owned = false;
46968         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
46969 }
46970
46971 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
46972         LDKReplyChannelRange this_ptr_conv;
46973         this_ptr_conv.inner = untag_ptr(this_ptr);
46974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46976         this_ptr_conv.is_owned = false;
46977         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
46978         int64_tArray ret_arr = NULL;
46979         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46980         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46981         for (size_t g = 0; g < ret_var.datalen; g++) {
46982                 int64_t ret_conv_6_conv = ret_var.data[g];
46983                 ret_arr_ptr[g] = ret_conv_6_conv;
46984         }
46985         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46986         FREE(ret_var.data);
46987         return ret_arr;
46988 }
46989
46990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
46991         LDKReplyChannelRange this_ptr_conv;
46992         this_ptr_conv.inner = untag_ptr(this_ptr);
46993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46995         this_ptr_conv.is_owned = false;
46996         LDKCVec_u64Z val_constr;
46997         val_constr.datalen = (*env)->GetArrayLength(env, val);
46998         if (val_constr.datalen > 0)
46999                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47000         else
47001                 val_constr.data = NULL;
47002         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47003         for (size_t g = 0; g < val_constr.datalen; g++) {
47004                 int64_t val_conv_6 = val_vals[g];
47005                 val_constr.data[g] = val_conv_6;
47006         }
47007         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47008         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
47009 }
47010
47011 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) {
47012         LDKThirtyTwoBytes chain_hash_arg_ref;
47013         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47014         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47015         LDKCVec_u64Z short_channel_ids_arg_constr;
47016         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
47017         if (short_channel_ids_arg_constr.datalen > 0)
47018                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47019         else
47020                 short_channel_ids_arg_constr.data = NULL;
47021         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
47022         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
47023                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
47024                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
47025         }
47026         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
47027         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
47028         int64_t ret_ref = 0;
47029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47031         return ret_ref;
47032 }
47033
47034 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
47035         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
47036         int64_t ret_ref = 0;
47037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47039         return ret_ref;
47040 }
47041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47042         LDKReplyChannelRange arg_conv;
47043         arg_conv.inner = untag_ptr(arg);
47044         arg_conv.is_owned = ptr_is_owned(arg);
47045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47046         arg_conv.is_owned = false;
47047         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
47048         return ret_conv;
47049 }
47050
47051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47052         LDKReplyChannelRange orig_conv;
47053         orig_conv.inner = untag_ptr(orig);
47054         orig_conv.is_owned = ptr_is_owned(orig);
47055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47056         orig_conv.is_owned = false;
47057         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
47058         int64_t ret_ref = 0;
47059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47061         return ret_ref;
47062 }
47063
47064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47065         LDKReplyChannelRange a_conv;
47066         a_conv.inner = untag_ptr(a);
47067         a_conv.is_owned = ptr_is_owned(a);
47068         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47069         a_conv.is_owned = false;
47070         LDKReplyChannelRange b_conv;
47071         b_conv.inner = untag_ptr(b);
47072         b_conv.is_owned = ptr_is_owned(b);
47073         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47074         b_conv.is_owned = false;
47075         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
47076         return ret_conv;
47077 }
47078
47079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47080         LDKQueryShortChannelIds this_obj_conv;
47081         this_obj_conv.inner = untag_ptr(this_obj);
47082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47084         QueryShortChannelIds_free(this_obj_conv);
47085 }
47086
47087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
47088         LDKQueryShortChannelIds this_ptr_conv;
47089         this_ptr_conv.inner = untag_ptr(this_ptr);
47090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47092         this_ptr_conv.is_owned = false;
47093         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47094         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
47095         return ret_arr;
47096 }
47097
47098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47099         LDKQueryShortChannelIds this_ptr_conv;
47100         this_ptr_conv.inner = untag_ptr(this_ptr);
47101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47103         this_ptr_conv.is_owned = false;
47104         LDKThirtyTwoBytes val_ref;
47105         CHECK((*env)->GetArrayLength(env, val) == 32);
47106         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47107         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
47108 }
47109
47110 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
47111         LDKQueryShortChannelIds this_ptr_conv;
47112         this_ptr_conv.inner = untag_ptr(this_ptr);
47113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47115         this_ptr_conv.is_owned = false;
47116         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
47117         int64_tArray ret_arr = NULL;
47118         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47119         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47120         for (size_t g = 0; g < ret_var.datalen; g++) {
47121                 int64_t ret_conv_6_conv = ret_var.data[g];
47122                 ret_arr_ptr[g] = ret_conv_6_conv;
47123         }
47124         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47125         FREE(ret_var.data);
47126         return ret_arr;
47127 }
47128
47129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47130         LDKQueryShortChannelIds this_ptr_conv;
47131         this_ptr_conv.inner = untag_ptr(this_ptr);
47132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47134         this_ptr_conv.is_owned = false;
47135         LDKCVec_u64Z val_constr;
47136         val_constr.datalen = (*env)->GetArrayLength(env, val);
47137         if (val_constr.datalen > 0)
47138                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47139         else
47140                 val_constr.data = NULL;
47141         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47142         for (size_t g = 0; g < val_constr.datalen; g++) {
47143                 int64_t val_conv_6 = val_vals[g];
47144                 val_constr.data[g] = val_conv_6;
47145         }
47146         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47147         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
47148 }
47149
47150 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) {
47151         LDKThirtyTwoBytes chain_hash_arg_ref;
47152         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47153         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47154         LDKCVec_u64Z short_channel_ids_arg_constr;
47155         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
47156         if (short_channel_ids_arg_constr.datalen > 0)
47157                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47158         else
47159                 short_channel_ids_arg_constr.data = NULL;
47160         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
47161         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
47162                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
47163                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
47164         }
47165         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
47166         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
47167         int64_t ret_ref = 0;
47168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47170         return ret_ref;
47171 }
47172
47173 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
47174         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
47175         int64_t ret_ref = 0;
47176         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47177         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47178         return ret_ref;
47179 }
47180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47181         LDKQueryShortChannelIds arg_conv;
47182         arg_conv.inner = untag_ptr(arg);
47183         arg_conv.is_owned = ptr_is_owned(arg);
47184         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47185         arg_conv.is_owned = false;
47186         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
47187         return ret_conv;
47188 }
47189
47190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47191         LDKQueryShortChannelIds orig_conv;
47192         orig_conv.inner = untag_ptr(orig);
47193         orig_conv.is_owned = ptr_is_owned(orig);
47194         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47195         orig_conv.is_owned = false;
47196         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
47197         int64_t ret_ref = 0;
47198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47200         return ret_ref;
47201 }
47202
47203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47204         LDKQueryShortChannelIds a_conv;
47205         a_conv.inner = untag_ptr(a);
47206         a_conv.is_owned = ptr_is_owned(a);
47207         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47208         a_conv.is_owned = false;
47209         LDKQueryShortChannelIds b_conv;
47210         b_conv.inner = untag_ptr(b);
47211         b_conv.is_owned = ptr_is_owned(b);
47212         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47213         b_conv.is_owned = false;
47214         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
47215         return ret_conv;
47216 }
47217
47218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47219         LDKReplyShortChannelIdsEnd this_obj_conv;
47220         this_obj_conv.inner = untag_ptr(this_obj);
47221         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47223         ReplyShortChannelIdsEnd_free(this_obj_conv);
47224 }
47225
47226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
47227         LDKReplyShortChannelIdsEnd this_ptr_conv;
47228         this_ptr_conv.inner = untag_ptr(this_ptr);
47229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47231         this_ptr_conv.is_owned = false;
47232         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47233         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
47234         return ret_arr;
47235 }
47236
47237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47238         LDKReplyShortChannelIdsEnd this_ptr_conv;
47239         this_ptr_conv.inner = untag_ptr(this_ptr);
47240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47242         this_ptr_conv.is_owned = false;
47243         LDKThirtyTwoBytes val_ref;
47244         CHECK((*env)->GetArrayLength(env, val) == 32);
47245         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47246         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
47247 }
47248
47249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
47250         LDKReplyShortChannelIdsEnd this_ptr_conv;
47251         this_ptr_conv.inner = untag_ptr(this_ptr);
47252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47254         this_ptr_conv.is_owned = false;
47255         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
47256         return ret_conv;
47257 }
47258
47259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47260         LDKReplyShortChannelIdsEnd this_ptr_conv;
47261         this_ptr_conv.inner = untag_ptr(this_ptr);
47262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47264         this_ptr_conv.is_owned = false;
47265         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
47266 }
47267
47268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
47269         LDKThirtyTwoBytes chain_hash_arg_ref;
47270         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47271         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47272         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
47273         int64_t ret_ref = 0;
47274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47276         return ret_ref;
47277 }
47278
47279 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
47280         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
47281         int64_t ret_ref = 0;
47282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47284         return ret_ref;
47285 }
47286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47287         LDKReplyShortChannelIdsEnd arg_conv;
47288         arg_conv.inner = untag_ptr(arg);
47289         arg_conv.is_owned = ptr_is_owned(arg);
47290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47291         arg_conv.is_owned = false;
47292         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
47293         return ret_conv;
47294 }
47295
47296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47297         LDKReplyShortChannelIdsEnd orig_conv;
47298         orig_conv.inner = untag_ptr(orig);
47299         orig_conv.is_owned = ptr_is_owned(orig);
47300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47301         orig_conv.is_owned = false;
47302         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
47303         int64_t ret_ref = 0;
47304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47306         return ret_ref;
47307 }
47308
47309 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47310         LDKReplyShortChannelIdsEnd a_conv;
47311         a_conv.inner = untag_ptr(a);
47312         a_conv.is_owned = ptr_is_owned(a);
47313         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47314         a_conv.is_owned = false;
47315         LDKReplyShortChannelIdsEnd b_conv;
47316         b_conv.inner = untag_ptr(b);
47317         b_conv.is_owned = ptr_is_owned(b);
47318         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47319         b_conv.is_owned = false;
47320         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
47321         return ret_conv;
47322 }
47323
47324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47325         LDKGossipTimestampFilter this_obj_conv;
47326         this_obj_conv.inner = untag_ptr(this_obj);
47327         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47329         GossipTimestampFilter_free(this_obj_conv);
47330 }
47331
47332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
47333         LDKGossipTimestampFilter this_ptr_conv;
47334         this_ptr_conv.inner = untag_ptr(this_ptr);
47335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47337         this_ptr_conv.is_owned = false;
47338         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47339         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
47340         return ret_arr;
47341 }
47342
47343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47344         LDKGossipTimestampFilter this_ptr_conv;
47345         this_ptr_conv.inner = untag_ptr(this_ptr);
47346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47348         this_ptr_conv.is_owned = false;
47349         LDKThirtyTwoBytes val_ref;
47350         CHECK((*env)->GetArrayLength(env, val) == 32);
47351         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47352         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
47353 }
47354
47355 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
47356         LDKGossipTimestampFilter this_ptr_conv;
47357         this_ptr_conv.inner = untag_ptr(this_ptr);
47358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47360         this_ptr_conv.is_owned = false;
47361         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
47362         return ret_conv;
47363 }
47364
47365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47366         LDKGossipTimestampFilter this_ptr_conv;
47367         this_ptr_conv.inner = untag_ptr(this_ptr);
47368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47370         this_ptr_conv.is_owned = false;
47371         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
47372 }
47373
47374 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
47375         LDKGossipTimestampFilter this_ptr_conv;
47376         this_ptr_conv.inner = untag_ptr(this_ptr);
47377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47379         this_ptr_conv.is_owned = false;
47380         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
47381         return ret_conv;
47382 }
47383
47384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47385         LDKGossipTimestampFilter this_ptr_conv;
47386         this_ptr_conv.inner = untag_ptr(this_ptr);
47387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47389         this_ptr_conv.is_owned = false;
47390         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
47391 }
47392
47393 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) {
47394         LDKThirtyTwoBytes chain_hash_arg_ref;
47395         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47396         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47397         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
47398         int64_t ret_ref = 0;
47399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47401         return ret_ref;
47402 }
47403
47404 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
47405         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
47406         int64_t ret_ref = 0;
47407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47409         return ret_ref;
47410 }
47411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47412         LDKGossipTimestampFilter arg_conv;
47413         arg_conv.inner = untag_ptr(arg);
47414         arg_conv.is_owned = ptr_is_owned(arg);
47415         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47416         arg_conv.is_owned = false;
47417         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
47418         return ret_conv;
47419 }
47420
47421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47422         LDKGossipTimestampFilter orig_conv;
47423         orig_conv.inner = untag_ptr(orig);
47424         orig_conv.is_owned = ptr_is_owned(orig);
47425         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47426         orig_conv.is_owned = false;
47427         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
47428         int64_t ret_ref = 0;
47429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47431         return ret_ref;
47432 }
47433
47434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47435         LDKGossipTimestampFilter a_conv;
47436         a_conv.inner = untag_ptr(a);
47437         a_conv.is_owned = ptr_is_owned(a);
47438         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47439         a_conv.is_owned = false;
47440         LDKGossipTimestampFilter b_conv;
47441         b_conv.inner = untag_ptr(b);
47442         b_conv.is_owned = ptr_is_owned(b);
47443         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47444         b_conv.is_owned = false;
47445         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
47446         return ret_conv;
47447 }
47448
47449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47450         if (!ptr_is_owned(this_ptr)) return;
47451         void* this_ptr_ptr = untag_ptr(this_ptr);
47452         CHECK_ACCESS(this_ptr_ptr);
47453         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
47454         FREE(untag_ptr(this_ptr));
47455         ErrorAction_free(this_ptr_conv);
47456 }
47457
47458 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
47459         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47460         *ret_copy = ErrorAction_clone(arg);
47461         int64_t ret_ref = tag_ptr(ret_copy, true);
47462         return ret_ref;
47463 }
47464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47465         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
47466         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
47467         return ret_conv;
47468 }
47469
47470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47471         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
47472         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47473         *ret_copy = ErrorAction_clone(orig_conv);
47474         int64_t ret_ref = tag_ptr(ret_copy, true);
47475         return ret_ref;
47476 }
47477
47478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
47479         LDKErrorMessage msg_conv;
47480         msg_conv.inner = untag_ptr(msg);
47481         msg_conv.is_owned = ptr_is_owned(msg);
47482         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
47483         msg_conv = ErrorMessage_clone(&msg_conv);
47484         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47485         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
47486         int64_t ret_ref = tag_ptr(ret_copy, true);
47487         return ret_ref;
47488 }
47489
47490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
47491         LDKWarningMessage msg_conv;
47492         msg_conv.inner = untag_ptr(msg);
47493         msg_conv.is_owned = ptr_is_owned(msg);
47494         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
47495         msg_conv = WarningMessage_clone(&msg_conv);
47496         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47497         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
47498         int64_t ret_ref = tag_ptr(ret_copy, true);
47499         return ret_ref;
47500 }
47501
47502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
47503         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47504         *ret_copy = ErrorAction_ignore_error();
47505         int64_t ret_ref = tag_ptr(ret_copy, true);
47506         return ret_ref;
47507 }
47508
47509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
47510         LDKLevel a_conv = LDKLevel_from_java(env, a);
47511         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47512         *ret_copy = ErrorAction_ignore_and_log(a_conv);
47513         int64_t ret_ref = tag_ptr(ret_copy, true);
47514         return ret_ref;
47515 }
47516
47517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
47518         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47519         *ret_copy = ErrorAction_ignore_duplicate_gossip();
47520         int64_t ret_ref = tag_ptr(ret_copy, true);
47521         return ret_ref;
47522 }
47523
47524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
47525         LDKErrorMessage msg_conv;
47526         msg_conv.inner = untag_ptr(msg);
47527         msg_conv.is_owned = ptr_is_owned(msg);
47528         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
47529         msg_conv = ErrorMessage_clone(&msg_conv);
47530         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47531         *ret_copy = ErrorAction_send_error_message(msg_conv);
47532         int64_t ret_ref = tag_ptr(ret_copy, true);
47533         return ret_ref;
47534 }
47535
47536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
47537         LDKWarningMessage msg_conv;
47538         msg_conv.inner = untag_ptr(msg);
47539         msg_conv.is_owned = ptr_is_owned(msg);
47540         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
47541         msg_conv = WarningMessage_clone(&msg_conv);
47542         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
47543         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47544         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
47545         int64_t ret_ref = tag_ptr(ret_copy, true);
47546         return ret_ref;
47547 }
47548
47549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47550         LDKLightningError this_obj_conv;
47551         this_obj_conv.inner = untag_ptr(this_obj);
47552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47554         LightningError_free(this_obj_conv);
47555 }
47556
47557 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
47558         LDKLightningError this_ptr_conv;
47559         this_ptr_conv.inner = untag_ptr(this_ptr);
47560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47562         this_ptr_conv.is_owned = false;
47563         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
47564         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47565         Str_free(ret_str);
47566         return ret_conv;
47567 }
47568
47569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
47570         LDKLightningError this_ptr_conv;
47571         this_ptr_conv.inner = untag_ptr(this_ptr);
47572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47574         this_ptr_conv.is_owned = false;
47575         LDKStr val_conv = java_to_owned_str(env, val);
47576         LightningError_set_err(&this_ptr_conv, val_conv);
47577 }
47578
47579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
47580         LDKLightningError this_ptr_conv;
47581         this_ptr_conv.inner = untag_ptr(this_ptr);
47582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47584         this_ptr_conv.is_owned = false;
47585         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47586         *ret_copy = LightningError_get_action(&this_ptr_conv);
47587         int64_t ret_ref = tag_ptr(ret_copy, true);
47588         return ret_ref;
47589 }
47590
47591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47592         LDKLightningError this_ptr_conv;
47593         this_ptr_conv.inner = untag_ptr(this_ptr);
47594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47596         this_ptr_conv.is_owned = false;
47597         void* val_ptr = untag_ptr(val);
47598         CHECK_ACCESS(val_ptr);
47599         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
47600         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
47601         LightningError_set_action(&this_ptr_conv, val_conv);
47602 }
47603
47604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
47605         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
47606         void* action_arg_ptr = untag_ptr(action_arg);
47607         CHECK_ACCESS(action_arg_ptr);
47608         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
47609         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
47610         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
47611         int64_t ret_ref = 0;
47612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47614         return ret_ref;
47615 }
47616
47617 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
47618         LDKLightningError ret_var = LightningError_clone(arg);
47619         int64_t ret_ref = 0;
47620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47622         return ret_ref;
47623 }
47624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47625         LDKLightningError arg_conv;
47626         arg_conv.inner = untag_ptr(arg);
47627         arg_conv.is_owned = ptr_is_owned(arg);
47628         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47629         arg_conv.is_owned = false;
47630         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
47631         return ret_conv;
47632 }
47633
47634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47635         LDKLightningError orig_conv;
47636         orig_conv.inner = untag_ptr(orig);
47637         orig_conv.is_owned = ptr_is_owned(orig);
47638         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47639         orig_conv.is_owned = false;
47640         LDKLightningError ret_var = LightningError_clone(&orig_conv);
47641         int64_t ret_ref = 0;
47642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47644         return ret_ref;
47645 }
47646
47647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47648         LDKCommitmentUpdate this_obj_conv;
47649         this_obj_conv.inner = untag_ptr(this_obj);
47650         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47652         CommitmentUpdate_free(this_obj_conv);
47653 }
47654
47655 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47656         LDKCommitmentUpdate this_ptr_conv;
47657         this_ptr_conv.inner = untag_ptr(this_ptr);
47658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47660         this_ptr_conv.is_owned = false;
47661         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
47662         int64_tArray ret_arr = NULL;
47663         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47664         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47665         for (size_t p = 0; p < ret_var.datalen; p++) {
47666                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
47667                 int64_t ret_conv_15_ref = 0;
47668                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
47669                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
47670                 ret_arr_ptr[p] = ret_conv_15_ref;
47671         }
47672         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47673         FREE(ret_var.data);
47674         return ret_arr;
47675 }
47676
47677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47678         LDKCommitmentUpdate this_ptr_conv;
47679         this_ptr_conv.inner = untag_ptr(this_ptr);
47680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47682         this_ptr_conv.is_owned = false;
47683         LDKCVec_UpdateAddHTLCZ val_constr;
47684         val_constr.datalen = (*env)->GetArrayLength(env, val);
47685         if (val_constr.datalen > 0)
47686                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
47687         else
47688                 val_constr.data = NULL;
47689         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47690         for (size_t p = 0; p < val_constr.datalen; p++) {
47691                 int64_t val_conv_15 = val_vals[p];
47692                 LDKUpdateAddHTLC val_conv_15_conv;
47693                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
47694                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
47695                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
47696                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
47697                 val_constr.data[p] = val_conv_15_conv;
47698         }
47699         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47700         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
47701 }
47702
47703 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47704         LDKCommitmentUpdate this_ptr_conv;
47705         this_ptr_conv.inner = untag_ptr(this_ptr);
47706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47708         this_ptr_conv.is_owned = false;
47709         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
47710         int64_tArray ret_arr = NULL;
47711         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47712         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47713         for (size_t t = 0; t < ret_var.datalen; t++) {
47714                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
47715                 int64_t ret_conv_19_ref = 0;
47716                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
47717                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
47718                 ret_arr_ptr[t] = ret_conv_19_ref;
47719         }
47720         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47721         FREE(ret_var.data);
47722         return ret_arr;
47723 }
47724
47725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47726         LDKCommitmentUpdate this_ptr_conv;
47727         this_ptr_conv.inner = untag_ptr(this_ptr);
47728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47730         this_ptr_conv.is_owned = false;
47731         LDKCVec_UpdateFulfillHTLCZ val_constr;
47732         val_constr.datalen = (*env)->GetArrayLength(env, val);
47733         if (val_constr.datalen > 0)
47734                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
47735         else
47736                 val_constr.data = NULL;
47737         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47738         for (size_t t = 0; t < val_constr.datalen; t++) {
47739                 int64_t val_conv_19 = val_vals[t];
47740                 LDKUpdateFulfillHTLC val_conv_19_conv;
47741                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
47742                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
47743                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
47744                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
47745                 val_constr.data[t] = val_conv_19_conv;
47746         }
47747         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47748         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
47749 }
47750
47751 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47752         LDKCommitmentUpdate this_ptr_conv;
47753         this_ptr_conv.inner = untag_ptr(this_ptr);
47754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47756         this_ptr_conv.is_owned = false;
47757         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
47758         int64_tArray ret_arr = NULL;
47759         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47760         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47761         for (size_t q = 0; q < ret_var.datalen; q++) {
47762                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
47763                 int64_t ret_conv_16_ref = 0;
47764                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47765                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47766                 ret_arr_ptr[q] = ret_conv_16_ref;
47767         }
47768         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47769         FREE(ret_var.data);
47770         return ret_arr;
47771 }
47772
47773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47774         LDKCommitmentUpdate this_ptr_conv;
47775         this_ptr_conv.inner = untag_ptr(this_ptr);
47776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47778         this_ptr_conv.is_owned = false;
47779         LDKCVec_UpdateFailHTLCZ val_constr;
47780         val_constr.datalen = (*env)->GetArrayLength(env, val);
47781         if (val_constr.datalen > 0)
47782                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
47783         else
47784                 val_constr.data = NULL;
47785         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47786         for (size_t q = 0; q < val_constr.datalen; q++) {
47787                 int64_t val_conv_16 = val_vals[q];
47788                 LDKUpdateFailHTLC val_conv_16_conv;
47789                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
47790                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
47791                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
47792                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
47793                 val_constr.data[q] = val_conv_16_conv;
47794         }
47795         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47796         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
47797 }
47798
47799 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47800         LDKCommitmentUpdate this_ptr_conv;
47801         this_ptr_conv.inner = untag_ptr(this_ptr);
47802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47804         this_ptr_conv.is_owned = false;
47805         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
47806         int64_tArray ret_arr = NULL;
47807         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47808         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47809         for (size_t z = 0; z < ret_var.datalen; z++) {
47810                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
47811                 int64_t ret_conv_25_ref = 0;
47812                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
47813                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
47814                 ret_arr_ptr[z] = ret_conv_25_ref;
47815         }
47816         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47817         FREE(ret_var.data);
47818         return ret_arr;
47819 }
47820
47821 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) {
47822         LDKCommitmentUpdate this_ptr_conv;
47823         this_ptr_conv.inner = untag_ptr(this_ptr);
47824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47826         this_ptr_conv.is_owned = false;
47827         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
47828         val_constr.datalen = (*env)->GetArrayLength(env, val);
47829         if (val_constr.datalen > 0)
47830                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
47831         else
47832                 val_constr.data = NULL;
47833         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47834         for (size_t z = 0; z < val_constr.datalen; z++) {
47835                 int64_t val_conv_25 = val_vals[z];
47836                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
47837                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
47838                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
47839                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
47840                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
47841                 val_constr.data[z] = val_conv_25_conv;
47842         }
47843         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47844         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
47845 }
47846
47847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
47848         LDKCommitmentUpdate this_ptr_conv;
47849         this_ptr_conv.inner = untag_ptr(this_ptr);
47850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47852         this_ptr_conv.is_owned = false;
47853         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
47854         int64_t ret_ref = 0;
47855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47857         return ret_ref;
47858 }
47859
47860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47861         LDKCommitmentUpdate this_ptr_conv;
47862         this_ptr_conv.inner = untag_ptr(this_ptr);
47863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47865         this_ptr_conv.is_owned = false;
47866         LDKUpdateFee val_conv;
47867         val_conv.inner = untag_ptr(val);
47868         val_conv.is_owned = ptr_is_owned(val);
47869         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47870         val_conv = UpdateFee_clone(&val_conv);
47871         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
47872 }
47873
47874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
47875         LDKCommitmentUpdate this_ptr_conv;
47876         this_ptr_conv.inner = untag_ptr(this_ptr);
47877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47879         this_ptr_conv.is_owned = false;
47880         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
47881         int64_t ret_ref = 0;
47882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47884         return ret_ref;
47885 }
47886
47887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47888         LDKCommitmentUpdate this_ptr_conv;
47889         this_ptr_conv.inner = untag_ptr(this_ptr);
47890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47892         this_ptr_conv.is_owned = false;
47893         LDKCommitmentSigned val_conv;
47894         val_conv.inner = untag_ptr(val);
47895         val_conv.is_owned = ptr_is_owned(val);
47896         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47897         val_conv = CommitmentSigned_clone(&val_conv);
47898         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
47899 }
47900
47901 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) {
47902         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
47903         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
47904         if (update_add_htlcs_arg_constr.datalen > 0)
47905                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
47906         else
47907                 update_add_htlcs_arg_constr.data = NULL;
47908         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
47909         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
47910                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
47911                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
47912                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
47913                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
47914                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
47915                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
47916                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
47917         }
47918         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
47919         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
47920         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
47921         if (update_fulfill_htlcs_arg_constr.datalen > 0)
47922                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
47923         else
47924                 update_fulfill_htlcs_arg_constr.data = NULL;
47925         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
47926         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
47927                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
47928                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
47929                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
47930                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
47931                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
47932                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
47933                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
47934         }
47935         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
47936         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
47937         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
47938         if (update_fail_htlcs_arg_constr.datalen > 0)
47939                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
47940         else
47941                 update_fail_htlcs_arg_constr.data = NULL;
47942         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
47943         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
47944                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
47945                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
47946                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
47947                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
47948                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
47949                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
47950                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
47951         }
47952         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
47953         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
47954         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
47955         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
47956                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
47957         else
47958                 update_fail_malformed_htlcs_arg_constr.data = NULL;
47959         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
47960         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
47961                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
47962                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
47963                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
47964                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
47965                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
47966                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
47967                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
47968         }
47969         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
47970         LDKUpdateFee update_fee_arg_conv;
47971         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
47972         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
47973         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
47974         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
47975         LDKCommitmentSigned commitment_signed_arg_conv;
47976         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
47977         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
47978         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
47979         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
47980         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);
47981         int64_t ret_ref = 0;
47982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47984         return ret_ref;
47985 }
47986
47987 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
47988         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
47989         int64_t ret_ref = 0;
47990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47992         return ret_ref;
47993 }
47994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47995         LDKCommitmentUpdate arg_conv;
47996         arg_conv.inner = untag_ptr(arg);
47997         arg_conv.is_owned = ptr_is_owned(arg);
47998         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47999         arg_conv.is_owned = false;
48000         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
48001         return ret_conv;
48002 }
48003
48004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48005         LDKCommitmentUpdate orig_conv;
48006         orig_conv.inner = untag_ptr(orig);
48007         orig_conv.is_owned = ptr_is_owned(orig);
48008         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48009         orig_conv.is_owned = false;
48010         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
48011         int64_t ret_ref = 0;
48012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48014         return ret_ref;
48015 }
48016
48017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48018         LDKCommitmentUpdate a_conv;
48019         a_conv.inner = untag_ptr(a);
48020         a_conv.is_owned = ptr_is_owned(a);
48021         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48022         a_conv.is_owned = false;
48023         LDKCommitmentUpdate b_conv;
48024         b_conv.inner = untag_ptr(b);
48025         b_conv.is_owned = ptr_is_owned(b);
48026         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48027         b_conv.is_owned = false;
48028         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
48029         return ret_conv;
48030 }
48031
48032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48033         if (!ptr_is_owned(this_ptr)) return;
48034         void* this_ptr_ptr = untag_ptr(this_ptr);
48035         CHECK_ACCESS(this_ptr_ptr);
48036         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
48037         FREE(untag_ptr(this_ptr));
48038         ChannelMessageHandler_free(this_ptr_conv);
48039 }
48040
48041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48042         if (!ptr_is_owned(this_ptr)) return;
48043         void* this_ptr_ptr = untag_ptr(this_ptr);
48044         CHECK_ACCESS(this_ptr_ptr);
48045         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
48046         FREE(untag_ptr(this_ptr));
48047         RoutingMessageHandler_free(this_ptr_conv);
48048 }
48049
48050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48051         if (!ptr_is_owned(this_ptr)) return;
48052         void* this_ptr_ptr = untag_ptr(this_ptr);
48053         CHECK_ACCESS(this_ptr_ptr);
48054         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
48055         FREE(untag_ptr(this_ptr));
48056         OnionMessageHandler_free(this_ptr_conv);
48057 }
48058
48059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
48060         LDKAcceptChannel obj_conv;
48061         obj_conv.inner = untag_ptr(obj);
48062         obj_conv.is_owned = ptr_is_owned(obj);
48063         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48064         obj_conv.is_owned = false;
48065         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
48066         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48067         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48068         CVec_u8Z_free(ret_var);
48069         return ret_arr;
48070 }
48071
48072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48073         LDKu8slice ser_ref;
48074         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48075         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48076         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
48077         *ret_conv = AcceptChannel_read(ser_ref);
48078         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48079         return tag_ptr(ret_conv, true);
48080 }
48081
48082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
48083         LDKAcceptChannelV2 obj_conv;
48084         obj_conv.inner = untag_ptr(obj);
48085         obj_conv.is_owned = ptr_is_owned(obj);
48086         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48087         obj_conv.is_owned = false;
48088         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
48089         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48090         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48091         CVec_u8Z_free(ret_var);
48092         return ret_arr;
48093 }
48094
48095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48096         LDKu8slice ser_ref;
48097         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48098         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48099         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
48100         *ret_conv = AcceptChannelV2_read(ser_ref);
48101         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48102         return tag_ptr(ret_conv, true);
48103 }
48104
48105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
48106         LDKTxAddInput obj_conv;
48107         obj_conv.inner = untag_ptr(obj);
48108         obj_conv.is_owned = ptr_is_owned(obj);
48109         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48110         obj_conv.is_owned = false;
48111         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
48112         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48113         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48114         CVec_u8Z_free(ret_var);
48115         return ret_arr;
48116 }
48117
48118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48119         LDKu8slice ser_ref;
48120         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48121         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48122         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
48123         *ret_conv = TxAddInput_read(ser_ref);
48124         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48125         return tag_ptr(ret_conv, true);
48126 }
48127
48128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
48129         LDKTxAddOutput obj_conv;
48130         obj_conv.inner = untag_ptr(obj);
48131         obj_conv.is_owned = ptr_is_owned(obj);
48132         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48133         obj_conv.is_owned = false;
48134         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
48135         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48136         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48137         CVec_u8Z_free(ret_var);
48138         return ret_arr;
48139 }
48140
48141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48142         LDKu8slice ser_ref;
48143         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48144         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48145         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
48146         *ret_conv = TxAddOutput_read(ser_ref);
48147         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48148         return tag_ptr(ret_conv, true);
48149 }
48150
48151 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
48152         LDKTxRemoveInput obj_conv;
48153         obj_conv.inner = untag_ptr(obj);
48154         obj_conv.is_owned = ptr_is_owned(obj);
48155         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48156         obj_conv.is_owned = false;
48157         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
48158         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48159         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48160         CVec_u8Z_free(ret_var);
48161         return ret_arr;
48162 }
48163
48164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48165         LDKu8slice ser_ref;
48166         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48167         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48168         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
48169         *ret_conv = TxRemoveInput_read(ser_ref);
48170         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48171         return tag_ptr(ret_conv, true);
48172 }
48173
48174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
48175         LDKTxRemoveOutput obj_conv;
48176         obj_conv.inner = untag_ptr(obj);
48177         obj_conv.is_owned = ptr_is_owned(obj);
48178         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48179         obj_conv.is_owned = false;
48180         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
48181         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48182         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48183         CVec_u8Z_free(ret_var);
48184         return ret_arr;
48185 }
48186
48187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48188         LDKu8slice ser_ref;
48189         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48190         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48191         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
48192         *ret_conv = TxRemoveOutput_read(ser_ref);
48193         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48194         return tag_ptr(ret_conv, true);
48195 }
48196
48197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
48198         LDKTxComplete obj_conv;
48199         obj_conv.inner = untag_ptr(obj);
48200         obj_conv.is_owned = ptr_is_owned(obj);
48201         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48202         obj_conv.is_owned = false;
48203         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
48204         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48205         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48206         CVec_u8Z_free(ret_var);
48207         return ret_arr;
48208 }
48209
48210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48211         LDKu8slice ser_ref;
48212         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48213         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48214         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
48215         *ret_conv = TxComplete_read(ser_ref);
48216         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48217         return tag_ptr(ret_conv, true);
48218 }
48219
48220 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
48221         LDKTxSignatures obj_conv;
48222         obj_conv.inner = untag_ptr(obj);
48223         obj_conv.is_owned = ptr_is_owned(obj);
48224         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48225         obj_conv.is_owned = false;
48226         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
48227         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48228         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48229         CVec_u8Z_free(ret_var);
48230         return ret_arr;
48231 }
48232
48233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48234         LDKu8slice ser_ref;
48235         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48236         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48237         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
48238         *ret_conv = TxSignatures_read(ser_ref);
48239         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48240         return tag_ptr(ret_conv, true);
48241 }
48242
48243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
48244         LDKTxInitRbf obj_conv;
48245         obj_conv.inner = untag_ptr(obj);
48246         obj_conv.is_owned = ptr_is_owned(obj);
48247         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48248         obj_conv.is_owned = false;
48249         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
48250         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48251         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48252         CVec_u8Z_free(ret_var);
48253         return ret_arr;
48254 }
48255
48256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48257         LDKu8slice ser_ref;
48258         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48259         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48260         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
48261         *ret_conv = TxInitRbf_read(ser_ref);
48262         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48263         return tag_ptr(ret_conv, true);
48264 }
48265
48266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
48267         LDKTxAckRbf obj_conv;
48268         obj_conv.inner = untag_ptr(obj);
48269         obj_conv.is_owned = ptr_is_owned(obj);
48270         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48271         obj_conv.is_owned = false;
48272         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
48273         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48274         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48275         CVec_u8Z_free(ret_var);
48276         return ret_arr;
48277 }
48278
48279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48280         LDKu8slice ser_ref;
48281         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48282         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48283         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
48284         *ret_conv = TxAckRbf_read(ser_ref);
48285         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48286         return tag_ptr(ret_conv, true);
48287 }
48288
48289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
48290         LDKTxAbort obj_conv;
48291         obj_conv.inner = untag_ptr(obj);
48292         obj_conv.is_owned = ptr_is_owned(obj);
48293         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48294         obj_conv.is_owned = false;
48295         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
48296         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48297         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48298         CVec_u8Z_free(ret_var);
48299         return ret_arr;
48300 }
48301
48302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48303         LDKu8slice ser_ref;
48304         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48305         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48306         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
48307         *ret_conv = TxAbort_read(ser_ref);
48308         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48309         return tag_ptr(ret_conv, true);
48310 }
48311
48312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
48313         LDKAnnouncementSignatures obj_conv;
48314         obj_conv.inner = untag_ptr(obj);
48315         obj_conv.is_owned = ptr_is_owned(obj);
48316         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48317         obj_conv.is_owned = false;
48318         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
48319         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48320         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48321         CVec_u8Z_free(ret_var);
48322         return ret_arr;
48323 }
48324
48325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48326         LDKu8slice ser_ref;
48327         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48328         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48329         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
48330         *ret_conv = AnnouncementSignatures_read(ser_ref);
48331         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48332         return tag_ptr(ret_conv, true);
48333 }
48334
48335 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
48336         LDKChannelReestablish obj_conv;
48337         obj_conv.inner = untag_ptr(obj);
48338         obj_conv.is_owned = ptr_is_owned(obj);
48339         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48340         obj_conv.is_owned = false;
48341         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
48342         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48343         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48344         CVec_u8Z_free(ret_var);
48345         return ret_arr;
48346 }
48347
48348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48349         LDKu8slice ser_ref;
48350         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48351         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48352         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
48353         *ret_conv = ChannelReestablish_read(ser_ref);
48354         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48355         return tag_ptr(ret_conv, true);
48356 }
48357
48358 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
48359         LDKClosingSigned obj_conv;
48360         obj_conv.inner = untag_ptr(obj);
48361         obj_conv.is_owned = ptr_is_owned(obj);
48362         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48363         obj_conv.is_owned = false;
48364         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
48365         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48366         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48367         CVec_u8Z_free(ret_var);
48368         return ret_arr;
48369 }
48370
48371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48372         LDKu8slice ser_ref;
48373         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48374         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48375         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
48376         *ret_conv = ClosingSigned_read(ser_ref);
48377         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48378         return tag_ptr(ret_conv, true);
48379 }
48380
48381 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
48382         LDKClosingSignedFeeRange obj_conv;
48383         obj_conv.inner = untag_ptr(obj);
48384         obj_conv.is_owned = ptr_is_owned(obj);
48385         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48386         obj_conv.is_owned = false;
48387         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
48388         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48389         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48390         CVec_u8Z_free(ret_var);
48391         return ret_arr;
48392 }
48393
48394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48395         LDKu8slice ser_ref;
48396         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48397         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48398         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
48399         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
48400         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48401         return tag_ptr(ret_conv, true);
48402 }
48403
48404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
48405         LDKCommitmentSigned obj_conv;
48406         obj_conv.inner = untag_ptr(obj);
48407         obj_conv.is_owned = ptr_is_owned(obj);
48408         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48409         obj_conv.is_owned = false;
48410         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
48411         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48412         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48413         CVec_u8Z_free(ret_var);
48414         return ret_arr;
48415 }
48416
48417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48418         LDKu8slice ser_ref;
48419         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48420         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48421         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
48422         *ret_conv = CommitmentSigned_read(ser_ref);
48423         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48424         return tag_ptr(ret_conv, true);
48425 }
48426
48427 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
48428         LDKFundingCreated obj_conv;
48429         obj_conv.inner = untag_ptr(obj);
48430         obj_conv.is_owned = ptr_is_owned(obj);
48431         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48432         obj_conv.is_owned = false;
48433         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
48434         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48435         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48436         CVec_u8Z_free(ret_var);
48437         return ret_arr;
48438 }
48439
48440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48441         LDKu8slice ser_ref;
48442         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48443         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48444         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
48445         *ret_conv = FundingCreated_read(ser_ref);
48446         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48447         return tag_ptr(ret_conv, true);
48448 }
48449
48450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
48451         LDKFundingSigned obj_conv;
48452         obj_conv.inner = untag_ptr(obj);
48453         obj_conv.is_owned = ptr_is_owned(obj);
48454         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48455         obj_conv.is_owned = false;
48456         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
48457         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48458         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48459         CVec_u8Z_free(ret_var);
48460         return ret_arr;
48461 }
48462
48463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48464         LDKu8slice ser_ref;
48465         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48466         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48467         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
48468         *ret_conv = FundingSigned_read(ser_ref);
48469         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48470         return tag_ptr(ret_conv, true);
48471 }
48472
48473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
48474         LDKChannelReady obj_conv;
48475         obj_conv.inner = untag_ptr(obj);
48476         obj_conv.is_owned = ptr_is_owned(obj);
48477         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48478         obj_conv.is_owned = false;
48479         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
48480         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48481         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48482         CVec_u8Z_free(ret_var);
48483         return ret_arr;
48484 }
48485
48486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48487         LDKu8slice ser_ref;
48488         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48489         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48490         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
48491         *ret_conv = ChannelReady_read(ser_ref);
48492         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48493         return tag_ptr(ret_conv, true);
48494 }
48495
48496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
48497         LDKInit obj_conv;
48498         obj_conv.inner = untag_ptr(obj);
48499         obj_conv.is_owned = ptr_is_owned(obj);
48500         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48501         obj_conv.is_owned = false;
48502         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
48503         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48504         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48505         CVec_u8Z_free(ret_var);
48506         return ret_arr;
48507 }
48508
48509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48510         LDKu8slice ser_ref;
48511         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48512         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48513         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
48514         *ret_conv = Init_read(ser_ref);
48515         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48516         return tag_ptr(ret_conv, true);
48517 }
48518
48519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
48520         LDKOpenChannel obj_conv;
48521         obj_conv.inner = untag_ptr(obj);
48522         obj_conv.is_owned = ptr_is_owned(obj);
48523         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48524         obj_conv.is_owned = false;
48525         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
48526         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48527         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48528         CVec_u8Z_free(ret_var);
48529         return ret_arr;
48530 }
48531
48532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48533         LDKu8slice ser_ref;
48534         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48535         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48536         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
48537         *ret_conv = OpenChannel_read(ser_ref);
48538         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48539         return tag_ptr(ret_conv, true);
48540 }
48541
48542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
48543         LDKOpenChannelV2 obj_conv;
48544         obj_conv.inner = untag_ptr(obj);
48545         obj_conv.is_owned = ptr_is_owned(obj);
48546         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48547         obj_conv.is_owned = false;
48548         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
48549         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48550         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48551         CVec_u8Z_free(ret_var);
48552         return ret_arr;
48553 }
48554
48555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48556         LDKu8slice ser_ref;
48557         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48558         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48559         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
48560         *ret_conv = OpenChannelV2_read(ser_ref);
48561         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48562         return tag_ptr(ret_conv, true);
48563 }
48564
48565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
48566         LDKRevokeAndACK obj_conv;
48567         obj_conv.inner = untag_ptr(obj);
48568         obj_conv.is_owned = ptr_is_owned(obj);
48569         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48570         obj_conv.is_owned = false;
48571         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
48572         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48573         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48574         CVec_u8Z_free(ret_var);
48575         return ret_arr;
48576 }
48577
48578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48579         LDKu8slice ser_ref;
48580         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48581         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48582         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
48583         *ret_conv = RevokeAndACK_read(ser_ref);
48584         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48585         return tag_ptr(ret_conv, true);
48586 }
48587
48588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
48589         LDKShutdown obj_conv;
48590         obj_conv.inner = untag_ptr(obj);
48591         obj_conv.is_owned = ptr_is_owned(obj);
48592         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48593         obj_conv.is_owned = false;
48594         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
48595         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48596         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48597         CVec_u8Z_free(ret_var);
48598         return ret_arr;
48599 }
48600
48601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48602         LDKu8slice ser_ref;
48603         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48604         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48605         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
48606         *ret_conv = Shutdown_read(ser_ref);
48607         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48608         return tag_ptr(ret_conv, true);
48609 }
48610
48611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
48612         LDKUpdateFailHTLC obj_conv;
48613         obj_conv.inner = untag_ptr(obj);
48614         obj_conv.is_owned = ptr_is_owned(obj);
48615         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48616         obj_conv.is_owned = false;
48617         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
48618         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48619         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48620         CVec_u8Z_free(ret_var);
48621         return ret_arr;
48622 }
48623
48624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48625         LDKu8slice ser_ref;
48626         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48627         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48628         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
48629         *ret_conv = UpdateFailHTLC_read(ser_ref);
48630         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48631         return tag_ptr(ret_conv, true);
48632 }
48633
48634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
48635         LDKUpdateFailMalformedHTLC obj_conv;
48636         obj_conv.inner = untag_ptr(obj);
48637         obj_conv.is_owned = ptr_is_owned(obj);
48638         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48639         obj_conv.is_owned = false;
48640         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
48641         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48642         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48643         CVec_u8Z_free(ret_var);
48644         return ret_arr;
48645 }
48646
48647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48648         LDKu8slice ser_ref;
48649         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48650         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48651         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
48652         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
48653         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48654         return tag_ptr(ret_conv, true);
48655 }
48656
48657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
48658         LDKUpdateFee obj_conv;
48659         obj_conv.inner = untag_ptr(obj);
48660         obj_conv.is_owned = ptr_is_owned(obj);
48661         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48662         obj_conv.is_owned = false;
48663         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
48664         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48665         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48666         CVec_u8Z_free(ret_var);
48667         return ret_arr;
48668 }
48669
48670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48671         LDKu8slice ser_ref;
48672         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48673         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48674         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
48675         *ret_conv = UpdateFee_read(ser_ref);
48676         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48677         return tag_ptr(ret_conv, true);
48678 }
48679
48680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
48681         LDKUpdateFulfillHTLC obj_conv;
48682         obj_conv.inner = untag_ptr(obj);
48683         obj_conv.is_owned = ptr_is_owned(obj);
48684         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48685         obj_conv.is_owned = false;
48686         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
48687         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48688         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48689         CVec_u8Z_free(ret_var);
48690         return ret_arr;
48691 }
48692
48693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48694         LDKu8slice ser_ref;
48695         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48696         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48697         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
48698         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
48699         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48700         return tag_ptr(ret_conv, true);
48701 }
48702
48703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
48704         LDKUpdateAddHTLC obj_conv;
48705         obj_conv.inner = untag_ptr(obj);
48706         obj_conv.is_owned = ptr_is_owned(obj);
48707         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48708         obj_conv.is_owned = false;
48709         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
48710         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48711         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48712         CVec_u8Z_free(ret_var);
48713         return ret_arr;
48714 }
48715
48716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48717         LDKu8slice ser_ref;
48718         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48719         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48720         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
48721         *ret_conv = UpdateAddHTLC_read(ser_ref);
48722         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48723         return tag_ptr(ret_conv, true);
48724 }
48725
48726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48727         LDKu8slice ser_ref;
48728         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48729         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48730         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
48731         *ret_conv = OnionMessage_read(ser_ref);
48732         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48733         return tag_ptr(ret_conv, true);
48734 }
48735
48736 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
48737         LDKOnionMessage obj_conv;
48738         obj_conv.inner = untag_ptr(obj);
48739         obj_conv.is_owned = ptr_is_owned(obj);
48740         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48741         obj_conv.is_owned = false;
48742         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
48743         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48744         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48745         CVec_u8Z_free(ret_var);
48746         return ret_arr;
48747 }
48748
48749 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
48750         LDKPing obj_conv;
48751         obj_conv.inner = untag_ptr(obj);
48752         obj_conv.is_owned = ptr_is_owned(obj);
48753         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48754         obj_conv.is_owned = false;
48755         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
48756         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48757         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48758         CVec_u8Z_free(ret_var);
48759         return ret_arr;
48760 }
48761
48762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48763         LDKu8slice ser_ref;
48764         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48765         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48766         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
48767         *ret_conv = Ping_read(ser_ref);
48768         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48769         return tag_ptr(ret_conv, true);
48770 }
48771
48772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
48773         LDKPong obj_conv;
48774         obj_conv.inner = untag_ptr(obj);
48775         obj_conv.is_owned = ptr_is_owned(obj);
48776         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48777         obj_conv.is_owned = false;
48778         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
48779         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48780         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48781         CVec_u8Z_free(ret_var);
48782         return ret_arr;
48783 }
48784
48785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48786         LDKu8slice ser_ref;
48787         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48788         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48789         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
48790         *ret_conv = Pong_read(ser_ref);
48791         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48792         return tag_ptr(ret_conv, true);
48793 }
48794
48795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
48796         LDKUnsignedChannelAnnouncement obj_conv;
48797         obj_conv.inner = untag_ptr(obj);
48798         obj_conv.is_owned = ptr_is_owned(obj);
48799         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48800         obj_conv.is_owned = false;
48801         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
48802         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48803         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48804         CVec_u8Z_free(ret_var);
48805         return ret_arr;
48806 }
48807
48808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48809         LDKu8slice ser_ref;
48810         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48811         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48812         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
48813         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
48814         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48815         return tag_ptr(ret_conv, true);
48816 }
48817
48818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
48819         LDKChannelAnnouncement obj_conv;
48820         obj_conv.inner = untag_ptr(obj);
48821         obj_conv.is_owned = ptr_is_owned(obj);
48822         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48823         obj_conv.is_owned = false;
48824         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
48825         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48826         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48827         CVec_u8Z_free(ret_var);
48828         return ret_arr;
48829 }
48830
48831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48832         LDKu8slice ser_ref;
48833         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48834         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48835         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
48836         *ret_conv = ChannelAnnouncement_read(ser_ref);
48837         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48838         return tag_ptr(ret_conv, true);
48839 }
48840
48841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
48842         LDKUnsignedChannelUpdate obj_conv;
48843         obj_conv.inner = untag_ptr(obj);
48844         obj_conv.is_owned = ptr_is_owned(obj);
48845         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48846         obj_conv.is_owned = false;
48847         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
48848         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48849         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48850         CVec_u8Z_free(ret_var);
48851         return ret_arr;
48852 }
48853
48854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48855         LDKu8slice ser_ref;
48856         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48857         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48858         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
48859         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
48860         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48861         return tag_ptr(ret_conv, true);
48862 }
48863
48864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
48865         LDKChannelUpdate obj_conv;
48866         obj_conv.inner = untag_ptr(obj);
48867         obj_conv.is_owned = ptr_is_owned(obj);
48868         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48869         obj_conv.is_owned = false;
48870         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
48871         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48872         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48873         CVec_u8Z_free(ret_var);
48874         return ret_arr;
48875 }
48876
48877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48878         LDKu8slice ser_ref;
48879         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48880         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48881         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
48882         *ret_conv = ChannelUpdate_read(ser_ref);
48883         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48884         return tag_ptr(ret_conv, true);
48885 }
48886
48887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
48888         LDKErrorMessage obj_conv;
48889         obj_conv.inner = untag_ptr(obj);
48890         obj_conv.is_owned = ptr_is_owned(obj);
48891         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48892         obj_conv.is_owned = false;
48893         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
48894         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48895         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48896         CVec_u8Z_free(ret_var);
48897         return ret_arr;
48898 }
48899
48900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48901         LDKu8slice ser_ref;
48902         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48903         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48904         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
48905         *ret_conv = ErrorMessage_read(ser_ref);
48906         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48907         return tag_ptr(ret_conv, true);
48908 }
48909
48910 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
48911         LDKWarningMessage obj_conv;
48912         obj_conv.inner = untag_ptr(obj);
48913         obj_conv.is_owned = ptr_is_owned(obj);
48914         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48915         obj_conv.is_owned = false;
48916         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
48917         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48918         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48919         CVec_u8Z_free(ret_var);
48920         return ret_arr;
48921 }
48922
48923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48924         LDKu8slice ser_ref;
48925         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48926         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48927         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
48928         *ret_conv = WarningMessage_read(ser_ref);
48929         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48930         return tag_ptr(ret_conv, true);
48931 }
48932
48933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
48934         LDKUnsignedNodeAnnouncement obj_conv;
48935         obj_conv.inner = untag_ptr(obj);
48936         obj_conv.is_owned = ptr_is_owned(obj);
48937         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48938         obj_conv.is_owned = false;
48939         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
48940         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48941         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48942         CVec_u8Z_free(ret_var);
48943         return ret_arr;
48944 }
48945
48946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48947         LDKu8slice ser_ref;
48948         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48949         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48950         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
48951         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
48952         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48953         return tag_ptr(ret_conv, true);
48954 }
48955
48956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
48957         LDKNodeAnnouncement obj_conv;
48958         obj_conv.inner = untag_ptr(obj);
48959         obj_conv.is_owned = ptr_is_owned(obj);
48960         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48961         obj_conv.is_owned = false;
48962         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
48963         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48964         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48965         CVec_u8Z_free(ret_var);
48966         return ret_arr;
48967 }
48968
48969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48970         LDKu8slice ser_ref;
48971         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48972         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48973         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
48974         *ret_conv = NodeAnnouncement_read(ser_ref);
48975         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48976         return tag_ptr(ret_conv, true);
48977 }
48978
48979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48980         LDKu8slice ser_ref;
48981         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48982         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48983         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
48984         *ret_conv = QueryShortChannelIds_read(ser_ref);
48985         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48986         return tag_ptr(ret_conv, true);
48987 }
48988
48989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
48990         LDKQueryShortChannelIds obj_conv;
48991         obj_conv.inner = untag_ptr(obj);
48992         obj_conv.is_owned = ptr_is_owned(obj);
48993         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48994         obj_conv.is_owned = false;
48995         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
48996         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48997         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48998         CVec_u8Z_free(ret_var);
48999         return ret_arr;
49000 }
49001
49002 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
49003         LDKReplyShortChannelIdsEnd obj_conv;
49004         obj_conv.inner = untag_ptr(obj);
49005         obj_conv.is_owned = ptr_is_owned(obj);
49006         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49007         obj_conv.is_owned = false;
49008         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
49009         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49010         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49011         CVec_u8Z_free(ret_var);
49012         return ret_arr;
49013 }
49014
49015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49016         LDKu8slice ser_ref;
49017         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49018         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49019         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
49020         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
49021         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49022         return tag_ptr(ret_conv, true);
49023 }
49024
49025 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
49026         LDKQueryChannelRange this_arg_conv;
49027         this_arg_conv.inner = untag_ptr(this_arg);
49028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49030         this_arg_conv.is_owned = false;
49031         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
49032         return ret_conv;
49033 }
49034
49035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
49036         LDKQueryChannelRange obj_conv;
49037         obj_conv.inner = untag_ptr(obj);
49038         obj_conv.is_owned = ptr_is_owned(obj);
49039         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49040         obj_conv.is_owned = false;
49041         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
49042         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49043         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49044         CVec_u8Z_free(ret_var);
49045         return ret_arr;
49046 }
49047
49048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49049         LDKu8slice ser_ref;
49050         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49051         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49052         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
49053         *ret_conv = QueryChannelRange_read(ser_ref);
49054         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49055         return tag_ptr(ret_conv, true);
49056 }
49057
49058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49059         LDKu8slice ser_ref;
49060         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49061         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49062         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
49063         *ret_conv = ReplyChannelRange_read(ser_ref);
49064         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49065         return tag_ptr(ret_conv, true);
49066 }
49067
49068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
49069         LDKReplyChannelRange obj_conv;
49070         obj_conv.inner = untag_ptr(obj);
49071         obj_conv.is_owned = ptr_is_owned(obj);
49072         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49073         obj_conv.is_owned = false;
49074         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
49075         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49076         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49077         CVec_u8Z_free(ret_var);
49078         return ret_arr;
49079 }
49080
49081 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
49082         LDKGossipTimestampFilter obj_conv;
49083         obj_conv.inner = untag_ptr(obj);
49084         obj_conv.is_owned = ptr_is_owned(obj);
49085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49086         obj_conv.is_owned = false;
49087         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
49088         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49089         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49090         CVec_u8Z_free(ret_var);
49091         return ret_arr;
49092 }
49093
49094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49095         LDKu8slice ser_ref;
49096         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49097         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49098         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
49099         *ret_conv = GossipTimestampFilter_read(ser_ref);
49100         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49101         return tag_ptr(ret_conv, true);
49102 }
49103
49104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49105         if (!ptr_is_owned(this_ptr)) return;
49106         void* this_ptr_ptr = untag_ptr(this_ptr);
49107         CHECK_ACCESS(this_ptr_ptr);
49108         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
49109         FREE(untag_ptr(this_ptr));
49110         CustomMessageHandler_free(this_ptr_conv);
49111 }
49112
49113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49114         LDKIgnoringMessageHandler this_obj_conv;
49115         this_obj_conv.inner = untag_ptr(this_obj);
49116         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49118         IgnoringMessageHandler_free(this_obj_conv);
49119 }
49120
49121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
49122         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
49123         int64_t ret_ref = 0;
49124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49126         return ret_ref;
49127 }
49128
49129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
49130         LDKIgnoringMessageHandler this_arg_conv;
49131         this_arg_conv.inner = untag_ptr(this_arg);
49132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49134         this_arg_conv.is_owned = false;
49135         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
49136         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
49137         return tag_ptr(ret_ret, true);
49138 }
49139
49140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49141         LDKIgnoringMessageHandler this_arg_conv;
49142         this_arg_conv.inner = untag_ptr(this_arg);
49143         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49145         this_arg_conv.is_owned = false;
49146         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
49147         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
49148         return tag_ptr(ret_ret, true);
49149 }
49150
49151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
49152         LDKIgnoringMessageHandler this_arg_conv;
49153         this_arg_conv.inner = untag_ptr(this_arg);
49154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49156         this_arg_conv.is_owned = false;
49157         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
49158         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
49159         return tag_ptr(ret_ret, true);
49160 }
49161
49162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49163         LDKIgnoringMessageHandler this_arg_conv;
49164         this_arg_conv.inner = untag_ptr(this_arg);
49165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49167         this_arg_conv.is_owned = false;
49168         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
49169         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
49170         return tag_ptr(ret_ret, true);
49171 }
49172
49173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49174         LDKIgnoringMessageHandler this_arg_conv;
49175         this_arg_conv.inner = untag_ptr(this_arg);
49176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49178         this_arg_conv.is_owned = false;
49179         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
49180         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
49181         return tag_ptr(ret_ret, true);
49182 }
49183
49184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49185         LDKIgnoringMessageHandler this_arg_conv;
49186         this_arg_conv.inner = untag_ptr(this_arg);
49187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49189         this_arg_conv.is_owned = false;
49190         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
49191         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
49192         return tag_ptr(ret_ret, true);
49193 }
49194
49195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
49196         LDKIgnoringMessageHandler this_arg_conv;
49197         this_arg_conv.inner = untag_ptr(this_arg);
49198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49200         this_arg_conv.is_owned = false;
49201         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
49202         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
49203         return tag_ptr(ret_ret, true);
49204 }
49205
49206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49207         LDKIgnoringMessageHandler this_arg_conv;
49208         this_arg_conv.inner = untag_ptr(this_arg);
49209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49211         this_arg_conv.is_owned = false;
49212         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
49213         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
49214         return tag_ptr(ret_ret, true);
49215 }
49216
49217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49218         LDKErroringMessageHandler this_obj_conv;
49219         this_obj_conv.inner = untag_ptr(this_obj);
49220         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49222         ErroringMessageHandler_free(this_obj_conv);
49223 }
49224
49225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
49226         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
49227         int64_t ret_ref = 0;
49228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49230         return ret_ref;
49231 }
49232
49233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
49234         LDKErroringMessageHandler this_arg_conv;
49235         this_arg_conv.inner = untag_ptr(this_arg);
49236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49238         this_arg_conv.is_owned = false;
49239         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
49240         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
49241         return tag_ptr(ret_ret, true);
49242 }
49243
49244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49245         LDKErroringMessageHandler this_arg_conv;
49246         this_arg_conv.inner = untag_ptr(this_arg);
49247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49249         this_arg_conv.is_owned = false;
49250         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
49251         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
49252         return tag_ptr(ret_ret, true);
49253 }
49254
49255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49256         LDKMessageHandler this_obj_conv;
49257         this_obj_conv.inner = untag_ptr(this_obj);
49258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49260         MessageHandler_free(this_obj_conv);
49261 }
49262
49263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
49264         LDKMessageHandler this_ptr_conv;
49265         this_ptr_conv.inner = untag_ptr(this_ptr);
49266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49268         this_ptr_conv.is_owned = false;
49269         // WARNING: This object doesn't live past this scope, needs clone!
49270         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
49271         return ret_ret;
49272 }
49273
49274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49275         LDKMessageHandler this_ptr_conv;
49276         this_ptr_conv.inner = untag_ptr(this_ptr);
49277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49279         this_ptr_conv.is_owned = false;
49280         void* val_ptr = untag_ptr(val);
49281         CHECK_ACCESS(val_ptr);
49282         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
49283         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
49284                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49285                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
49286         }
49287         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
49288 }
49289
49290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
49291         LDKMessageHandler this_ptr_conv;
49292         this_ptr_conv.inner = untag_ptr(this_ptr);
49293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49295         this_ptr_conv.is_owned = false;
49296         // WARNING: This object doesn't live past this scope, needs clone!
49297         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
49298         return ret_ret;
49299 }
49300
49301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49302         LDKMessageHandler this_ptr_conv;
49303         this_ptr_conv.inner = untag_ptr(this_ptr);
49304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49306         this_ptr_conv.is_owned = false;
49307         void* val_ptr = untag_ptr(val);
49308         CHECK_ACCESS(val_ptr);
49309         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
49310         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
49311                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49312                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
49313         }
49314         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
49315 }
49316
49317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
49318         LDKMessageHandler this_ptr_conv;
49319         this_ptr_conv.inner = untag_ptr(this_ptr);
49320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49322         this_ptr_conv.is_owned = false;
49323         // WARNING: This object doesn't live past this scope, needs clone!
49324         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
49325         return ret_ret;
49326 }
49327
49328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49329         LDKMessageHandler this_ptr_conv;
49330         this_ptr_conv.inner = untag_ptr(this_ptr);
49331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49333         this_ptr_conv.is_owned = false;
49334         void* val_ptr = untag_ptr(val);
49335         CHECK_ACCESS(val_ptr);
49336         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
49337         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
49338                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49339                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
49340         }
49341         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
49342 }
49343
49344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
49345         LDKMessageHandler this_ptr_conv;
49346         this_ptr_conv.inner = untag_ptr(this_ptr);
49347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49349         this_ptr_conv.is_owned = false;
49350         // WARNING: This object doesn't live past this scope, needs clone!
49351         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
49352         return ret_ret;
49353 }
49354
49355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49356         LDKMessageHandler this_ptr_conv;
49357         this_ptr_conv.inner = untag_ptr(this_ptr);
49358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49360         this_ptr_conv.is_owned = false;
49361         void* val_ptr = untag_ptr(val);
49362         CHECK_ACCESS(val_ptr);
49363         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
49364         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
49365                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49366                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
49367         }
49368         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
49369 }
49370
49371 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, int64_t onion_message_handler_arg, int64_t custom_message_handler_arg) {
49372         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
49373         CHECK_ACCESS(chan_handler_arg_ptr);
49374         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
49375         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
49376                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49377                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
49378         }
49379         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
49380         CHECK_ACCESS(route_handler_arg_ptr);
49381         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
49382         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
49383                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49384                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
49385         }
49386         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
49387         CHECK_ACCESS(onion_message_handler_arg_ptr);
49388         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
49389         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
49390                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49391                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
49392         }
49393         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
49394         CHECK_ACCESS(custom_message_handler_arg_ptr);
49395         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
49396         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
49397                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49398                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
49399         }
49400         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
49401         int64_t ret_ref = 0;
49402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49404         return ret_ref;
49405 }
49406
49407 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
49408         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
49409         *ret_ret = SocketDescriptor_clone(arg);
49410         return tag_ptr(ret_ret, true);
49411 }
49412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49413         void* arg_ptr = untag_ptr(arg);
49414         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
49415         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
49416         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
49417         return ret_conv;
49418 }
49419
49420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49421         void* orig_ptr = untag_ptr(orig);
49422         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
49423         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
49424         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
49425         *ret_ret = SocketDescriptor_clone(orig_conv);
49426         return tag_ptr(ret_ret, true);
49427 }
49428
49429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49430         if (!ptr_is_owned(this_ptr)) return;
49431         void* this_ptr_ptr = untag_ptr(this_ptr);
49432         CHECK_ACCESS(this_ptr_ptr);
49433         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
49434         FREE(untag_ptr(this_ptr));
49435         SocketDescriptor_free(this_ptr_conv);
49436 }
49437
49438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49439         LDKPeerHandleError this_obj_conv;
49440         this_obj_conv.inner = untag_ptr(this_obj);
49441         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49443         PeerHandleError_free(this_obj_conv);
49444 }
49445
49446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
49447         LDKPeerHandleError ret_var = PeerHandleError_new();
49448         int64_t ret_ref = 0;
49449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49451         return ret_ref;
49452 }
49453
49454 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
49455         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
49456         int64_t ret_ref = 0;
49457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49459         return ret_ref;
49460 }
49461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49462         LDKPeerHandleError arg_conv;
49463         arg_conv.inner = untag_ptr(arg);
49464         arg_conv.is_owned = ptr_is_owned(arg);
49465         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49466         arg_conv.is_owned = false;
49467         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
49468         return ret_conv;
49469 }
49470
49471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49472         LDKPeerHandleError orig_conv;
49473         orig_conv.inner = untag_ptr(orig);
49474         orig_conv.is_owned = ptr_is_owned(orig);
49475         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49476         orig_conv.is_owned = false;
49477         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
49478         int64_t ret_ref = 0;
49479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49481         return ret_ref;
49482 }
49483
49484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49485         LDKPeerManager this_obj_conv;
49486         this_obj_conv.inner = untag_ptr(this_obj);
49487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49489         PeerManager_free(this_obj_conv);
49490 }
49491
49492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int32_t current_time, int8_tArray ephemeral_random_data, int64_t logger, int64_t node_signer) {
49493         LDKMessageHandler message_handler_conv;
49494         message_handler_conv.inner = untag_ptr(message_handler);
49495         message_handler_conv.is_owned = ptr_is_owned(message_handler);
49496         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
49497         // WARNING: we need a move here but no clone is available for LDKMessageHandler
49498         
49499         uint8_t ephemeral_random_data_arr[32];
49500         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
49501         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
49502         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
49503         void* logger_ptr = untag_ptr(logger);
49504         CHECK_ACCESS(logger_ptr);
49505         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49506         if (logger_conv.free == LDKLogger_JCalls_free) {
49507                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49508                 LDKLogger_JCalls_cloned(&logger_conv);
49509         }
49510         void* node_signer_ptr = untag_ptr(node_signer);
49511         CHECK_ACCESS(node_signer_ptr);
49512         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
49513         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
49514                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49515                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
49516         }
49517         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
49518         int64_t ret_ref = 0;
49519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49521         return ret_ref;
49522 }
49523
49524 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
49525         LDKPeerManager this_arg_conv;
49526         this_arg_conv.inner = untag_ptr(this_arg);
49527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49529         this_arg_conv.is_owned = false;
49530         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
49531         int64_tArray ret_arr = NULL;
49532         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49533         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49534         for (size_t o = 0; o < ret_var.datalen; o++) {
49535                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
49536                 *ret_conv_40_conv = ret_var.data[o];
49537                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
49538         }
49539         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49540         FREE(ret_var.data);
49541         return ret_arr;
49542 }
49543
49544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor, int64_t remote_network_address) {
49545         LDKPeerManager this_arg_conv;
49546         this_arg_conv.inner = untag_ptr(this_arg);
49547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49549         this_arg_conv.is_owned = false;
49550         LDKPublicKey their_node_id_ref;
49551         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
49552         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
49553         void* descriptor_ptr = untag_ptr(descriptor);
49554         CHECK_ACCESS(descriptor_ptr);
49555         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
49556         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
49557                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49558                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
49559         }
49560         void* remote_network_address_ptr = untag_ptr(remote_network_address);
49561         CHECK_ACCESS(remote_network_address_ptr);
49562         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
49563         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
49564         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
49565         return tag_ptr(ret_conv, true);
49566 }
49567
49568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor, int64_t remote_network_address) {
49569         LDKPeerManager this_arg_conv;
49570         this_arg_conv.inner = untag_ptr(this_arg);
49571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49573         this_arg_conv.is_owned = false;
49574         void* descriptor_ptr = untag_ptr(descriptor);
49575         CHECK_ACCESS(descriptor_ptr);
49576         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
49577         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
49578                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49579                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
49580         }
49581         void* remote_network_address_ptr = untag_ptr(remote_network_address);
49582         CHECK_ACCESS(remote_network_address_ptr);
49583         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
49584         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
49585         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
49586         return tag_ptr(ret_conv, true);
49587 }
49588
49589 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) {
49590         LDKPeerManager this_arg_conv;
49591         this_arg_conv.inner = untag_ptr(this_arg);
49592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49594         this_arg_conv.is_owned = false;
49595         void* descriptor_ptr = untag_ptr(descriptor);
49596         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
49597         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
49598         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
49599         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
49600         return tag_ptr(ret_conv, true);
49601 }
49602
49603 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) {
49604         LDKPeerManager this_arg_conv;
49605         this_arg_conv.inner = untag_ptr(this_arg);
49606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49608         this_arg_conv.is_owned = false;
49609         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
49610         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
49611         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
49612         LDKu8slice data_ref;
49613         data_ref.datalen = (*env)->GetArrayLength(env, data);
49614         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
49615         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
49616         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
49617         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
49618         return tag_ptr(ret_conv, true);
49619 }
49620
49621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
49622         LDKPeerManager this_arg_conv;
49623         this_arg_conv.inner = untag_ptr(this_arg);
49624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49626         this_arg_conv.is_owned = false;
49627         PeerManager_process_events(&this_arg_conv);
49628 }
49629
49630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
49631         LDKPeerManager this_arg_conv;
49632         this_arg_conv.inner = untag_ptr(this_arg);
49633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49635         this_arg_conv.is_owned = false;
49636         void* descriptor_ptr = untag_ptr(descriptor);
49637         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
49638         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
49639         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
49640 }
49641
49642 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) {
49643         LDKPeerManager this_arg_conv;
49644         this_arg_conv.inner = untag_ptr(this_arg);
49645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49647         this_arg_conv.is_owned = false;
49648         LDKPublicKey node_id_ref;
49649         CHECK((*env)->GetArrayLength(env, node_id) == 33);
49650         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
49651         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
49652 }
49653
49654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
49655         LDKPeerManager this_arg_conv;
49656         this_arg_conv.inner = untag_ptr(this_arg);
49657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49659         this_arg_conv.is_owned = false;
49660         PeerManager_disconnect_all_peers(&this_arg_conv);
49661 }
49662
49663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
49664         LDKPeerManager this_arg_conv;
49665         this_arg_conv.inner = untag_ptr(this_arg);
49666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49668         this_arg_conv.is_owned = false;
49669         PeerManager_timer_tick_occurred(&this_arg_conv);
49670 }
49671
49672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
49673         LDKPeerManager this_arg_conv;
49674         this_arg_conv.inner = untag_ptr(this_arg);
49675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49677         this_arg_conv.is_owned = false;
49678         LDKThreeBytes rgb_ref;
49679         CHECK((*env)->GetArrayLength(env, rgb) == 3);
49680         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
49681         LDKThirtyTwoBytes alias_ref;
49682         CHECK((*env)->GetArrayLength(env, alias) == 32);
49683         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
49684         LDKCVec_NetAddressZ addresses_constr;
49685         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
49686         if (addresses_constr.datalen > 0)
49687                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
49688         else
49689                 addresses_constr.data = NULL;
49690         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
49691         for (size_t m = 0; m < addresses_constr.datalen; m++) {
49692                 int64_t addresses_conv_12 = addresses_vals[m];
49693                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
49694                 CHECK_ACCESS(addresses_conv_12_ptr);
49695                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
49696                 addresses_constr.data[m] = addresses_conv_12_conv;
49697         }
49698         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
49699         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
49700 }
49701
49702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
49703         LDKChannelTypeFeatures channel_type_features_conv;
49704         channel_type_features_conv.inner = untag_ptr(channel_type_features);
49705         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
49706         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
49707         channel_type_features_conv.is_owned = false;
49708         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
49709         return ret_conv;
49710 }
49711
49712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
49713         LDKChannelTypeFeatures channel_type_features_conv;
49714         channel_type_features_conv.inner = untag_ptr(channel_type_features);
49715         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
49716         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
49717         channel_type_features_conv.is_owned = false;
49718         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
49719         return ret_conv;
49720 }
49721
49722 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49723         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
49724         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
49725         return ret_conv;
49726 }
49727
49728 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
49729         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
49730         return ret_conv;
49731 }
49732
49733 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
49734         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
49735         return ret_conv;
49736 }
49737
49738 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
49739         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
49740         return ret_conv;
49741 }
49742
49743 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
49744         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
49745         return ret_conv;
49746 }
49747
49748 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
49749         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
49750         return ret_conv;
49751 }
49752
49753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49754         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
49755         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
49756         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
49757         return ret_conv;
49758 }
49759
49760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
49761         LDKWitness witness_ref;
49762         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
49763         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
49764         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
49765         witness_ref.data_is_owned = true;
49766         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
49767         *ret_copy = HTLCClaim_from_witness(witness_ref);
49768         int64_t ret_ref = tag_ptr(ret_copy, true);
49769         return ret_ref;
49770 }
49771
49772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
49773         uint8_t commitment_seed_arr[32];
49774         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
49775         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
49776         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
49777         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49778         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
49779         return ret_arr;
49780 }
49781
49782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
49783         LDKCVec_u8Z to_holder_script_ref;
49784         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
49785         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
49786         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
49787         LDKCVec_u8Z to_counterparty_script_ref;
49788         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
49789         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
49790         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
49791         LDKOutPoint funding_outpoint_conv;
49792         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
49793         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
49794         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
49795         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
49796         LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
49797         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49798         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49799         Transaction_free(ret_var);
49800         return ret_arr;
49801 }
49802
49803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49804         LDKCounterpartyCommitmentSecrets this_obj_conv;
49805         this_obj_conv.inner = untag_ptr(this_obj);
49806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49808         CounterpartyCommitmentSecrets_free(this_obj_conv);
49809 }
49810
49811 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
49812         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
49813         int64_t ret_ref = 0;
49814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49816         return ret_ref;
49817 }
49818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49819         LDKCounterpartyCommitmentSecrets arg_conv;
49820         arg_conv.inner = untag_ptr(arg);
49821         arg_conv.is_owned = ptr_is_owned(arg);
49822         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49823         arg_conv.is_owned = false;
49824         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
49825         return ret_conv;
49826 }
49827
49828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49829         LDKCounterpartyCommitmentSecrets orig_conv;
49830         orig_conv.inner = untag_ptr(orig);
49831         orig_conv.is_owned = ptr_is_owned(orig);
49832         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49833         orig_conv.is_owned = false;
49834         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
49835         int64_t ret_ref = 0;
49836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49838         return ret_ref;
49839 }
49840
49841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
49842         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
49843         int64_t ret_ref = 0;
49844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49846         return ret_ref;
49847 }
49848
49849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
49850         LDKCounterpartyCommitmentSecrets this_arg_conv;
49851         this_arg_conv.inner = untag_ptr(this_arg);
49852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49854         this_arg_conv.is_owned = false;
49855         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
49856         return ret_conv;
49857 }
49858
49859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1provide_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
49860         LDKCounterpartyCommitmentSecrets this_arg_conv;
49861         this_arg_conv.inner = untag_ptr(this_arg);
49862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49864         this_arg_conv.is_owned = false;
49865         LDKThirtyTwoBytes secret_ref;
49866         CHECK((*env)->GetArrayLength(env, secret) == 32);
49867         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
49868         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49869         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
49870         return tag_ptr(ret_conv, true);
49871 }
49872
49873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
49874         LDKCounterpartyCommitmentSecrets this_arg_conv;
49875         this_arg_conv.inner = untag_ptr(this_arg);
49876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49878         this_arg_conv.is_owned = false;
49879         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49880         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
49881         return ret_arr;
49882 }
49883
49884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
49885         LDKCounterpartyCommitmentSecrets obj_conv;
49886         obj_conv.inner = untag_ptr(obj);
49887         obj_conv.is_owned = ptr_is_owned(obj);
49888         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49889         obj_conv.is_owned = false;
49890         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
49891         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49892         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49893         CVec_u8Z_free(ret_var);
49894         return ret_arr;
49895 }
49896
49897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49898         LDKu8slice ser_ref;
49899         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49900         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49901         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
49902         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
49903         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49904         return tag_ptr(ret_conv, true);
49905 }
49906
49907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
49908         LDKPublicKey per_commitment_point_ref;
49909         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49910         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49911         uint8_t base_secret_arr[32];
49912         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
49913         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
49914         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
49915         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49916         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
49917         return ret_arr;
49918 }
49919
49920 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_point) {
49921         LDKPublicKey per_commitment_point_ref;
49922         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49923         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49924         LDKPublicKey base_point_ref;
49925         CHECK((*env)->GetArrayLength(env, base_point) == 33);
49926         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
49927         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49928         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form);
49929         return ret_arr;
49930 }
49931
49932 JNIEXPORT int8_tArray 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) {
49933         uint8_t per_commitment_secret_arr[32];
49934         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
49935         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
49936         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
49937         uint8_t countersignatory_revocation_base_secret_arr[32];
49938         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
49939         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
49940         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
49941         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49942         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
49943         return ret_arr;
49944 }
49945
49946 JNIEXPORT int8_tArray 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) {
49947         LDKPublicKey per_commitment_point_ref;
49948         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49949         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49950         LDKPublicKey countersignatory_revocation_base_point_ref;
49951         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
49952         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
49953         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49954         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form);
49955         return ret_arr;
49956 }
49957
49958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49959         LDKTxCreationKeys this_obj_conv;
49960         this_obj_conv.inner = untag_ptr(this_obj);
49961         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49963         TxCreationKeys_free(this_obj_conv);
49964 }
49965
49966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
49967         LDKTxCreationKeys this_ptr_conv;
49968         this_ptr_conv.inner = untag_ptr(this_ptr);
49969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49971         this_ptr_conv.is_owned = false;
49972         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49973         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
49974         return ret_arr;
49975 }
49976
49977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49978         LDKTxCreationKeys this_ptr_conv;
49979         this_ptr_conv.inner = untag_ptr(this_ptr);
49980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49982         this_ptr_conv.is_owned = false;
49983         LDKPublicKey val_ref;
49984         CHECK((*env)->GetArrayLength(env, val) == 33);
49985         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49986         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
49987 }
49988
49989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
49990         LDKTxCreationKeys this_ptr_conv;
49991         this_ptr_conv.inner = untag_ptr(this_ptr);
49992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49994         this_ptr_conv.is_owned = false;
49995         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49996         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
49997         return ret_arr;
49998 }
49999
50000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50001         LDKTxCreationKeys this_ptr_conv;
50002         this_ptr_conv.inner = untag_ptr(this_ptr);
50003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50005         this_ptr_conv.is_owned = false;
50006         LDKPublicKey val_ref;
50007         CHECK((*env)->GetArrayLength(env, val) == 33);
50008         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50009         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
50010 }
50011
50012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
50013         LDKTxCreationKeys this_ptr_conv;
50014         this_ptr_conv.inner = untag_ptr(this_ptr);
50015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50017         this_ptr_conv.is_owned = false;
50018         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50019         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
50020         return ret_arr;
50021 }
50022
50023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50024         LDKTxCreationKeys this_ptr_conv;
50025         this_ptr_conv.inner = untag_ptr(this_ptr);
50026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50028         this_ptr_conv.is_owned = false;
50029         LDKPublicKey val_ref;
50030         CHECK((*env)->GetArrayLength(env, val) == 33);
50031         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50032         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
50033 }
50034
50035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
50036         LDKTxCreationKeys this_ptr_conv;
50037         this_ptr_conv.inner = untag_ptr(this_ptr);
50038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50040         this_ptr_conv.is_owned = false;
50041         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50042         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
50043         return ret_arr;
50044 }
50045
50046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50047         LDKTxCreationKeys this_ptr_conv;
50048         this_ptr_conv.inner = untag_ptr(this_ptr);
50049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50051         this_ptr_conv.is_owned = false;
50052         LDKPublicKey val_ref;
50053         CHECK((*env)->GetArrayLength(env, val) == 33);
50054         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50055         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
50056 }
50057
50058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
50059         LDKTxCreationKeys this_ptr_conv;
50060         this_ptr_conv.inner = untag_ptr(this_ptr);
50061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50063         this_ptr_conv.is_owned = false;
50064         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50065         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
50066         return ret_arr;
50067 }
50068
50069 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) {
50070         LDKTxCreationKeys this_ptr_conv;
50071         this_ptr_conv.inner = untag_ptr(this_ptr);
50072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50074         this_ptr_conv.is_owned = false;
50075         LDKPublicKey val_ref;
50076         CHECK((*env)->GetArrayLength(env, val) == 33);
50077         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50078         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
50079 }
50080
50081 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) {
50082         LDKPublicKey per_commitment_point_arg_ref;
50083         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
50084         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
50085         LDKPublicKey revocation_key_arg_ref;
50086         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
50087         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
50088         LDKPublicKey broadcaster_htlc_key_arg_ref;
50089         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
50090         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
50091         LDKPublicKey countersignatory_htlc_key_arg_ref;
50092         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
50093         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
50094         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
50095         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
50096         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
50097         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);
50098         int64_t ret_ref = 0;
50099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50101         return ret_ref;
50102 }
50103
50104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50105         LDKTxCreationKeys a_conv;
50106         a_conv.inner = untag_ptr(a);
50107         a_conv.is_owned = ptr_is_owned(a);
50108         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50109         a_conv.is_owned = false;
50110         LDKTxCreationKeys b_conv;
50111         b_conv.inner = untag_ptr(b);
50112         b_conv.is_owned = ptr_is_owned(b);
50113         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50114         b_conv.is_owned = false;
50115         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
50116         return ret_conv;
50117 }
50118
50119 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
50120         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
50121         int64_t ret_ref = 0;
50122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50124         return ret_ref;
50125 }
50126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50127         LDKTxCreationKeys arg_conv;
50128         arg_conv.inner = untag_ptr(arg);
50129         arg_conv.is_owned = ptr_is_owned(arg);
50130         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50131         arg_conv.is_owned = false;
50132         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
50133         return ret_conv;
50134 }
50135
50136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50137         LDKTxCreationKeys orig_conv;
50138         orig_conv.inner = untag_ptr(orig);
50139         orig_conv.is_owned = ptr_is_owned(orig);
50140         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50141         orig_conv.is_owned = false;
50142         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
50143         int64_t ret_ref = 0;
50144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50146         return ret_ref;
50147 }
50148
50149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
50150         LDKTxCreationKeys obj_conv;
50151         obj_conv.inner = untag_ptr(obj);
50152         obj_conv.is_owned = ptr_is_owned(obj);
50153         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50154         obj_conv.is_owned = false;
50155         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
50156         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50157         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50158         CVec_u8Z_free(ret_var);
50159         return ret_arr;
50160 }
50161
50162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50163         LDKu8slice ser_ref;
50164         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50165         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50166         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
50167         *ret_conv = TxCreationKeys_read(ser_ref);
50168         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50169         return tag_ptr(ret_conv, true);
50170 }
50171
50172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50173         LDKChannelPublicKeys this_obj_conv;
50174         this_obj_conv.inner = untag_ptr(this_obj);
50175         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50177         ChannelPublicKeys_free(this_obj_conv);
50178 }
50179
50180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
50181         LDKChannelPublicKeys this_ptr_conv;
50182         this_ptr_conv.inner = untag_ptr(this_ptr);
50183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50185         this_ptr_conv.is_owned = false;
50186         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50187         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
50188         return ret_arr;
50189 }
50190
50191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50192         LDKChannelPublicKeys this_ptr_conv;
50193         this_ptr_conv.inner = untag_ptr(this_ptr);
50194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50196         this_ptr_conv.is_owned = false;
50197         LDKPublicKey val_ref;
50198         CHECK((*env)->GetArrayLength(env, val) == 33);
50199         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50200         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
50201 }
50202
50203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
50204         LDKChannelPublicKeys this_ptr_conv;
50205         this_ptr_conv.inner = untag_ptr(this_ptr);
50206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50208         this_ptr_conv.is_owned = false;
50209         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50210         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
50211         return ret_arr;
50212 }
50213
50214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50215         LDKChannelPublicKeys this_ptr_conv;
50216         this_ptr_conv.inner = untag_ptr(this_ptr);
50217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50219         this_ptr_conv.is_owned = false;
50220         LDKPublicKey val_ref;
50221         CHECK((*env)->GetArrayLength(env, val) == 33);
50222         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50223         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
50224 }
50225
50226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
50227         LDKChannelPublicKeys this_ptr_conv;
50228         this_ptr_conv.inner = untag_ptr(this_ptr);
50229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50231         this_ptr_conv.is_owned = false;
50232         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50233         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
50234         return ret_arr;
50235 }
50236
50237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50238         LDKChannelPublicKeys this_ptr_conv;
50239         this_ptr_conv.inner = untag_ptr(this_ptr);
50240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50242         this_ptr_conv.is_owned = false;
50243         LDKPublicKey val_ref;
50244         CHECK((*env)->GetArrayLength(env, val) == 33);
50245         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50246         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
50247 }
50248
50249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
50250         LDKChannelPublicKeys this_ptr_conv;
50251         this_ptr_conv.inner = untag_ptr(this_ptr);
50252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50254         this_ptr_conv.is_owned = false;
50255         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50256         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
50257         return ret_arr;
50258 }
50259
50260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50261         LDKChannelPublicKeys this_ptr_conv;
50262         this_ptr_conv.inner = untag_ptr(this_ptr);
50263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50265         this_ptr_conv.is_owned = false;
50266         LDKPublicKey val_ref;
50267         CHECK((*env)->GetArrayLength(env, val) == 33);
50268         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50269         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
50270 }
50271
50272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
50273         LDKChannelPublicKeys this_ptr_conv;
50274         this_ptr_conv.inner = untag_ptr(this_ptr);
50275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50277         this_ptr_conv.is_owned = false;
50278         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50279         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
50280         return ret_arr;
50281 }
50282
50283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50284         LDKChannelPublicKeys this_ptr_conv;
50285         this_ptr_conv.inner = untag_ptr(this_ptr);
50286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50288         this_ptr_conv.is_owned = false;
50289         LDKPublicKey val_ref;
50290         CHECK((*env)->GetArrayLength(env, val) == 33);
50291         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50292         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
50293 }
50294
50295 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) {
50296         LDKPublicKey funding_pubkey_arg_ref;
50297         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
50298         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
50299         LDKPublicKey revocation_basepoint_arg_ref;
50300         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
50301         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
50302         LDKPublicKey payment_point_arg_ref;
50303         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
50304         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
50305         LDKPublicKey delayed_payment_basepoint_arg_ref;
50306         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
50307         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
50308         LDKPublicKey htlc_basepoint_arg_ref;
50309         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
50310         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
50311         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);
50312         int64_t ret_ref = 0;
50313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50315         return ret_ref;
50316 }
50317
50318 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
50319         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
50320         int64_t ret_ref = 0;
50321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50323         return ret_ref;
50324 }
50325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50326         LDKChannelPublicKeys arg_conv;
50327         arg_conv.inner = untag_ptr(arg);
50328         arg_conv.is_owned = ptr_is_owned(arg);
50329         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50330         arg_conv.is_owned = false;
50331         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
50332         return ret_conv;
50333 }
50334
50335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50336         LDKChannelPublicKeys orig_conv;
50337         orig_conv.inner = untag_ptr(orig);
50338         orig_conv.is_owned = ptr_is_owned(orig);
50339         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50340         orig_conv.is_owned = false;
50341         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
50342         int64_t ret_ref = 0;
50343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50345         return ret_ref;
50346 }
50347
50348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50349         LDKChannelPublicKeys a_conv;
50350         a_conv.inner = untag_ptr(a);
50351         a_conv.is_owned = ptr_is_owned(a);
50352         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50353         a_conv.is_owned = false;
50354         LDKChannelPublicKeys b_conv;
50355         b_conv.inner = untag_ptr(b);
50356         b_conv.is_owned = ptr_is_owned(b);
50357         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50358         b_conv.is_owned = false;
50359         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
50360         return ret_conv;
50361 }
50362
50363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
50364         LDKChannelPublicKeys obj_conv;
50365         obj_conv.inner = untag_ptr(obj);
50366         obj_conv.is_owned = ptr_is_owned(obj);
50367         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50368         obj_conv.is_owned = false;
50369         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
50370         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50371         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50372         CVec_u8Z_free(ret_var);
50373         return ret_arr;
50374 }
50375
50376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50377         LDKu8slice ser_ref;
50378         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50379         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50380         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
50381         *ret_conv = ChannelPublicKeys_read(ser_ref);
50382         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50383         return tag_ptr(ret_conv, true);
50384 }
50385
50386 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) {
50387         LDKPublicKey per_commitment_point_ref;
50388         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
50389         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
50390         LDKPublicKey broadcaster_delayed_payment_base_ref;
50391         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
50392         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
50393         LDKPublicKey broadcaster_htlc_base_ref;
50394         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
50395         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
50396         LDKPublicKey countersignatory_revocation_base_ref;
50397         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
50398         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
50399         LDKPublicKey countersignatory_htlc_base_ref;
50400         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
50401         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
50402         LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
50403         int64_t ret_ref = 0;
50404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50406         return ret_ref;
50407 }
50408
50409 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) {
50410         LDKPublicKey per_commitment_point_ref;
50411         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
50412         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
50413         LDKChannelPublicKeys broadcaster_keys_conv;
50414         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
50415         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
50416         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
50417         broadcaster_keys_conv.is_owned = false;
50418         LDKChannelPublicKeys countersignatory_keys_conv;
50419         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
50420         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
50421         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
50422         countersignatory_keys_conv.is_owned = false;
50423         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
50424         int64_t ret_ref = 0;
50425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50427         return ret_ref;
50428 }
50429
50430 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) {
50431         LDKPublicKey revocation_key_ref;
50432         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
50433         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
50434         LDKPublicKey broadcaster_delayed_payment_key_ref;
50435         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
50436         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
50437         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
50438         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50439         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50440         CVec_u8Z_free(ret_var);
50441         return ret_arr;
50442 }
50443
50444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50445         LDKHTLCOutputInCommitment this_obj_conv;
50446         this_obj_conv.inner = untag_ptr(this_obj);
50447         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50449         HTLCOutputInCommitment_free(this_obj_conv);
50450 }
50451
50452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
50453         LDKHTLCOutputInCommitment this_ptr_conv;
50454         this_ptr_conv.inner = untag_ptr(this_ptr);
50455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50457         this_ptr_conv.is_owned = false;
50458         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
50459         return ret_conv;
50460 }
50461
50462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
50463         LDKHTLCOutputInCommitment this_ptr_conv;
50464         this_ptr_conv.inner = untag_ptr(this_ptr);
50465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50467         this_ptr_conv.is_owned = false;
50468         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
50469 }
50470
50471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
50472         LDKHTLCOutputInCommitment this_ptr_conv;
50473         this_ptr_conv.inner = untag_ptr(this_ptr);
50474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50476         this_ptr_conv.is_owned = false;
50477         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
50478         return ret_conv;
50479 }
50480
50481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50482         LDKHTLCOutputInCommitment this_ptr_conv;
50483         this_ptr_conv.inner = untag_ptr(this_ptr);
50484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50486         this_ptr_conv.is_owned = false;
50487         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
50488 }
50489
50490 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
50491         LDKHTLCOutputInCommitment this_ptr_conv;
50492         this_ptr_conv.inner = untag_ptr(this_ptr);
50493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50495         this_ptr_conv.is_owned = false;
50496         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
50497         return ret_conv;
50498 }
50499
50500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50501         LDKHTLCOutputInCommitment this_ptr_conv;
50502         this_ptr_conv.inner = untag_ptr(this_ptr);
50503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50505         this_ptr_conv.is_owned = false;
50506         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
50507 }
50508
50509 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50510         LDKHTLCOutputInCommitment this_ptr_conv;
50511         this_ptr_conv.inner = untag_ptr(this_ptr);
50512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50514         this_ptr_conv.is_owned = false;
50515         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50516         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
50517         return ret_arr;
50518 }
50519
50520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50521         LDKHTLCOutputInCommitment this_ptr_conv;
50522         this_ptr_conv.inner = untag_ptr(this_ptr);
50523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50525         this_ptr_conv.is_owned = false;
50526         LDKThirtyTwoBytes val_ref;
50527         CHECK((*env)->GetArrayLength(env, val) == 32);
50528         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50529         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
50530 }
50531
50532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
50533         LDKHTLCOutputInCommitment this_ptr_conv;
50534         this_ptr_conv.inner = untag_ptr(this_ptr);
50535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50537         this_ptr_conv.is_owned = false;
50538         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
50539         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
50540         int64_t ret_ref = tag_ptr(ret_copy, true);
50541         return ret_ref;
50542 }
50543
50544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50545         LDKHTLCOutputInCommitment this_ptr_conv;
50546         this_ptr_conv.inner = untag_ptr(this_ptr);
50547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50549         this_ptr_conv.is_owned = false;
50550         void* val_ptr = untag_ptr(val);
50551         CHECK_ACCESS(val_ptr);
50552         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
50553         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
50554         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
50555 }
50556
50557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1new(JNIEnv *env, jclass clz, jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t transaction_output_index_arg) {
50558         LDKThirtyTwoBytes payment_hash_arg_ref;
50559         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
50560         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
50561         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
50562         CHECK_ACCESS(transaction_output_index_arg_ptr);
50563         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
50564         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
50565         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
50566         int64_t ret_ref = 0;
50567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50569         return ret_ref;
50570 }
50571
50572 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
50573         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
50574         int64_t ret_ref = 0;
50575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50577         return ret_ref;
50578 }
50579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50580         LDKHTLCOutputInCommitment arg_conv;
50581         arg_conv.inner = untag_ptr(arg);
50582         arg_conv.is_owned = ptr_is_owned(arg);
50583         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50584         arg_conv.is_owned = false;
50585         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
50586         return ret_conv;
50587 }
50588
50589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50590         LDKHTLCOutputInCommitment orig_conv;
50591         orig_conv.inner = untag_ptr(orig);
50592         orig_conv.is_owned = ptr_is_owned(orig);
50593         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50594         orig_conv.is_owned = false;
50595         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
50596         int64_t ret_ref = 0;
50597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50599         return ret_ref;
50600 }
50601
50602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50603         LDKHTLCOutputInCommitment a_conv;
50604         a_conv.inner = untag_ptr(a);
50605         a_conv.is_owned = ptr_is_owned(a);
50606         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50607         a_conv.is_owned = false;
50608         LDKHTLCOutputInCommitment b_conv;
50609         b_conv.inner = untag_ptr(b);
50610         b_conv.is_owned = ptr_is_owned(b);
50611         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50612         b_conv.is_owned = false;
50613         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
50614         return ret_conv;
50615 }
50616
50617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
50618         LDKHTLCOutputInCommitment obj_conv;
50619         obj_conv.inner = untag_ptr(obj);
50620         obj_conv.is_owned = ptr_is_owned(obj);
50621         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50622         obj_conv.is_owned = false;
50623         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
50624         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50625         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50626         CVec_u8Z_free(ret_var);
50627         return ret_arr;
50628 }
50629
50630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50631         LDKu8slice ser_ref;
50632         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50633         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50634         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
50635         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
50636         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50637         return tag_ptr(ret_conv, true);
50638 }
50639
50640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t channel_type_features, int64_t keys) {
50641         LDKHTLCOutputInCommitment htlc_conv;
50642         htlc_conv.inner = untag_ptr(htlc);
50643         htlc_conv.is_owned = ptr_is_owned(htlc);
50644         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
50645         htlc_conv.is_owned = false;
50646         LDKChannelTypeFeatures channel_type_features_conv;
50647         channel_type_features_conv.inner = untag_ptr(channel_type_features);
50648         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
50649         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
50650         channel_type_features_conv.is_owned = false;
50651         LDKTxCreationKeys keys_conv;
50652         keys_conv.inner = untag_ptr(keys);
50653         keys_conv.is_owned = ptr_is_owned(keys);
50654         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
50655         keys_conv.is_owned = false;
50656         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
50657         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50658         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50659         CVec_u8Z_free(ret_var);
50660         return ret_arr;
50661 }
50662
50663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
50664         LDKPublicKey broadcaster_ref;
50665         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
50666         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
50667         LDKPublicKey countersignatory_ref;
50668         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
50669         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
50670         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
50671         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50672         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50673         CVec_u8Z_free(ret_var);
50674         return ret_arr;
50675 }
50676
50677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int64_t channel_type_features, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
50678         uint8_t commitment_txid_arr[32];
50679         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
50680         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
50681         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
50682         LDKHTLCOutputInCommitment htlc_conv;
50683         htlc_conv.inner = untag_ptr(htlc);
50684         htlc_conv.is_owned = ptr_is_owned(htlc);
50685         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
50686         htlc_conv.is_owned = false;
50687         LDKChannelTypeFeatures channel_type_features_conv;
50688         channel_type_features_conv.inner = untag_ptr(channel_type_features);
50689         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
50690         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
50691         channel_type_features_conv.is_owned = false;
50692         LDKPublicKey broadcaster_delayed_payment_key_ref;
50693         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
50694         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
50695         LDKPublicKey revocation_key_ref;
50696         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
50697         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
50698         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, &channel_type_features_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
50699         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50700         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50701         Transaction_free(ret_var);
50702         return ret_arr;
50703 }
50704
50705 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1input_1witness(JNIEnv *env, jclass clz, int8_tArray local_sig, int8_tArray remote_sig, int64_t preimage, int8_tArray redeem_script, int64_t channel_type_features) {
50706         LDKSignature local_sig_ref;
50707         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
50708         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
50709         LDKSignature remote_sig_ref;
50710         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
50711         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
50712         void* preimage_ptr = untag_ptr(preimage);
50713         CHECK_ACCESS(preimage_ptr);
50714         LDKCOption_PaymentPreimageZ preimage_conv = *(LDKCOption_PaymentPreimageZ*)(preimage_ptr);
50715         preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(preimage));
50716         LDKu8slice redeem_script_ref;
50717         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
50718         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
50719         LDKChannelTypeFeatures channel_type_features_conv;
50720         channel_type_features_conv.inner = untag_ptr(channel_type_features);
50721         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
50722         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
50723         channel_type_features_conv.is_owned = false;
50724         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
50725         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50726         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50727         Witness_free(ret_var);
50728         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
50729         return ret_arr;
50730 }
50731
50732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
50733         LDKPublicKey payment_point_ref;
50734         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
50735         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
50736         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
50737         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50738         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50739         CVec_u8Z_free(ret_var);
50740         return ret_arr;
50741 }
50742
50743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
50744         LDKPublicKey funding_pubkey_ref;
50745         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
50746         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
50747         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
50748         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50749         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50750         CVec_u8Z_free(ret_var);
50751         return ret_arr;
50752 }
50753
50754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1anchor_1input_1witness(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray funding_sig) {
50755         LDKPublicKey funding_key_ref;
50756         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
50757         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
50758         LDKSignature funding_sig_ref;
50759         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
50760         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
50761         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
50762         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50763         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50764         Witness_free(ret_var);
50765         return ret_arr;
50766 }
50767
50768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50769         LDKChannelTransactionParameters this_obj_conv;
50770         this_obj_conv.inner = untag_ptr(this_obj);
50771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50773         ChannelTransactionParameters_free(this_obj_conv);
50774 }
50775
50776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
50777         LDKChannelTransactionParameters this_ptr_conv;
50778         this_ptr_conv.inner = untag_ptr(this_ptr);
50779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50781         this_ptr_conv.is_owned = false;
50782         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
50783         int64_t ret_ref = 0;
50784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50786         return ret_ref;
50787 }
50788
50789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50790         LDKChannelTransactionParameters this_ptr_conv;
50791         this_ptr_conv.inner = untag_ptr(this_ptr);
50792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50794         this_ptr_conv.is_owned = false;
50795         LDKChannelPublicKeys val_conv;
50796         val_conv.inner = untag_ptr(val);
50797         val_conv.is_owned = ptr_is_owned(val);
50798         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50799         val_conv = ChannelPublicKeys_clone(&val_conv);
50800         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
50801 }
50802
50803 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
50804         LDKChannelTransactionParameters this_ptr_conv;
50805         this_ptr_conv.inner = untag_ptr(this_ptr);
50806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50808         this_ptr_conv.is_owned = false;
50809         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
50810         return ret_conv;
50811 }
50812
50813 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) {
50814         LDKChannelTransactionParameters this_ptr_conv;
50815         this_ptr_conv.inner = untag_ptr(this_ptr);
50816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50818         this_ptr_conv.is_owned = false;
50819         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
50820 }
50821
50822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
50823         LDKChannelTransactionParameters this_ptr_conv;
50824         this_ptr_conv.inner = untag_ptr(this_ptr);
50825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50827         this_ptr_conv.is_owned = false;
50828         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
50829         return ret_conv;
50830 }
50831
50832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
50833         LDKChannelTransactionParameters this_ptr_conv;
50834         this_ptr_conv.inner = untag_ptr(this_ptr);
50835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50837         this_ptr_conv.is_owned = false;
50838         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
50839 }
50840
50841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
50842         LDKChannelTransactionParameters this_ptr_conv;
50843         this_ptr_conv.inner = untag_ptr(this_ptr);
50844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50846         this_ptr_conv.is_owned = false;
50847         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
50848         int64_t ret_ref = 0;
50849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50851         return ret_ref;
50852 }
50853
50854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50855         LDKChannelTransactionParameters this_ptr_conv;
50856         this_ptr_conv.inner = untag_ptr(this_ptr);
50857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50859         this_ptr_conv.is_owned = false;
50860         LDKCounterpartyChannelTransactionParameters val_conv;
50861         val_conv.inner = untag_ptr(val);
50862         val_conv.is_owned = ptr_is_owned(val);
50863         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50864         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
50865         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
50866 }
50867
50868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
50869         LDKChannelTransactionParameters this_ptr_conv;
50870         this_ptr_conv.inner = untag_ptr(this_ptr);
50871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50873         this_ptr_conv.is_owned = false;
50874         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
50875         int64_t ret_ref = 0;
50876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50878         return ret_ref;
50879 }
50880
50881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50882         LDKChannelTransactionParameters this_ptr_conv;
50883         this_ptr_conv.inner = untag_ptr(this_ptr);
50884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50886         this_ptr_conv.is_owned = false;
50887         LDKOutPoint val_conv;
50888         val_conv.inner = untag_ptr(val);
50889         val_conv.is_owned = ptr_is_owned(val);
50890         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50891         val_conv = OutPoint_clone(&val_conv);
50892         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
50893 }
50894
50895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
50896         LDKChannelTransactionParameters this_ptr_conv;
50897         this_ptr_conv.inner = untag_ptr(this_ptr);
50898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50900         this_ptr_conv.is_owned = false;
50901         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
50902         int64_t ret_ref = 0;
50903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50905         return ret_ref;
50906 }
50907
50908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50909         LDKChannelTransactionParameters this_ptr_conv;
50910         this_ptr_conv.inner = untag_ptr(this_ptr);
50911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50913         this_ptr_conv.is_owned = false;
50914         LDKChannelTypeFeatures val_conv;
50915         val_conv.inner = untag_ptr(val);
50916         val_conv.is_owned = ptr_is_owned(val);
50917         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50918         val_conv = ChannelTypeFeatures_clone(&val_conv);
50919         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
50920 }
50921
50922 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, int64_t channel_type_features_arg) {
50923         LDKChannelPublicKeys holder_pubkeys_arg_conv;
50924         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
50925         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
50926         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
50927         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
50928         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
50929         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
50930         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
50931         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
50932         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
50933         LDKOutPoint funding_outpoint_arg_conv;
50934         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
50935         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
50936         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
50937         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
50938         LDKChannelTypeFeatures channel_type_features_arg_conv;
50939         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
50940         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
50941         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
50942         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
50943         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, channel_type_features_arg_conv);
50944         int64_t ret_ref = 0;
50945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50947         return ret_ref;
50948 }
50949
50950 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
50951         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
50952         int64_t ret_ref = 0;
50953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50955         return ret_ref;
50956 }
50957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50958         LDKChannelTransactionParameters arg_conv;
50959         arg_conv.inner = untag_ptr(arg);
50960         arg_conv.is_owned = ptr_is_owned(arg);
50961         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50962         arg_conv.is_owned = false;
50963         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
50964         return ret_conv;
50965 }
50966
50967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50968         LDKChannelTransactionParameters orig_conv;
50969         orig_conv.inner = untag_ptr(orig);
50970         orig_conv.is_owned = ptr_is_owned(orig);
50971         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50972         orig_conv.is_owned = false;
50973         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
50974         int64_t ret_ref = 0;
50975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50977         return ret_ref;
50978 }
50979
50980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50981         LDKChannelTransactionParameters a_conv;
50982         a_conv.inner = untag_ptr(a);
50983         a_conv.is_owned = ptr_is_owned(a);
50984         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50985         a_conv.is_owned = false;
50986         LDKChannelTransactionParameters b_conv;
50987         b_conv.inner = untag_ptr(b);
50988         b_conv.is_owned = ptr_is_owned(b);
50989         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50990         b_conv.is_owned = false;
50991         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
50992         return ret_conv;
50993 }
50994
50995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50996         LDKCounterpartyChannelTransactionParameters this_obj_conv;
50997         this_obj_conv.inner = untag_ptr(this_obj);
50998         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51000         CounterpartyChannelTransactionParameters_free(this_obj_conv);
51001 }
51002
51003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
51004         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
51005         this_ptr_conv.inner = untag_ptr(this_ptr);
51006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51008         this_ptr_conv.is_owned = false;
51009         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
51010         int64_t ret_ref = 0;
51011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51013         return ret_ref;
51014 }
51015
51016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51017         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
51018         this_ptr_conv.inner = untag_ptr(this_ptr);
51019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51021         this_ptr_conv.is_owned = false;
51022         LDKChannelPublicKeys val_conv;
51023         val_conv.inner = untag_ptr(val);
51024         val_conv.is_owned = ptr_is_owned(val);
51025         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51026         val_conv = ChannelPublicKeys_clone(&val_conv);
51027         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
51028 }
51029
51030 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
51031         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
51032         this_ptr_conv.inner = untag_ptr(this_ptr);
51033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51035         this_ptr_conv.is_owned = false;
51036         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
51037         return ret_conv;
51038 }
51039
51040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
51041         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
51042         this_ptr_conv.inner = untag_ptr(this_ptr);
51043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51045         this_ptr_conv.is_owned = false;
51046         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
51047 }
51048
51049 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) {
51050         LDKChannelPublicKeys pubkeys_arg_conv;
51051         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
51052         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
51053         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
51054         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
51055         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
51056         int64_t ret_ref = 0;
51057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51059         return ret_ref;
51060 }
51061
51062 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
51063         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
51064         int64_t ret_ref = 0;
51065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51067         return ret_ref;
51068 }
51069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51070         LDKCounterpartyChannelTransactionParameters arg_conv;
51071         arg_conv.inner = untag_ptr(arg);
51072         arg_conv.is_owned = ptr_is_owned(arg);
51073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51074         arg_conv.is_owned = false;
51075         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
51076         return ret_conv;
51077 }
51078
51079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51080         LDKCounterpartyChannelTransactionParameters orig_conv;
51081         orig_conv.inner = untag_ptr(orig);
51082         orig_conv.is_owned = ptr_is_owned(orig);
51083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51084         orig_conv.is_owned = false;
51085         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
51086         int64_t ret_ref = 0;
51087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51089         return ret_ref;
51090 }
51091
51092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51093         LDKCounterpartyChannelTransactionParameters a_conv;
51094         a_conv.inner = untag_ptr(a);
51095         a_conv.is_owned = ptr_is_owned(a);
51096         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51097         a_conv.is_owned = false;
51098         LDKCounterpartyChannelTransactionParameters b_conv;
51099         b_conv.inner = untag_ptr(b);
51100         b_conv.is_owned = ptr_is_owned(b);
51101         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51102         b_conv.is_owned = false;
51103         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
51104         return ret_conv;
51105 }
51106
51107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
51108         LDKChannelTransactionParameters this_arg_conv;
51109         this_arg_conv.inner = untag_ptr(this_arg);
51110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51112         this_arg_conv.is_owned = false;
51113         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
51114         return ret_conv;
51115 }
51116
51117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
51118         LDKChannelTransactionParameters this_arg_conv;
51119         this_arg_conv.inner = untag_ptr(this_arg);
51120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51122         this_arg_conv.is_owned = false;
51123         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
51124         int64_t ret_ref = 0;
51125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51127         return ret_ref;
51128 }
51129
51130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
51131         LDKChannelTransactionParameters this_arg_conv;
51132         this_arg_conv.inner = untag_ptr(this_arg);
51133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51135         this_arg_conv.is_owned = false;
51136         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
51137         int64_t ret_ref = 0;
51138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51140         return ret_ref;
51141 }
51142
51143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
51144         LDKCounterpartyChannelTransactionParameters obj_conv;
51145         obj_conv.inner = untag_ptr(obj);
51146         obj_conv.is_owned = ptr_is_owned(obj);
51147         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51148         obj_conv.is_owned = false;
51149         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
51150         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51151         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51152         CVec_u8Z_free(ret_var);
51153         return ret_arr;
51154 }
51155
51156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51157         LDKu8slice ser_ref;
51158         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51159         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51160         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
51161         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
51162         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51163         return tag_ptr(ret_conv, true);
51164 }
51165
51166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
51167         LDKChannelTransactionParameters obj_conv;
51168         obj_conv.inner = untag_ptr(obj);
51169         obj_conv.is_owned = ptr_is_owned(obj);
51170         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51171         obj_conv.is_owned = false;
51172         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
51173         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51174         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51175         CVec_u8Z_free(ret_var);
51176         return ret_arr;
51177 }
51178
51179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51180         LDKu8slice ser_ref;
51181         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51182         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51183         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
51184         *ret_conv = ChannelTransactionParameters_read(ser_ref);
51185         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51186         return tag_ptr(ret_conv, true);
51187 }
51188
51189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51190         LDKDirectedChannelTransactionParameters this_obj_conv;
51191         this_obj_conv.inner = untag_ptr(this_obj);
51192         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51194         DirectedChannelTransactionParameters_free(this_obj_conv);
51195 }
51196
51197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
51198         LDKDirectedChannelTransactionParameters this_arg_conv;
51199         this_arg_conv.inner = untag_ptr(this_arg);
51200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51202         this_arg_conv.is_owned = false;
51203         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
51204         int64_t ret_ref = 0;
51205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51207         return ret_ref;
51208 }
51209
51210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
51211         LDKDirectedChannelTransactionParameters this_arg_conv;
51212         this_arg_conv.inner = untag_ptr(this_arg);
51213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51215         this_arg_conv.is_owned = false;
51216         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
51217         int64_t ret_ref = 0;
51218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51220         return ret_ref;
51221 }
51222
51223 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
51224         LDKDirectedChannelTransactionParameters this_arg_conv;
51225         this_arg_conv.inner = untag_ptr(this_arg);
51226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51228         this_arg_conv.is_owned = false;
51229         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
51230         return ret_conv;
51231 }
51232
51233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
51234         LDKDirectedChannelTransactionParameters this_arg_conv;
51235         this_arg_conv.inner = untag_ptr(this_arg);
51236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51238         this_arg_conv.is_owned = false;
51239         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
51240         return ret_conv;
51241 }
51242
51243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
51244         LDKDirectedChannelTransactionParameters this_arg_conv;
51245         this_arg_conv.inner = untag_ptr(this_arg);
51246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51248         this_arg_conv.is_owned = false;
51249         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
51250         int64_t ret_ref = 0;
51251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51253         return ret_ref;
51254 }
51255
51256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
51257         LDKDirectedChannelTransactionParameters this_arg_conv;
51258         this_arg_conv.inner = untag_ptr(this_arg);
51259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51261         this_arg_conv.is_owned = false;
51262         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
51263         int64_t ret_ref = 0;
51264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51266         return ret_ref;
51267 }
51268
51269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51270         LDKHolderCommitmentTransaction this_obj_conv;
51271         this_obj_conv.inner = untag_ptr(this_obj);
51272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51274         HolderCommitmentTransaction_free(this_obj_conv);
51275 }
51276
51277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
51278         LDKHolderCommitmentTransaction this_ptr_conv;
51279         this_ptr_conv.inner = untag_ptr(this_ptr);
51280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51282         this_ptr_conv.is_owned = false;
51283         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51284         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
51285         return ret_arr;
51286 }
51287
51288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51289         LDKHolderCommitmentTransaction this_ptr_conv;
51290         this_ptr_conv.inner = untag_ptr(this_ptr);
51291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51293         this_ptr_conv.is_owned = false;
51294         LDKSignature val_ref;
51295         CHECK((*env)->GetArrayLength(env, val) == 64);
51296         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
51297         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
51298 }
51299
51300 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
51301         LDKHolderCommitmentTransaction this_ptr_conv;
51302         this_ptr_conv.inner = untag_ptr(this_ptr);
51303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51305         this_ptr_conv.is_owned = false;
51306         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
51307         jobjectArray ret_arr = NULL;
51308         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
51309         ;
51310         for (size_t i = 0; i < ret_var.datalen; i++) {
51311                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
51312                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
51313                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
51314         }
51315         
51316         FREE(ret_var.data);
51317         return ret_arr;
51318 }
51319
51320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
51321         LDKHolderCommitmentTransaction this_ptr_conv;
51322         this_ptr_conv.inner = untag_ptr(this_ptr);
51323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51325         this_ptr_conv.is_owned = false;
51326         LDKCVec_SignatureZ val_constr;
51327         val_constr.datalen = (*env)->GetArrayLength(env, val);
51328         if (val_constr.datalen > 0)
51329                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
51330         else
51331                 val_constr.data = NULL;
51332         for (size_t i = 0; i < val_constr.datalen; i++) {
51333                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
51334                 LDKSignature val_conv_8_ref;
51335                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
51336                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
51337                 val_constr.data[i] = val_conv_8_ref;
51338         }
51339         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
51340 }
51341
51342 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
51343         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
51344         int64_t ret_ref = 0;
51345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51347         return ret_ref;
51348 }
51349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51350         LDKHolderCommitmentTransaction arg_conv;
51351         arg_conv.inner = untag_ptr(arg);
51352         arg_conv.is_owned = ptr_is_owned(arg);
51353         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51354         arg_conv.is_owned = false;
51355         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
51356         return ret_conv;
51357 }
51358
51359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51360         LDKHolderCommitmentTransaction orig_conv;
51361         orig_conv.inner = untag_ptr(orig);
51362         orig_conv.is_owned = ptr_is_owned(orig);
51363         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51364         orig_conv.is_owned = false;
51365         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
51366         int64_t ret_ref = 0;
51367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51369         return ret_ref;
51370 }
51371
51372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
51373         LDKHolderCommitmentTransaction obj_conv;
51374         obj_conv.inner = untag_ptr(obj);
51375         obj_conv.is_owned = ptr_is_owned(obj);
51376         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51377         obj_conv.is_owned = false;
51378         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
51379         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51380         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51381         CVec_u8Z_free(ret_var);
51382         return ret_arr;
51383 }
51384
51385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51386         LDKu8slice ser_ref;
51387         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51388         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51389         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
51390         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
51391         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51392         return tag_ptr(ret_conv, true);
51393 }
51394
51395 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) {
51396         LDKCommitmentTransaction commitment_tx_conv;
51397         commitment_tx_conv.inner = untag_ptr(commitment_tx);
51398         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
51399         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
51400         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
51401         LDKSignature counterparty_sig_ref;
51402         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
51403         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
51404         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
51405         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
51406         if (counterparty_htlc_sigs_constr.datalen > 0)
51407                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
51408         else
51409                 counterparty_htlc_sigs_constr.data = NULL;
51410         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
51411                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
51412                 LDKSignature counterparty_htlc_sigs_conv_8_ref;
51413                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
51414                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
51415                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
51416         }
51417         LDKPublicKey holder_funding_key_ref;
51418         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
51419         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
51420         LDKPublicKey counterparty_funding_key_ref;
51421         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
51422         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
51423         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
51424         int64_t ret_ref = 0;
51425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51427         return ret_ref;
51428 }
51429
51430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51431         LDKBuiltCommitmentTransaction this_obj_conv;
51432         this_obj_conv.inner = untag_ptr(this_obj);
51433         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51435         BuiltCommitmentTransaction_free(this_obj_conv);
51436 }
51437
51438 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
51439         LDKBuiltCommitmentTransaction this_ptr_conv;
51440         this_ptr_conv.inner = untag_ptr(this_ptr);
51441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51443         this_ptr_conv.is_owned = false;
51444         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
51445         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51446         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51447         Transaction_free(ret_var);
51448         return ret_arr;
51449 }
51450
51451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51452         LDKBuiltCommitmentTransaction this_ptr_conv;
51453         this_ptr_conv.inner = untag_ptr(this_ptr);
51454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51456         this_ptr_conv.is_owned = false;
51457         LDKTransaction val_ref;
51458         val_ref.datalen = (*env)->GetArrayLength(env, val);
51459         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
51460         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
51461         val_ref.data_is_owned = true;
51462         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
51463 }
51464
51465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
51466         LDKBuiltCommitmentTransaction this_ptr_conv;
51467         this_ptr_conv.inner = untag_ptr(this_ptr);
51468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51470         this_ptr_conv.is_owned = false;
51471         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51472         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
51473         return ret_arr;
51474 }
51475
51476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51477         LDKBuiltCommitmentTransaction this_ptr_conv;
51478         this_ptr_conv.inner = untag_ptr(this_ptr);
51479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51481         this_ptr_conv.is_owned = false;
51482         LDKThirtyTwoBytes val_ref;
51483         CHECK((*env)->GetArrayLength(env, val) == 32);
51484         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51485         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
51486 }
51487
51488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
51489         LDKTransaction transaction_arg_ref;
51490         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
51491         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
51492         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
51493         transaction_arg_ref.data_is_owned = true;
51494         LDKThirtyTwoBytes txid_arg_ref;
51495         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
51496         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
51497         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
51498         int64_t ret_ref = 0;
51499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51501         return ret_ref;
51502 }
51503
51504 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
51505         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
51506         int64_t ret_ref = 0;
51507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51509         return ret_ref;
51510 }
51511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51512         LDKBuiltCommitmentTransaction arg_conv;
51513         arg_conv.inner = untag_ptr(arg);
51514         arg_conv.is_owned = ptr_is_owned(arg);
51515         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51516         arg_conv.is_owned = false;
51517         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
51518         return ret_conv;
51519 }
51520
51521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51522         LDKBuiltCommitmentTransaction orig_conv;
51523         orig_conv.inner = untag_ptr(orig);
51524         orig_conv.is_owned = ptr_is_owned(orig);
51525         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51526         orig_conv.is_owned = false;
51527         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
51528         int64_t ret_ref = 0;
51529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51531         return ret_ref;
51532 }
51533
51534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
51535         LDKBuiltCommitmentTransaction obj_conv;
51536         obj_conv.inner = untag_ptr(obj);
51537         obj_conv.is_owned = ptr_is_owned(obj);
51538         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51539         obj_conv.is_owned = false;
51540         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
51541         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51542         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51543         CVec_u8Z_free(ret_var);
51544         return ret_arr;
51545 }
51546
51547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51548         LDKu8slice ser_ref;
51549         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51550         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51551         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
51552         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
51553         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51554         return tag_ptr(ret_conv, true);
51555 }
51556
51557 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) {
51558         LDKBuiltCommitmentTransaction this_arg_conv;
51559         this_arg_conv.inner = untag_ptr(this_arg);
51560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51562         this_arg_conv.is_owned = false;
51563         LDKu8slice funding_redeemscript_ref;
51564         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51565         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51566         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51567         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
51568         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51569         return ret_arr;
51570 }
51571
51572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
51573         LDKBuiltCommitmentTransaction this_arg_conv;
51574         this_arg_conv.inner = untag_ptr(this_arg);
51575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51577         this_arg_conv.is_owned = false;
51578         uint8_t funding_key_arr[32];
51579         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
51580         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
51581         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
51582         LDKu8slice funding_redeemscript_ref;
51583         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51584         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51585         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51586         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
51587         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51588         return ret_arr;
51589 }
51590
51591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis, int64_t entropy_source) {
51592         LDKBuiltCommitmentTransaction this_arg_conv;
51593         this_arg_conv.inner = untag_ptr(this_arg);
51594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51596         this_arg_conv.is_owned = false;
51597         uint8_t funding_key_arr[32];
51598         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
51599         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
51600         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
51601         LDKu8slice funding_redeemscript_ref;
51602         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51603         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51604         void* entropy_source_ptr = untag_ptr(entropy_source);
51605         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
51606         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
51607         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51608         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign_holder_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis, entropy_source_conv).compact_form);
51609         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51610         return ret_arr;
51611 }
51612
51613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51614         LDKClosingTransaction this_obj_conv;
51615         this_obj_conv.inner = untag_ptr(this_obj);
51616         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51618         ClosingTransaction_free(this_obj_conv);
51619 }
51620
51621 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
51622         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
51623         int64_t ret_ref = 0;
51624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51626         return ret_ref;
51627 }
51628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51629         LDKClosingTransaction arg_conv;
51630         arg_conv.inner = untag_ptr(arg);
51631         arg_conv.is_owned = ptr_is_owned(arg);
51632         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51633         arg_conv.is_owned = false;
51634         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
51635         return ret_conv;
51636 }
51637
51638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51639         LDKClosingTransaction orig_conv;
51640         orig_conv.inner = untag_ptr(orig);
51641         orig_conv.is_owned = ptr_is_owned(orig);
51642         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51643         orig_conv.is_owned = false;
51644         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
51645         int64_t ret_ref = 0;
51646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51648         return ret_ref;
51649 }
51650
51651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
51652         LDKClosingTransaction o_conv;
51653         o_conv.inner = untag_ptr(o);
51654         o_conv.is_owned = ptr_is_owned(o);
51655         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51656         o_conv.is_owned = false;
51657         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
51658         return ret_conv;
51659 }
51660
51661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51662         LDKClosingTransaction a_conv;
51663         a_conv.inner = untag_ptr(a);
51664         a_conv.is_owned = ptr_is_owned(a);
51665         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51666         a_conv.is_owned = false;
51667         LDKClosingTransaction b_conv;
51668         b_conv.inner = untag_ptr(b);
51669         b_conv.is_owned = ptr_is_owned(b);
51670         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51671         b_conv.is_owned = false;
51672         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
51673         return ret_conv;
51674 }
51675
51676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
51677         LDKCVec_u8Z to_holder_script_ref;
51678         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
51679         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
51680         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
51681         LDKCVec_u8Z to_counterparty_script_ref;
51682         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
51683         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
51684         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
51685         LDKOutPoint funding_outpoint_conv;
51686         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
51687         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
51688         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
51689         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
51690         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
51691         int64_t ret_ref = 0;
51692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51694         return ret_ref;
51695 }
51696
51697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
51698         LDKClosingTransaction this_arg_conv;
51699         this_arg_conv.inner = untag_ptr(this_arg);
51700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51702         this_arg_conv.is_owned = false;
51703         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
51704         int64_t ret_ref = 0;
51705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51707         return ret_ref;
51708 }
51709
51710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
51711         LDKClosingTransaction this_arg_conv;
51712         this_arg_conv.inner = untag_ptr(this_arg);
51713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51715         this_arg_conv.is_owned = false;
51716         LDKOutPoint funding_outpoint_conv;
51717         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
51718         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
51719         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
51720         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
51721         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
51722         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
51723         return tag_ptr(ret_conv, true);
51724 }
51725
51726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
51727         LDKClosingTransaction this_arg_conv;
51728         this_arg_conv.inner = untag_ptr(this_arg);
51729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51731         this_arg_conv.is_owned = false;
51732         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
51733         return ret_conv;
51734 }
51735
51736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
51737         LDKClosingTransaction this_arg_conv;
51738         this_arg_conv.inner = untag_ptr(this_arg);
51739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51741         this_arg_conv.is_owned = false;
51742         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
51743         return ret_conv;
51744 }
51745
51746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
51747         LDKClosingTransaction this_arg_conv;
51748         this_arg_conv.inner = untag_ptr(this_arg);
51749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51751         this_arg_conv.is_owned = false;
51752         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
51753         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51754         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51755         return ret_arr;
51756 }
51757
51758 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
51759         LDKClosingTransaction this_arg_conv;
51760         this_arg_conv.inner = untag_ptr(this_arg);
51761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51763         this_arg_conv.is_owned = false;
51764         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
51765         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51766         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51767         return ret_arr;
51768 }
51769
51770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51771         LDKTrustedClosingTransaction this_obj_conv;
51772         this_obj_conv.inner = untag_ptr(this_obj);
51773         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51775         TrustedClosingTransaction_free(this_obj_conv);
51776 }
51777
51778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
51779         LDKTrustedClosingTransaction this_arg_conv;
51780         this_arg_conv.inner = untag_ptr(this_arg);
51781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51783         this_arg_conv.is_owned = false;
51784         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
51785         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51786         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51787         Transaction_free(ret_var);
51788         return ret_arr;
51789 }
51790
51791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
51792         LDKTrustedClosingTransaction this_arg_conv;
51793         this_arg_conv.inner = untag_ptr(this_arg);
51794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51796         this_arg_conv.is_owned = false;
51797         LDKu8slice funding_redeemscript_ref;
51798         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51799         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51800         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51801         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
51802         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51803         return ret_arr;
51804 }
51805
51806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
51807         LDKTrustedClosingTransaction this_arg_conv;
51808         this_arg_conv.inner = untag_ptr(this_arg);
51809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51811         this_arg_conv.is_owned = false;
51812         uint8_t funding_key_arr[32];
51813         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
51814         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
51815         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
51816         LDKu8slice funding_redeemscript_ref;
51817         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51818         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51819         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51820         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
51821         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51822         return ret_arr;
51823 }
51824
51825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51826         LDKCommitmentTransaction this_obj_conv;
51827         this_obj_conv.inner = untag_ptr(this_obj);
51828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51830         CommitmentTransaction_free(this_obj_conv);
51831 }
51832
51833 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
51834         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
51835         int64_t ret_ref = 0;
51836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51838         return ret_ref;
51839 }
51840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51841         LDKCommitmentTransaction arg_conv;
51842         arg_conv.inner = untag_ptr(arg);
51843         arg_conv.is_owned = ptr_is_owned(arg);
51844         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51845         arg_conv.is_owned = false;
51846         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
51847         return ret_conv;
51848 }
51849
51850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51851         LDKCommitmentTransaction orig_conv;
51852         orig_conv.inner = untag_ptr(orig);
51853         orig_conv.is_owned = ptr_is_owned(orig);
51854         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51855         orig_conv.is_owned = false;
51856         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
51857         int64_t ret_ref = 0;
51858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51860         return ret_ref;
51861 }
51862
51863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
51864         LDKCommitmentTransaction obj_conv;
51865         obj_conv.inner = untag_ptr(obj);
51866         obj_conv.is_owned = ptr_is_owned(obj);
51867         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51868         obj_conv.is_owned = false;
51869         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
51870         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51871         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51872         CVec_u8Z_free(ret_var);
51873         return ret_arr;
51874 }
51875
51876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51877         LDKu8slice ser_ref;
51878         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51879         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51880         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
51881         *ret_conv = CommitmentTransaction_read(ser_ref);
51882         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51883         return tag_ptr(ret_conv, true);
51884 }
51885
51886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
51887         LDKCommitmentTransaction this_arg_conv;
51888         this_arg_conv.inner = untag_ptr(this_arg);
51889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51891         this_arg_conv.is_owned = false;
51892         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
51893         return ret_conv;
51894 }
51895
51896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
51897         LDKCommitmentTransaction this_arg_conv;
51898         this_arg_conv.inner = untag_ptr(this_arg);
51899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51901         this_arg_conv.is_owned = false;
51902         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
51903         return ret_conv;
51904 }
51905
51906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
51907         LDKCommitmentTransaction this_arg_conv;
51908         this_arg_conv.inner = untag_ptr(this_arg);
51909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51911         this_arg_conv.is_owned = false;
51912         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
51913         return ret_conv;
51914 }
51915
51916 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
51917         LDKCommitmentTransaction this_arg_conv;
51918         this_arg_conv.inner = untag_ptr(this_arg);
51919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51921         this_arg_conv.is_owned = false;
51922         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
51923         return ret_conv;
51924 }
51925
51926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
51927         LDKCommitmentTransaction this_arg_conv;
51928         this_arg_conv.inner = untag_ptr(this_arg);
51929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51931         this_arg_conv.is_owned = false;
51932         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
51933         int64_t ret_ref = 0;
51934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51936         return ret_ref;
51937 }
51938
51939 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) {
51940         LDKCommitmentTransaction this_arg_conv;
51941         this_arg_conv.inner = untag_ptr(this_arg);
51942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51944         this_arg_conv.is_owned = false;
51945         LDKDirectedChannelTransactionParameters channel_parameters_conv;
51946         channel_parameters_conv.inner = untag_ptr(channel_parameters);
51947         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
51948         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
51949         channel_parameters_conv.is_owned = false;
51950         LDKChannelPublicKeys broadcaster_keys_conv;
51951         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
51952         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
51953         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
51954         broadcaster_keys_conv.is_owned = false;
51955         LDKChannelPublicKeys countersignatory_keys_conv;
51956         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
51957         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
51958         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
51959         countersignatory_keys_conv.is_owned = false;
51960         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
51961         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
51962         return tag_ptr(ret_conv, true);
51963 }
51964
51965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51966         LDKTrustedCommitmentTransaction this_obj_conv;
51967         this_obj_conv.inner = untag_ptr(this_obj);
51968         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51970         TrustedCommitmentTransaction_free(this_obj_conv);
51971 }
51972
51973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
51974         LDKTrustedCommitmentTransaction this_arg_conv;
51975         this_arg_conv.inner = untag_ptr(this_arg);
51976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51978         this_arg_conv.is_owned = false;
51979         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51980         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
51981         return ret_arr;
51982 }
51983
51984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
51985         LDKTrustedCommitmentTransaction this_arg_conv;
51986         this_arg_conv.inner = untag_ptr(this_arg);
51987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51989         this_arg_conv.is_owned = false;
51990         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
51991         int64_t ret_ref = 0;
51992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51994         return ret_ref;
51995 }
51996
51997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
51998         LDKTrustedCommitmentTransaction this_arg_conv;
51999         this_arg_conv.inner = untag_ptr(this_arg);
52000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52002         this_arg_conv.is_owned = false;
52003         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
52004         int64_t ret_ref = 0;
52005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52007         return ret_ref;
52008 }
52009
52010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
52011         LDKTrustedCommitmentTransaction this_arg_conv;
52012         this_arg_conv.inner = untag_ptr(this_arg);
52013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52015         this_arg_conv.is_owned = false;
52016         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
52017         int64_t ret_ref = 0;
52018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52020         return ret_ref;
52021 }
52022
52023 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, int64_t entropy_source) {
52024         LDKTrustedCommitmentTransaction this_arg_conv;
52025         this_arg_conv.inner = untag_ptr(this_arg);
52026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52028         this_arg_conv.is_owned = false;
52029         uint8_t htlc_base_key_arr[32];
52030         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
52031         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
52032         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
52033         LDKDirectedChannelTransactionParameters channel_parameters_conv;
52034         channel_parameters_conv.inner = untag_ptr(channel_parameters);
52035         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
52036         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
52037         channel_parameters_conv.is_owned = false;
52038         void* entropy_source_ptr = untag_ptr(entropy_source);
52039         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
52040         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
52041         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
52042         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
52043         return tag_ptr(ret_conv, true);
52044 }
52045
52046 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) {
52047         LDKPublicKey broadcaster_payment_basepoint_ref;
52048         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
52049         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
52050         LDKPublicKey countersignatory_payment_basepoint_ref;
52051         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
52052         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
52053         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
52054         return ret_conv;
52055 }
52056
52057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52058         LDKInitFeatures a_conv;
52059         a_conv.inner = untag_ptr(a);
52060         a_conv.is_owned = ptr_is_owned(a);
52061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52062         a_conv.is_owned = false;
52063         LDKInitFeatures b_conv;
52064         b_conv.inner = untag_ptr(b);
52065         b_conv.is_owned = ptr_is_owned(b);
52066         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52067         b_conv.is_owned = false;
52068         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
52069         return ret_conv;
52070 }
52071
52072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52073         LDKNodeFeatures a_conv;
52074         a_conv.inner = untag_ptr(a);
52075         a_conv.is_owned = ptr_is_owned(a);
52076         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52077         a_conv.is_owned = false;
52078         LDKNodeFeatures b_conv;
52079         b_conv.inner = untag_ptr(b);
52080         b_conv.is_owned = ptr_is_owned(b);
52081         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52082         b_conv.is_owned = false;
52083         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
52084         return ret_conv;
52085 }
52086
52087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52088         LDKChannelFeatures a_conv;
52089         a_conv.inner = untag_ptr(a);
52090         a_conv.is_owned = ptr_is_owned(a);
52091         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52092         a_conv.is_owned = false;
52093         LDKChannelFeatures b_conv;
52094         b_conv.inner = untag_ptr(b);
52095         b_conv.is_owned = ptr_is_owned(b);
52096         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52097         b_conv.is_owned = false;
52098         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
52099         return ret_conv;
52100 }
52101
52102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52103         LDKBolt11InvoiceFeatures a_conv;
52104         a_conv.inner = untag_ptr(a);
52105         a_conv.is_owned = ptr_is_owned(a);
52106         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52107         a_conv.is_owned = false;
52108         LDKBolt11InvoiceFeatures b_conv;
52109         b_conv.inner = untag_ptr(b);
52110         b_conv.is_owned = ptr_is_owned(b);
52111         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52112         b_conv.is_owned = false;
52113         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
52114         return ret_conv;
52115 }
52116
52117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52118         LDKOfferFeatures a_conv;
52119         a_conv.inner = untag_ptr(a);
52120         a_conv.is_owned = ptr_is_owned(a);
52121         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52122         a_conv.is_owned = false;
52123         LDKOfferFeatures b_conv;
52124         b_conv.inner = untag_ptr(b);
52125         b_conv.is_owned = ptr_is_owned(b);
52126         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52127         b_conv.is_owned = false;
52128         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
52129         return ret_conv;
52130 }
52131
52132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52133         LDKInvoiceRequestFeatures a_conv;
52134         a_conv.inner = untag_ptr(a);
52135         a_conv.is_owned = ptr_is_owned(a);
52136         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52137         a_conv.is_owned = false;
52138         LDKInvoiceRequestFeatures b_conv;
52139         b_conv.inner = untag_ptr(b);
52140         b_conv.is_owned = ptr_is_owned(b);
52141         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52142         b_conv.is_owned = false;
52143         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
52144         return ret_conv;
52145 }
52146
52147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52148         LDKBolt12InvoiceFeatures a_conv;
52149         a_conv.inner = untag_ptr(a);
52150         a_conv.is_owned = ptr_is_owned(a);
52151         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52152         a_conv.is_owned = false;
52153         LDKBolt12InvoiceFeatures b_conv;
52154         b_conv.inner = untag_ptr(b);
52155         b_conv.is_owned = ptr_is_owned(b);
52156         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52157         b_conv.is_owned = false;
52158         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
52159         return ret_conv;
52160 }
52161
52162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52163         LDKBlindedHopFeatures a_conv;
52164         a_conv.inner = untag_ptr(a);
52165         a_conv.is_owned = ptr_is_owned(a);
52166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52167         a_conv.is_owned = false;
52168         LDKBlindedHopFeatures b_conv;
52169         b_conv.inner = untag_ptr(b);
52170         b_conv.is_owned = ptr_is_owned(b);
52171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52172         b_conv.is_owned = false;
52173         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
52174         return ret_conv;
52175 }
52176
52177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52178         LDKChannelTypeFeatures a_conv;
52179         a_conv.inner = untag_ptr(a);
52180         a_conv.is_owned = ptr_is_owned(a);
52181         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52182         a_conv.is_owned = false;
52183         LDKChannelTypeFeatures b_conv;
52184         b_conv.inner = untag_ptr(b);
52185         b_conv.is_owned = ptr_is_owned(b);
52186         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52187         b_conv.is_owned = false;
52188         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
52189         return ret_conv;
52190 }
52191
52192 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
52193         LDKInitFeatures ret_var = InitFeatures_clone(arg);
52194         int64_t ret_ref = 0;
52195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52197         return ret_ref;
52198 }
52199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52200         LDKInitFeatures arg_conv;
52201         arg_conv.inner = untag_ptr(arg);
52202         arg_conv.is_owned = ptr_is_owned(arg);
52203         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52204         arg_conv.is_owned = false;
52205         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
52206         return ret_conv;
52207 }
52208
52209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52210         LDKInitFeatures orig_conv;
52211         orig_conv.inner = untag_ptr(orig);
52212         orig_conv.is_owned = ptr_is_owned(orig);
52213         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52214         orig_conv.is_owned = false;
52215         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
52216         int64_t ret_ref = 0;
52217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52219         return ret_ref;
52220 }
52221
52222 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
52223         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
52224         int64_t ret_ref = 0;
52225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52227         return ret_ref;
52228 }
52229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52230         LDKNodeFeatures arg_conv;
52231         arg_conv.inner = untag_ptr(arg);
52232         arg_conv.is_owned = ptr_is_owned(arg);
52233         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52234         arg_conv.is_owned = false;
52235         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
52236         return ret_conv;
52237 }
52238
52239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52240         LDKNodeFeatures orig_conv;
52241         orig_conv.inner = untag_ptr(orig);
52242         orig_conv.is_owned = ptr_is_owned(orig);
52243         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52244         orig_conv.is_owned = false;
52245         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
52246         int64_t ret_ref = 0;
52247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52249         return ret_ref;
52250 }
52251
52252 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
52253         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
52254         int64_t ret_ref = 0;
52255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52257         return ret_ref;
52258 }
52259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52260         LDKChannelFeatures arg_conv;
52261         arg_conv.inner = untag_ptr(arg);
52262         arg_conv.is_owned = ptr_is_owned(arg);
52263         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52264         arg_conv.is_owned = false;
52265         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
52266         return ret_conv;
52267 }
52268
52269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52270         LDKChannelFeatures orig_conv;
52271         orig_conv.inner = untag_ptr(orig);
52272         orig_conv.is_owned = ptr_is_owned(orig);
52273         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52274         orig_conv.is_owned = false;
52275         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
52276         int64_t ret_ref = 0;
52277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52279         return ret_ref;
52280 }
52281
52282 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
52283         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
52284         int64_t ret_ref = 0;
52285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52287         return ret_ref;
52288 }
52289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52290         LDKBolt11InvoiceFeatures arg_conv;
52291         arg_conv.inner = untag_ptr(arg);
52292         arg_conv.is_owned = ptr_is_owned(arg);
52293         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52294         arg_conv.is_owned = false;
52295         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
52296         return ret_conv;
52297 }
52298
52299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52300         LDKBolt11InvoiceFeatures orig_conv;
52301         orig_conv.inner = untag_ptr(orig);
52302         orig_conv.is_owned = ptr_is_owned(orig);
52303         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52304         orig_conv.is_owned = false;
52305         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
52306         int64_t ret_ref = 0;
52307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52309         return ret_ref;
52310 }
52311
52312 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
52313         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
52314         int64_t ret_ref = 0;
52315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52317         return ret_ref;
52318 }
52319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52320         LDKOfferFeatures arg_conv;
52321         arg_conv.inner = untag_ptr(arg);
52322         arg_conv.is_owned = ptr_is_owned(arg);
52323         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52324         arg_conv.is_owned = false;
52325         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
52326         return ret_conv;
52327 }
52328
52329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52330         LDKOfferFeatures orig_conv;
52331         orig_conv.inner = untag_ptr(orig);
52332         orig_conv.is_owned = ptr_is_owned(orig);
52333         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52334         orig_conv.is_owned = false;
52335         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
52336         int64_t ret_ref = 0;
52337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52339         return ret_ref;
52340 }
52341
52342 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
52343         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
52344         int64_t ret_ref = 0;
52345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52347         return ret_ref;
52348 }
52349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52350         LDKInvoiceRequestFeatures arg_conv;
52351         arg_conv.inner = untag_ptr(arg);
52352         arg_conv.is_owned = ptr_is_owned(arg);
52353         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52354         arg_conv.is_owned = false;
52355         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
52356         return ret_conv;
52357 }
52358
52359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52360         LDKInvoiceRequestFeatures orig_conv;
52361         orig_conv.inner = untag_ptr(orig);
52362         orig_conv.is_owned = ptr_is_owned(orig);
52363         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52364         orig_conv.is_owned = false;
52365         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
52366         int64_t ret_ref = 0;
52367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52369         return ret_ref;
52370 }
52371
52372 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
52373         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
52374         int64_t ret_ref = 0;
52375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52377         return ret_ref;
52378 }
52379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52380         LDKBolt12InvoiceFeatures arg_conv;
52381         arg_conv.inner = untag_ptr(arg);
52382         arg_conv.is_owned = ptr_is_owned(arg);
52383         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52384         arg_conv.is_owned = false;
52385         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
52386         return ret_conv;
52387 }
52388
52389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52390         LDKBolt12InvoiceFeatures orig_conv;
52391         orig_conv.inner = untag_ptr(orig);
52392         orig_conv.is_owned = ptr_is_owned(orig);
52393         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52394         orig_conv.is_owned = false;
52395         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
52396         int64_t ret_ref = 0;
52397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52399         return ret_ref;
52400 }
52401
52402 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
52403         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
52404         int64_t ret_ref = 0;
52405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52407         return ret_ref;
52408 }
52409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52410         LDKBlindedHopFeatures arg_conv;
52411         arg_conv.inner = untag_ptr(arg);
52412         arg_conv.is_owned = ptr_is_owned(arg);
52413         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52414         arg_conv.is_owned = false;
52415         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
52416         return ret_conv;
52417 }
52418
52419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52420         LDKBlindedHopFeatures orig_conv;
52421         orig_conv.inner = untag_ptr(orig);
52422         orig_conv.is_owned = ptr_is_owned(orig);
52423         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52424         orig_conv.is_owned = false;
52425         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
52426         int64_t ret_ref = 0;
52427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52429         return ret_ref;
52430 }
52431
52432 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
52433         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
52434         int64_t ret_ref = 0;
52435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52437         return ret_ref;
52438 }
52439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52440         LDKChannelTypeFeatures arg_conv;
52441         arg_conv.inner = untag_ptr(arg);
52442         arg_conv.is_owned = ptr_is_owned(arg);
52443         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52444         arg_conv.is_owned = false;
52445         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
52446         return ret_conv;
52447 }
52448
52449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52450         LDKChannelTypeFeatures orig_conv;
52451         orig_conv.inner = untag_ptr(orig);
52452         orig_conv.is_owned = ptr_is_owned(orig);
52453         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52454         orig_conv.is_owned = false;
52455         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
52456         int64_t ret_ref = 0;
52457         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52458         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52459         return ret_ref;
52460 }
52461
52462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52463         LDKInitFeatures this_obj_conv;
52464         this_obj_conv.inner = untag_ptr(this_obj);
52465         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52467         InitFeatures_free(this_obj_conv);
52468 }
52469
52470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52471         LDKNodeFeatures this_obj_conv;
52472         this_obj_conv.inner = untag_ptr(this_obj);
52473         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52475         NodeFeatures_free(this_obj_conv);
52476 }
52477
52478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52479         LDKChannelFeatures this_obj_conv;
52480         this_obj_conv.inner = untag_ptr(this_obj);
52481         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52483         ChannelFeatures_free(this_obj_conv);
52484 }
52485
52486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52487         LDKBolt11InvoiceFeatures this_obj_conv;
52488         this_obj_conv.inner = untag_ptr(this_obj);
52489         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52491         Bolt11InvoiceFeatures_free(this_obj_conv);
52492 }
52493
52494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52495         LDKOfferFeatures this_obj_conv;
52496         this_obj_conv.inner = untag_ptr(this_obj);
52497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52499         OfferFeatures_free(this_obj_conv);
52500 }
52501
52502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52503         LDKInvoiceRequestFeatures this_obj_conv;
52504         this_obj_conv.inner = untag_ptr(this_obj);
52505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52507         InvoiceRequestFeatures_free(this_obj_conv);
52508 }
52509
52510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52511         LDKBolt12InvoiceFeatures this_obj_conv;
52512         this_obj_conv.inner = untag_ptr(this_obj);
52513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52515         Bolt12InvoiceFeatures_free(this_obj_conv);
52516 }
52517
52518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52519         LDKBlindedHopFeatures this_obj_conv;
52520         this_obj_conv.inner = untag_ptr(this_obj);
52521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52523         BlindedHopFeatures_free(this_obj_conv);
52524 }
52525
52526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52527         LDKChannelTypeFeatures this_obj_conv;
52528         this_obj_conv.inner = untag_ptr(this_obj);
52529         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52531         ChannelTypeFeatures_free(this_obj_conv);
52532 }
52533
52534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
52535         LDKInitFeatures ret_var = InitFeatures_empty();
52536         int64_t ret_ref = 0;
52537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52539         return ret_ref;
52540 }
52541
52542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52543         LDKInitFeatures this_arg_conv;
52544         this_arg_conv.inner = untag_ptr(this_arg);
52545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52547         this_arg_conv.is_owned = false;
52548         LDKInitFeatures other_conv;
52549         other_conv.inner = untag_ptr(other);
52550         other_conv.is_owned = ptr_is_owned(other);
52551         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52552         other_conv.is_owned = false;
52553         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52554         return ret_conv;
52555 }
52556
52557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52558         LDKInitFeatures this_arg_conv;
52559         this_arg_conv.inner = untag_ptr(this_arg);
52560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52562         this_arg_conv.is_owned = false;
52563         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
52564         return ret_conv;
52565 }
52566
52567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52568         LDKInitFeatures this_arg_conv;
52569         this_arg_conv.inner = untag_ptr(this_arg);
52570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52572         this_arg_conv.is_owned = false;
52573         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52574         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
52575         return tag_ptr(ret_conv, true);
52576 }
52577
52578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52579         LDKInitFeatures this_arg_conv;
52580         this_arg_conv.inner = untag_ptr(this_arg);
52581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52583         this_arg_conv.is_owned = false;
52584         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52585         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52586         return tag_ptr(ret_conv, true);
52587 }
52588
52589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
52590         LDKNodeFeatures ret_var = NodeFeatures_empty();
52591         int64_t ret_ref = 0;
52592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52594         return ret_ref;
52595 }
52596
52597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52598         LDKNodeFeatures this_arg_conv;
52599         this_arg_conv.inner = untag_ptr(this_arg);
52600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52602         this_arg_conv.is_owned = false;
52603         LDKNodeFeatures other_conv;
52604         other_conv.inner = untag_ptr(other);
52605         other_conv.is_owned = ptr_is_owned(other);
52606         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52607         other_conv.is_owned = false;
52608         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52609         return ret_conv;
52610 }
52611
52612 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52613         LDKNodeFeatures this_arg_conv;
52614         this_arg_conv.inner = untag_ptr(this_arg);
52615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52617         this_arg_conv.is_owned = false;
52618         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
52619         return ret_conv;
52620 }
52621
52622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52623         LDKNodeFeatures this_arg_conv;
52624         this_arg_conv.inner = untag_ptr(this_arg);
52625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52627         this_arg_conv.is_owned = false;
52628         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52629         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
52630         return tag_ptr(ret_conv, true);
52631 }
52632
52633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52634         LDKNodeFeatures this_arg_conv;
52635         this_arg_conv.inner = untag_ptr(this_arg);
52636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52638         this_arg_conv.is_owned = false;
52639         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52640         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52641         return tag_ptr(ret_conv, true);
52642 }
52643
52644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
52645         LDKChannelFeatures ret_var = ChannelFeatures_empty();
52646         int64_t ret_ref = 0;
52647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52649         return ret_ref;
52650 }
52651
52652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52653         LDKChannelFeatures this_arg_conv;
52654         this_arg_conv.inner = untag_ptr(this_arg);
52655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52657         this_arg_conv.is_owned = false;
52658         LDKChannelFeatures other_conv;
52659         other_conv.inner = untag_ptr(other);
52660         other_conv.is_owned = ptr_is_owned(other);
52661         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52662         other_conv.is_owned = false;
52663         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52664         return ret_conv;
52665 }
52666
52667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52668         LDKChannelFeatures this_arg_conv;
52669         this_arg_conv.inner = untag_ptr(this_arg);
52670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52672         this_arg_conv.is_owned = false;
52673         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
52674         return ret_conv;
52675 }
52676
52677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52678         LDKChannelFeatures this_arg_conv;
52679         this_arg_conv.inner = untag_ptr(this_arg);
52680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52682         this_arg_conv.is_owned = false;
52683         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52684         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
52685         return tag_ptr(ret_conv, true);
52686 }
52687
52688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52689         LDKChannelFeatures this_arg_conv;
52690         this_arg_conv.inner = untag_ptr(this_arg);
52691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52693         this_arg_conv.is_owned = false;
52694         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52695         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52696         return tag_ptr(ret_conv, true);
52697 }
52698
52699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
52700         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
52701         int64_t ret_ref = 0;
52702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52704         return ret_ref;
52705 }
52706
52707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52708         LDKBolt11InvoiceFeatures this_arg_conv;
52709         this_arg_conv.inner = untag_ptr(this_arg);
52710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52712         this_arg_conv.is_owned = false;
52713         LDKBolt11InvoiceFeatures other_conv;
52714         other_conv.inner = untag_ptr(other);
52715         other_conv.is_owned = ptr_is_owned(other);
52716         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52717         other_conv.is_owned = false;
52718         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52719         return ret_conv;
52720 }
52721
52722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52723         LDKBolt11InvoiceFeatures this_arg_conv;
52724         this_arg_conv.inner = untag_ptr(this_arg);
52725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52727         this_arg_conv.is_owned = false;
52728         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
52729         return ret_conv;
52730 }
52731
52732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52733         LDKBolt11InvoiceFeatures this_arg_conv;
52734         this_arg_conv.inner = untag_ptr(this_arg);
52735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52737         this_arg_conv.is_owned = false;
52738         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52739         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
52740         return tag_ptr(ret_conv, true);
52741 }
52742
52743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52744         LDKBolt11InvoiceFeatures this_arg_conv;
52745         this_arg_conv.inner = untag_ptr(this_arg);
52746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52748         this_arg_conv.is_owned = false;
52749         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52750         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52751         return tag_ptr(ret_conv, true);
52752 }
52753
52754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
52755         LDKOfferFeatures ret_var = OfferFeatures_empty();
52756         int64_t ret_ref = 0;
52757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52759         return ret_ref;
52760 }
52761
52762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52763         LDKOfferFeatures this_arg_conv;
52764         this_arg_conv.inner = untag_ptr(this_arg);
52765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52767         this_arg_conv.is_owned = false;
52768         LDKOfferFeatures other_conv;
52769         other_conv.inner = untag_ptr(other);
52770         other_conv.is_owned = ptr_is_owned(other);
52771         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52772         other_conv.is_owned = false;
52773         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52774         return ret_conv;
52775 }
52776
52777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52778         LDKOfferFeatures this_arg_conv;
52779         this_arg_conv.inner = untag_ptr(this_arg);
52780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52782         this_arg_conv.is_owned = false;
52783         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
52784         return ret_conv;
52785 }
52786
52787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52788         LDKOfferFeatures this_arg_conv;
52789         this_arg_conv.inner = untag_ptr(this_arg);
52790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52792         this_arg_conv.is_owned = false;
52793         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52794         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
52795         return tag_ptr(ret_conv, true);
52796 }
52797
52798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52799         LDKOfferFeatures this_arg_conv;
52800         this_arg_conv.inner = untag_ptr(this_arg);
52801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52803         this_arg_conv.is_owned = false;
52804         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52805         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52806         return tag_ptr(ret_conv, true);
52807 }
52808
52809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
52810         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
52811         int64_t ret_ref = 0;
52812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52814         return ret_ref;
52815 }
52816
52817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52818         LDKInvoiceRequestFeatures this_arg_conv;
52819         this_arg_conv.inner = untag_ptr(this_arg);
52820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52822         this_arg_conv.is_owned = false;
52823         LDKInvoiceRequestFeatures other_conv;
52824         other_conv.inner = untag_ptr(other);
52825         other_conv.is_owned = ptr_is_owned(other);
52826         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52827         other_conv.is_owned = false;
52828         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52829         return ret_conv;
52830 }
52831
52832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52833         LDKInvoiceRequestFeatures this_arg_conv;
52834         this_arg_conv.inner = untag_ptr(this_arg);
52835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52837         this_arg_conv.is_owned = false;
52838         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
52839         return ret_conv;
52840 }
52841
52842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52843         LDKInvoiceRequestFeatures this_arg_conv;
52844         this_arg_conv.inner = untag_ptr(this_arg);
52845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52847         this_arg_conv.is_owned = false;
52848         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52849         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
52850         return tag_ptr(ret_conv, true);
52851 }
52852
52853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52854         LDKInvoiceRequestFeatures this_arg_conv;
52855         this_arg_conv.inner = untag_ptr(this_arg);
52856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52858         this_arg_conv.is_owned = false;
52859         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52860         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52861         return tag_ptr(ret_conv, true);
52862 }
52863
52864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
52865         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
52866         int64_t ret_ref = 0;
52867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52869         return ret_ref;
52870 }
52871
52872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52873         LDKBolt12InvoiceFeatures this_arg_conv;
52874         this_arg_conv.inner = untag_ptr(this_arg);
52875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52877         this_arg_conv.is_owned = false;
52878         LDKBolt12InvoiceFeatures other_conv;
52879         other_conv.inner = untag_ptr(other);
52880         other_conv.is_owned = ptr_is_owned(other);
52881         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52882         other_conv.is_owned = false;
52883         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52884         return ret_conv;
52885 }
52886
52887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52888         LDKBolt12InvoiceFeatures this_arg_conv;
52889         this_arg_conv.inner = untag_ptr(this_arg);
52890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52892         this_arg_conv.is_owned = false;
52893         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
52894         return ret_conv;
52895 }
52896
52897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52898         LDKBolt12InvoiceFeatures this_arg_conv;
52899         this_arg_conv.inner = untag_ptr(this_arg);
52900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52902         this_arg_conv.is_owned = false;
52903         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52904         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
52905         return tag_ptr(ret_conv, true);
52906 }
52907
52908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52909         LDKBolt12InvoiceFeatures this_arg_conv;
52910         this_arg_conv.inner = untag_ptr(this_arg);
52911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52913         this_arg_conv.is_owned = false;
52914         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52915         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52916         return tag_ptr(ret_conv, true);
52917 }
52918
52919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
52920         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
52921         int64_t ret_ref = 0;
52922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52924         return ret_ref;
52925 }
52926
52927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52928         LDKBlindedHopFeatures this_arg_conv;
52929         this_arg_conv.inner = untag_ptr(this_arg);
52930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52932         this_arg_conv.is_owned = false;
52933         LDKBlindedHopFeatures other_conv;
52934         other_conv.inner = untag_ptr(other);
52935         other_conv.is_owned = ptr_is_owned(other);
52936         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52937         other_conv.is_owned = false;
52938         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52939         return ret_conv;
52940 }
52941
52942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52943         LDKBlindedHopFeatures this_arg_conv;
52944         this_arg_conv.inner = untag_ptr(this_arg);
52945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52947         this_arg_conv.is_owned = false;
52948         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
52949         return ret_conv;
52950 }
52951
52952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52953         LDKBlindedHopFeatures this_arg_conv;
52954         this_arg_conv.inner = untag_ptr(this_arg);
52955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52957         this_arg_conv.is_owned = false;
52958         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52959         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
52960         return tag_ptr(ret_conv, true);
52961 }
52962
52963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
52964         LDKBlindedHopFeatures this_arg_conv;
52965         this_arg_conv.inner = untag_ptr(this_arg);
52966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52968         this_arg_conv.is_owned = false;
52969         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52970         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52971         return tag_ptr(ret_conv, true);
52972 }
52973
52974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
52975         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
52976         int64_t ret_ref = 0;
52977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52979         return ret_ref;
52980 }
52981
52982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52983         LDKChannelTypeFeatures this_arg_conv;
52984         this_arg_conv.inner = untag_ptr(this_arg);
52985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52987         this_arg_conv.is_owned = false;
52988         LDKChannelTypeFeatures other_conv;
52989         other_conv.inner = untag_ptr(other);
52990         other_conv.is_owned = ptr_is_owned(other);
52991         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52992         other_conv.is_owned = false;
52993         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52994         return ret_conv;
52995 }
52996
52997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52998         LDKChannelTypeFeatures this_arg_conv;
52999         this_arg_conv.inner = untag_ptr(this_arg);
53000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53002         this_arg_conv.is_owned = false;
53003         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
53004         return ret_conv;
53005 }
53006
53007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1required_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
53008         LDKChannelTypeFeatures this_arg_conv;
53009         this_arg_conv.inner = untag_ptr(this_arg);
53010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53012         this_arg_conv.is_owned = false;
53013         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
53014         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
53015         return tag_ptr(ret_conv, true);
53016 }
53017
53018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1optional_1custom_1bit(JNIEnv *env, jclass clz, int64_t this_arg, int64_t bit) {
53019         LDKChannelTypeFeatures this_arg_conv;
53020         this_arg_conv.inner = untag_ptr(this_arg);
53021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53023         this_arg_conv.is_owned = false;
53024         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
53025         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
53026         return tag_ptr(ret_conv, true);
53027 }
53028
53029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53030         LDKInitFeatures obj_conv;
53031         obj_conv.inner = untag_ptr(obj);
53032         obj_conv.is_owned = ptr_is_owned(obj);
53033         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53034         obj_conv.is_owned = false;
53035         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
53036         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53037         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53038         CVec_u8Z_free(ret_var);
53039         return ret_arr;
53040 }
53041
53042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53043         LDKu8slice ser_ref;
53044         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53045         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53046         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
53047         *ret_conv = InitFeatures_read(ser_ref);
53048         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53049         return tag_ptr(ret_conv, true);
53050 }
53051
53052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53053         LDKChannelFeatures obj_conv;
53054         obj_conv.inner = untag_ptr(obj);
53055         obj_conv.is_owned = ptr_is_owned(obj);
53056         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53057         obj_conv.is_owned = false;
53058         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
53059         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53060         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53061         CVec_u8Z_free(ret_var);
53062         return ret_arr;
53063 }
53064
53065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53066         LDKu8slice ser_ref;
53067         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53068         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53069         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
53070         *ret_conv = ChannelFeatures_read(ser_ref);
53071         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53072         return tag_ptr(ret_conv, true);
53073 }
53074
53075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53076         LDKNodeFeatures obj_conv;
53077         obj_conv.inner = untag_ptr(obj);
53078         obj_conv.is_owned = ptr_is_owned(obj);
53079         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53080         obj_conv.is_owned = false;
53081         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
53082         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53083         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53084         CVec_u8Z_free(ret_var);
53085         return ret_arr;
53086 }
53087
53088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53089         LDKu8slice ser_ref;
53090         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53091         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53092         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
53093         *ret_conv = NodeFeatures_read(ser_ref);
53094         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53095         return tag_ptr(ret_conv, true);
53096 }
53097
53098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53099         LDKBolt11InvoiceFeatures obj_conv;
53100         obj_conv.inner = untag_ptr(obj);
53101         obj_conv.is_owned = ptr_is_owned(obj);
53102         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53103         obj_conv.is_owned = false;
53104         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
53105         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53106         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53107         CVec_u8Z_free(ret_var);
53108         return ret_arr;
53109 }
53110
53111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53112         LDKu8slice ser_ref;
53113         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53114         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53115         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
53116         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
53117         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53118         return tag_ptr(ret_conv, true);
53119 }
53120
53121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53122         LDKBolt12InvoiceFeatures obj_conv;
53123         obj_conv.inner = untag_ptr(obj);
53124         obj_conv.is_owned = ptr_is_owned(obj);
53125         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53126         obj_conv.is_owned = false;
53127         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
53128         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53129         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53130         CVec_u8Z_free(ret_var);
53131         return ret_arr;
53132 }
53133
53134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53135         LDKu8slice ser_ref;
53136         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53137         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53138         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
53139         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
53140         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53141         return tag_ptr(ret_conv, true);
53142 }
53143
53144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53145         LDKBlindedHopFeatures obj_conv;
53146         obj_conv.inner = untag_ptr(obj);
53147         obj_conv.is_owned = ptr_is_owned(obj);
53148         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53149         obj_conv.is_owned = false;
53150         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
53151         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53152         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53153         CVec_u8Z_free(ret_var);
53154         return ret_arr;
53155 }
53156
53157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53158         LDKu8slice ser_ref;
53159         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53160         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53161         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
53162         *ret_conv = BlindedHopFeatures_read(ser_ref);
53163         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53164         return tag_ptr(ret_conv, true);
53165 }
53166
53167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53168         LDKChannelTypeFeatures obj_conv;
53169         obj_conv.inner = untag_ptr(obj);
53170         obj_conv.is_owned = ptr_is_owned(obj);
53171         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53172         obj_conv.is_owned = false;
53173         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
53174         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53175         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53176         CVec_u8Z_free(ret_var);
53177         return ret_arr;
53178 }
53179
53180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53181         LDKu8slice ser_ref;
53182         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53183         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53184         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
53185         *ret_conv = ChannelTypeFeatures_read(ser_ref);
53186         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53187         return tag_ptr(ret_conv, true);
53188 }
53189
53190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53191         LDKInitFeatures this_arg_conv;
53192         this_arg_conv.inner = untag_ptr(this_arg);
53193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53195         this_arg_conv.is_owned = false;
53196         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
53197 }
53198
53199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53200         LDKInitFeatures this_arg_conv;
53201         this_arg_conv.inner = untag_ptr(this_arg);
53202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53204         this_arg_conv.is_owned = false;
53205         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
53206 }
53207
53208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
53209         LDKInitFeatures this_arg_conv;
53210         this_arg_conv.inner = untag_ptr(this_arg);
53211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53213         this_arg_conv.is_owned = false;
53214         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
53215         return ret_conv;
53216 }
53217
53218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53219         LDKNodeFeatures this_arg_conv;
53220         this_arg_conv.inner = untag_ptr(this_arg);
53221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53223         this_arg_conv.is_owned = false;
53224         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
53225 }
53226
53227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53228         LDKNodeFeatures this_arg_conv;
53229         this_arg_conv.inner = untag_ptr(this_arg);
53230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53232         this_arg_conv.is_owned = false;
53233         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
53234 }
53235
53236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
53237         LDKNodeFeatures this_arg_conv;
53238         this_arg_conv.inner = untag_ptr(this_arg);
53239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53241         this_arg_conv.is_owned = false;
53242         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
53243         return ret_conv;
53244 }
53245
53246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
53247         LDKInitFeatures this_arg_conv;
53248         this_arg_conv.inner = untag_ptr(this_arg);
53249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53251         this_arg_conv.is_owned = false;
53252         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
53253         return ret_conv;
53254 }
53255
53256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
53257         LDKNodeFeatures this_arg_conv;
53258         this_arg_conv.inner = untag_ptr(this_arg);
53259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53261         this_arg_conv.is_owned = false;
53262         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
53263         return ret_conv;
53264 }
53265
53266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53267         LDKInitFeatures this_arg_conv;
53268         this_arg_conv.inner = untag_ptr(this_arg);
53269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53271         this_arg_conv.is_owned = false;
53272         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
53273 }
53274
53275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53276         LDKInitFeatures this_arg_conv;
53277         this_arg_conv.inner = untag_ptr(this_arg);
53278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53280         this_arg_conv.is_owned = false;
53281         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
53282 }
53283
53284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
53285         LDKInitFeatures this_arg_conv;
53286         this_arg_conv.inner = untag_ptr(this_arg);
53287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53289         this_arg_conv.is_owned = false;
53290         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
53291         return ret_conv;
53292 }
53293
53294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53295         LDKInitFeatures this_arg_conv;
53296         this_arg_conv.inner = untag_ptr(this_arg);
53297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53299         this_arg_conv.is_owned = false;
53300         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
53301 }
53302
53303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53304         LDKInitFeatures this_arg_conv;
53305         this_arg_conv.inner = untag_ptr(this_arg);
53306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53308         this_arg_conv.is_owned = false;
53309         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
53310 }
53311
53312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
53313         LDKInitFeatures this_arg_conv;
53314         this_arg_conv.inner = untag_ptr(this_arg);
53315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53317         this_arg_conv.is_owned = false;
53318         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
53319         return ret_conv;
53320 }
53321
53322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53323         LDKNodeFeatures this_arg_conv;
53324         this_arg_conv.inner = untag_ptr(this_arg);
53325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53327         this_arg_conv.is_owned = false;
53328         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
53329 }
53330
53331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53332         LDKNodeFeatures this_arg_conv;
53333         this_arg_conv.inner = untag_ptr(this_arg);
53334         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53336         this_arg_conv.is_owned = false;
53337         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
53338 }
53339
53340 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
53341         LDKNodeFeatures this_arg_conv;
53342         this_arg_conv.inner = untag_ptr(this_arg);
53343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53345         this_arg_conv.is_owned = false;
53346         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
53347         return ret_conv;
53348 }
53349
53350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
53351         LDKInitFeatures this_arg_conv;
53352         this_arg_conv.inner = untag_ptr(this_arg);
53353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53355         this_arg_conv.is_owned = false;
53356         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
53357         return ret_conv;
53358 }
53359
53360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
53361         LDKNodeFeatures this_arg_conv;
53362         this_arg_conv.inner = untag_ptr(this_arg);
53363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53365         this_arg_conv.is_owned = false;
53366         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
53367         return ret_conv;
53368 }
53369
53370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53371         LDKInitFeatures this_arg_conv;
53372         this_arg_conv.inner = untag_ptr(this_arg);
53373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53375         this_arg_conv.is_owned = false;
53376         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
53377 }
53378
53379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53380         LDKInitFeatures this_arg_conv;
53381         this_arg_conv.inner = untag_ptr(this_arg);
53382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53384         this_arg_conv.is_owned = false;
53385         InitFeatures_set_gossip_queries_required(&this_arg_conv);
53386 }
53387
53388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
53389         LDKInitFeatures this_arg_conv;
53390         this_arg_conv.inner = untag_ptr(this_arg);
53391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53393         this_arg_conv.is_owned = false;
53394         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
53395         return ret_conv;
53396 }
53397
53398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53399         LDKNodeFeatures this_arg_conv;
53400         this_arg_conv.inner = untag_ptr(this_arg);
53401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53403         this_arg_conv.is_owned = false;
53404         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
53405 }
53406
53407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53408         LDKNodeFeatures this_arg_conv;
53409         this_arg_conv.inner = untag_ptr(this_arg);
53410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53412         this_arg_conv.is_owned = false;
53413         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
53414 }
53415
53416 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
53417         LDKNodeFeatures this_arg_conv;
53418         this_arg_conv.inner = untag_ptr(this_arg);
53419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53421         this_arg_conv.is_owned = false;
53422         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
53423         return ret_conv;
53424 }
53425
53426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
53427         LDKInitFeatures this_arg_conv;
53428         this_arg_conv.inner = untag_ptr(this_arg);
53429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53431         this_arg_conv.is_owned = false;
53432         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
53433         return ret_conv;
53434 }
53435
53436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
53437         LDKNodeFeatures this_arg_conv;
53438         this_arg_conv.inner = untag_ptr(this_arg);
53439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53441         this_arg_conv.is_owned = false;
53442         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
53443         return ret_conv;
53444 }
53445
53446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53447         LDKInitFeatures this_arg_conv;
53448         this_arg_conv.inner = untag_ptr(this_arg);
53449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53451         this_arg_conv.is_owned = false;
53452         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
53453 }
53454
53455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53456         LDKInitFeatures this_arg_conv;
53457         this_arg_conv.inner = untag_ptr(this_arg);
53458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53460         this_arg_conv.is_owned = false;
53461         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
53462 }
53463
53464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53465         LDKInitFeatures this_arg_conv;
53466         this_arg_conv.inner = untag_ptr(this_arg);
53467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53469         this_arg_conv.is_owned = false;
53470         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
53471         return ret_conv;
53472 }
53473
53474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53475         LDKNodeFeatures this_arg_conv;
53476         this_arg_conv.inner = untag_ptr(this_arg);
53477         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53479         this_arg_conv.is_owned = false;
53480         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
53481 }
53482
53483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53484         LDKNodeFeatures this_arg_conv;
53485         this_arg_conv.inner = untag_ptr(this_arg);
53486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53488         this_arg_conv.is_owned = false;
53489         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
53490 }
53491
53492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53493         LDKNodeFeatures this_arg_conv;
53494         this_arg_conv.inner = untag_ptr(this_arg);
53495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53497         this_arg_conv.is_owned = false;
53498         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
53499         return ret_conv;
53500 }
53501
53502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53503         LDKBolt11InvoiceFeatures this_arg_conv;
53504         this_arg_conv.inner = untag_ptr(this_arg);
53505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53507         this_arg_conv.is_owned = false;
53508         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
53509 }
53510
53511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53512         LDKBolt11InvoiceFeatures this_arg_conv;
53513         this_arg_conv.inner = untag_ptr(this_arg);
53514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53516         this_arg_conv.is_owned = false;
53517         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
53518 }
53519
53520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53521         LDKBolt11InvoiceFeatures this_arg_conv;
53522         this_arg_conv.inner = untag_ptr(this_arg);
53523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53525         this_arg_conv.is_owned = false;
53526         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
53527         return ret_conv;
53528 }
53529
53530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53531         LDKInitFeatures this_arg_conv;
53532         this_arg_conv.inner = untag_ptr(this_arg);
53533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53535         this_arg_conv.is_owned = false;
53536         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
53537         return ret_conv;
53538 }
53539
53540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53541         LDKNodeFeatures this_arg_conv;
53542         this_arg_conv.inner = untag_ptr(this_arg);
53543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53545         this_arg_conv.is_owned = false;
53546         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
53547         return ret_conv;
53548 }
53549
53550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53551         LDKBolt11InvoiceFeatures this_arg_conv;
53552         this_arg_conv.inner = untag_ptr(this_arg);
53553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53555         this_arg_conv.is_owned = false;
53556         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
53557         return ret_conv;
53558 }
53559
53560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53561         LDKInitFeatures this_arg_conv;
53562         this_arg_conv.inner = untag_ptr(this_arg);
53563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53565         this_arg_conv.is_owned = false;
53566         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
53567 }
53568
53569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53570         LDKInitFeatures this_arg_conv;
53571         this_arg_conv.inner = untag_ptr(this_arg);
53572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53574         this_arg_conv.is_owned = false;
53575         InitFeatures_set_static_remote_key_required(&this_arg_conv);
53576 }
53577
53578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53579         LDKInitFeatures this_arg_conv;
53580         this_arg_conv.inner = untag_ptr(this_arg);
53581         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53583         this_arg_conv.is_owned = false;
53584         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
53585         return ret_conv;
53586 }
53587
53588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53589         LDKNodeFeatures this_arg_conv;
53590         this_arg_conv.inner = untag_ptr(this_arg);
53591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53593         this_arg_conv.is_owned = false;
53594         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
53595 }
53596
53597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53598         LDKNodeFeatures this_arg_conv;
53599         this_arg_conv.inner = untag_ptr(this_arg);
53600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53602         this_arg_conv.is_owned = false;
53603         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
53604 }
53605
53606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53607         LDKNodeFeatures this_arg_conv;
53608         this_arg_conv.inner = untag_ptr(this_arg);
53609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53611         this_arg_conv.is_owned = false;
53612         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
53613         return ret_conv;
53614 }
53615
53616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53617         LDKChannelTypeFeatures this_arg_conv;
53618         this_arg_conv.inner = untag_ptr(this_arg);
53619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53621         this_arg_conv.is_owned = false;
53622         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
53623 }
53624
53625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53626         LDKChannelTypeFeatures this_arg_conv;
53627         this_arg_conv.inner = untag_ptr(this_arg);
53628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53630         this_arg_conv.is_owned = false;
53631         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
53632 }
53633
53634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53635         LDKChannelTypeFeatures this_arg_conv;
53636         this_arg_conv.inner = untag_ptr(this_arg);
53637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53639         this_arg_conv.is_owned = false;
53640         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
53641         return ret_conv;
53642 }
53643
53644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53645         LDKInitFeatures this_arg_conv;
53646         this_arg_conv.inner = untag_ptr(this_arg);
53647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53649         this_arg_conv.is_owned = false;
53650         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
53651         return ret_conv;
53652 }
53653
53654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53655         LDKNodeFeatures this_arg_conv;
53656         this_arg_conv.inner = untag_ptr(this_arg);
53657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53659         this_arg_conv.is_owned = false;
53660         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
53661         return ret_conv;
53662 }
53663
53664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53665         LDKChannelTypeFeatures this_arg_conv;
53666         this_arg_conv.inner = untag_ptr(this_arg);
53667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53669         this_arg_conv.is_owned = false;
53670         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
53671         return ret_conv;
53672 }
53673
53674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53675         LDKInitFeatures this_arg_conv;
53676         this_arg_conv.inner = untag_ptr(this_arg);
53677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53679         this_arg_conv.is_owned = false;
53680         InitFeatures_set_payment_secret_optional(&this_arg_conv);
53681 }
53682
53683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53684         LDKInitFeatures this_arg_conv;
53685         this_arg_conv.inner = untag_ptr(this_arg);
53686         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53688         this_arg_conv.is_owned = false;
53689         InitFeatures_set_payment_secret_required(&this_arg_conv);
53690 }
53691
53692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53693         LDKInitFeatures this_arg_conv;
53694         this_arg_conv.inner = untag_ptr(this_arg);
53695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53697         this_arg_conv.is_owned = false;
53698         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
53699         return ret_conv;
53700 }
53701
53702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53703         LDKNodeFeatures this_arg_conv;
53704         this_arg_conv.inner = untag_ptr(this_arg);
53705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53707         this_arg_conv.is_owned = false;
53708         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
53709 }
53710
53711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53712         LDKNodeFeatures this_arg_conv;
53713         this_arg_conv.inner = untag_ptr(this_arg);
53714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53716         this_arg_conv.is_owned = false;
53717         NodeFeatures_set_payment_secret_required(&this_arg_conv);
53718 }
53719
53720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53721         LDKNodeFeatures this_arg_conv;
53722         this_arg_conv.inner = untag_ptr(this_arg);
53723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53725         this_arg_conv.is_owned = false;
53726         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
53727         return ret_conv;
53728 }
53729
53730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53731         LDKBolt11InvoiceFeatures this_arg_conv;
53732         this_arg_conv.inner = untag_ptr(this_arg);
53733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53735         this_arg_conv.is_owned = false;
53736         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
53737 }
53738
53739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53740         LDKBolt11InvoiceFeatures this_arg_conv;
53741         this_arg_conv.inner = untag_ptr(this_arg);
53742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53744         this_arg_conv.is_owned = false;
53745         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
53746 }
53747
53748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53749         LDKBolt11InvoiceFeatures this_arg_conv;
53750         this_arg_conv.inner = untag_ptr(this_arg);
53751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53753         this_arg_conv.is_owned = false;
53754         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
53755         return ret_conv;
53756 }
53757
53758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53759         LDKInitFeatures this_arg_conv;
53760         this_arg_conv.inner = untag_ptr(this_arg);
53761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53763         this_arg_conv.is_owned = false;
53764         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
53765         return ret_conv;
53766 }
53767
53768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53769         LDKNodeFeatures this_arg_conv;
53770         this_arg_conv.inner = untag_ptr(this_arg);
53771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53773         this_arg_conv.is_owned = false;
53774         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
53775         return ret_conv;
53776 }
53777
53778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53779         LDKBolt11InvoiceFeatures this_arg_conv;
53780         this_arg_conv.inner = untag_ptr(this_arg);
53781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53783         this_arg_conv.is_owned = false;
53784         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
53785         return ret_conv;
53786 }
53787
53788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53789         LDKInitFeatures this_arg_conv;
53790         this_arg_conv.inner = untag_ptr(this_arg);
53791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53793         this_arg_conv.is_owned = false;
53794         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
53795 }
53796
53797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53798         LDKInitFeatures this_arg_conv;
53799         this_arg_conv.inner = untag_ptr(this_arg);
53800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53802         this_arg_conv.is_owned = false;
53803         InitFeatures_set_basic_mpp_required(&this_arg_conv);
53804 }
53805
53806 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53807         LDKInitFeatures this_arg_conv;
53808         this_arg_conv.inner = untag_ptr(this_arg);
53809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53811         this_arg_conv.is_owned = false;
53812         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
53813         return ret_conv;
53814 }
53815
53816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53817         LDKNodeFeatures this_arg_conv;
53818         this_arg_conv.inner = untag_ptr(this_arg);
53819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53821         this_arg_conv.is_owned = false;
53822         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
53823 }
53824
53825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53826         LDKNodeFeatures this_arg_conv;
53827         this_arg_conv.inner = untag_ptr(this_arg);
53828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53830         this_arg_conv.is_owned = false;
53831         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
53832 }
53833
53834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53835         LDKNodeFeatures this_arg_conv;
53836         this_arg_conv.inner = untag_ptr(this_arg);
53837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53839         this_arg_conv.is_owned = false;
53840         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
53841         return ret_conv;
53842 }
53843
53844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53845         LDKBolt11InvoiceFeatures this_arg_conv;
53846         this_arg_conv.inner = untag_ptr(this_arg);
53847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53849         this_arg_conv.is_owned = false;
53850         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
53851 }
53852
53853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53854         LDKBolt11InvoiceFeatures this_arg_conv;
53855         this_arg_conv.inner = untag_ptr(this_arg);
53856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53858         this_arg_conv.is_owned = false;
53859         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
53860 }
53861
53862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53863         LDKBolt11InvoiceFeatures this_arg_conv;
53864         this_arg_conv.inner = untag_ptr(this_arg);
53865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53867         this_arg_conv.is_owned = false;
53868         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
53869         return ret_conv;
53870 }
53871
53872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53873         LDKBolt12InvoiceFeatures this_arg_conv;
53874         this_arg_conv.inner = untag_ptr(this_arg);
53875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53877         this_arg_conv.is_owned = false;
53878         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
53879 }
53880
53881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53882         LDKBolt12InvoiceFeatures this_arg_conv;
53883         this_arg_conv.inner = untag_ptr(this_arg);
53884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53886         this_arg_conv.is_owned = false;
53887         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
53888 }
53889
53890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53891         LDKBolt12InvoiceFeatures this_arg_conv;
53892         this_arg_conv.inner = untag_ptr(this_arg);
53893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53895         this_arg_conv.is_owned = false;
53896         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
53897         return ret_conv;
53898 }
53899
53900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53901         LDKInitFeatures this_arg_conv;
53902         this_arg_conv.inner = untag_ptr(this_arg);
53903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53905         this_arg_conv.is_owned = false;
53906         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
53907         return ret_conv;
53908 }
53909
53910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53911         LDKNodeFeatures this_arg_conv;
53912         this_arg_conv.inner = untag_ptr(this_arg);
53913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53915         this_arg_conv.is_owned = false;
53916         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
53917         return ret_conv;
53918 }
53919
53920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53921         LDKBolt11InvoiceFeatures this_arg_conv;
53922         this_arg_conv.inner = untag_ptr(this_arg);
53923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53925         this_arg_conv.is_owned = false;
53926         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
53927         return ret_conv;
53928 }
53929
53930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53931         LDKBolt12InvoiceFeatures this_arg_conv;
53932         this_arg_conv.inner = untag_ptr(this_arg);
53933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53935         this_arg_conv.is_owned = false;
53936         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
53937         return ret_conv;
53938 }
53939
53940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53941         LDKInitFeatures this_arg_conv;
53942         this_arg_conv.inner = untag_ptr(this_arg);
53943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53945         this_arg_conv.is_owned = false;
53946         InitFeatures_set_wumbo_optional(&this_arg_conv);
53947 }
53948
53949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53950         LDKInitFeatures this_arg_conv;
53951         this_arg_conv.inner = untag_ptr(this_arg);
53952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53954         this_arg_conv.is_owned = false;
53955         InitFeatures_set_wumbo_required(&this_arg_conv);
53956 }
53957
53958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
53959         LDKInitFeatures this_arg_conv;
53960         this_arg_conv.inner = untag_ptr(this_arg);
53961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53963         this_arg_conv.is_owned = false;
53964         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
53965         return ret_conv;
53966 }
53967
53968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53969         LDKNodeFeatures this_arg_conv;
53970         this_arg_conv.inner = untag_ptr(this_arg);
53971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53973         this_arg_conv.is_owned = false;
53974         NodeFeatures_set_wumbo_optional(&this_arg_conv);
53975 }
53976
53977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53978         LDKNodeFeatures this_arg_conv;
53979         this_arg_conv.inner = untag_ptr(this_arg);
53980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53982         this_arg_conv.is_owned = false;
53983         NodeFeatures_set_wumbo_required(&this_arg_conv);
53984 }
53985
53986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
53987         LDKNodeFeatures this_arg_conv;
53988         this_arg_conv.inner = untag_ptr(this_arg);
53989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53991         this_arg_conv.is_owned = false;
53992         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
53993         return ret_conv;
53994 }
53995
53996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
53997         LDKInitFeatures this_arg_conv;
53998         this_arg_conv.inner = untag_ptr(this_arg);
53999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54001         this_arg_conv.is_owned = false;
54002         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
54003         return ret_conv;
54004 }
54005
54006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
54007         LDKNodeFeatures this_arg_conv;
54008         this_arg_conv.inner = untag_ptr(this_arg);
54009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54011         this_arg_conv.is_owned = false;
54012         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
54013         return ret_conv;
54014 }
54015
54016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54017         LDKInitFeatures this_arg_conv;
54018         this_arg_conv.inner = untag_ptr(this_arg);
54019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54021         this_arg_conv.is_owned = false;
54022         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
54023 }
54024
54025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54026         LDKInitFeatures this_arg_conv;
54027         this_arg_conv.inner = untag_ptr(this_arg);
54028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54030         this_arg_conv.is_owned = false;
54031         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
54032 }
54033
54034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54035         LDKInitFeatures this_arg_conv;
54036         this_arg_conv.inner = untag_ptr(this_arg);
54037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54039         this_arg_conv.is_owned = false;
54040         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54041         return ret_conv;
54042 }
54043
54044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54045         LDKNodeFeatures this_arg_conv;
54046         this_arg_conv.inner = untag_ptr(this_arg);
54047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54049         this_arg_conv.is_owned = false;
54050         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
54051 }
54052
54053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54054         LDKNodeFeatures this_arg_conv;
54055         this_arg_conv.inner = untag_ptr(this_arg);
54056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54058         this_arg_conv.is_owned = false;
54059         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
54060 }
54061
54062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54063         LDKNodeFeatures this_arg_conv;
54064         this_arg_conv.inner = untag_ptr(this_arg);
54065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54067         this_arg_conv.is_owned = false;
54068         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54069         return ret_conv;
54070 }
54071
54072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54073         LDKChannelTypeFeatures this_arg_conv;
54074         this_arg_conv.inner = untag_ptr(this_arg);
54075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54077         this_arg_conv.is_owned = false;
54078         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
54079 }
54080
54081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54082         LDKChannelTypeFeatures this_arg_conv;
54083         this_arg_conv.inner = untag_ptr(this_arg);
54084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54086         this_arg_conv.is_owned = false;
54087         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
54088 }
54089
54090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54091         LDKChannelTypeFeatures this_arg_conv;
54092         this_arg_conv.inner = untag_ptr(this_arg);
54093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54095         this_arg_conv.is_owned = false;
54096         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54097         return ret_conv;
54098 }
54099
54100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54101         LDKInitFeatures this_arg_conv;
54102         this_arg_conv.inner = untag_ptr(this_arg);
54103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54105         this_arg_conv.is_owned = false;
54106         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54107         return ret_conv;
54108 }
54109
54110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54111         LDKNodeFeatures this_arg_conv;
54112         this_arg_conv.inner = untag_ptr(this_arg);
54113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54115         this_arg_conv.is_owned = false;
54116         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54117         return ret_conv;
54118 }
54119
54120 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54121         LDKChannelTypeFeatures this_arg_conv;
54122         this_arg_conv.inner = untag_ptr(this_arg);
54123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54125         this_arg_conv.is_owned = false;
54126         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54127         return ret_conv;
54128 }
54129
54130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54131         LDKInitFeatures this_arg_conv;
54132         this_arg_conv.inner = untag_ptr(this_arg);
54133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54135         this_arg_conv.is_owned = false;
54136         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
54137 }
54138
54139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54140         LDKInitFeatures this_arg_conv;
54141         this_arg_conv.inner = untag_ptr(this_arg);
54142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54144         this_arg_conv.is_owned = false;
54145         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
54146 }
54147
54148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54149         LDKInitFeatures this_arg_conv;
54150         this_arg_conv.inner = untag_ptr(this_arg);
54151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54153         this_arg_conv.is_owned = false;
54154         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
54155         return ret_conv;
54156 }
54157
54158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54159         LDKNodeFeatures this_arg_conv;
54160         this_arg_conv.inner = untag_ptr(this_arg);
54161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54163         this_arg_conv.is_owned = false;
54164         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
54165 }
54166
54167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54168         LDKNodeFeatures this_arg_conv;
54169         this_arg_conv.inner = untag_ptr(this_arg);
54170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54172         this_arg_conv.is_owned = false;
54173         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
54174 }
54175
54176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54177         LDKNodeFeatures this_arg_conv;
54178         this_arg_conv.inner = untag_ptr(this_arg);
54179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54181         this_arg_conv.is_owned = false;
54182         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
54183         return ret_conv;
54184 }
54185
54186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54187         LDKChannelTypeFeatures this_arg_conv;
54188         this_arg_conv.inner = untag_ptr(this_arg);
54189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54191         this_arg_conv.is_owned = false;
54192         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
54193 }
54194
54195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54196         LDKChannelTypeFeatures this_arg_conv;
54197         this_arg_conv.inner = untag_ptr(this_arg);
54198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54200         this_arg_conv.is_owned = false;
54201         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
54202 }
54203
54204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54205         LDKChannelTypeFeatures this_arg_conv;
54206         this_arg_conv.inner = untag_ptr(this_arg);
54207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54209         this_arg_conv.is_owned = false;
54210         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
54211         return ret_conv;
54212 }
54213
54214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54215         LDKInitFeatures this_arg_conv;
54216         this_arg_conv.inner = untag_ptr(this_arg);
54217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54219         this_arg_conv.is_owned = false;
54220         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
54221         return ret_conv;
54222 }
54223
54224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54225         LDKNodeFeatures this_arg_conv;
54226         this_arg_conv.inner = untag_ptr(this_arg);
54227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54229         this_arg_conv.is_owned = false;
54230         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
54231         return ret_conv;
54232 }
54233
54234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54235         LDKChannelTypeFeatures this_arg_conv;
54236         this_arg_conv.inner = untag_ptr(this_arg);
54237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54239         this_arg_conv.is_owned = false;
54240         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
54241         return ret_conv;
54242 }
54243
54244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54245         LDKInitFeatures this_arg_conv;
54246         this_arg_conv.inner = untag_ptr(this_arg);
54247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54249         this_arg_conv.is_owned = false;
54250         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
54251 }
54252
54253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54254         LDKInitFeatures this_arg_conv;
54255         this_arg_conv.inner = untag_ptr(this_arg);
54256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54258         this_arg_conv.is_owned = false;
54259         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
54260 }
54261
54262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
54263         LDKInitFeatures this_arg_conv;
54264         this_arg_conv.inner = untag_ptr(this_arg);
54265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54267         this_arg_conv.is_owned = false;
54268         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
54269         return ret_conv;
54270 }
54271
54272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54273         LDKNodeFeatures this_arg_conv;
54274         this_arg_conv.inner = untag_ptr(this_arg);
54275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54277         this_arg_conv.is_owned = false;
54278         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
54279 }
54280
54281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54282         LDKNodeFeatures this_arg_conv;
54283         this_arg_conv.inner = untag_ptr(this_arg);
54284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54286         this_arg_conv.is_owned = false;
54287         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
54288 }
54289
54290 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
54291         LDKNodeFeatures this_arg_conv;
54292         this_arg_conv.inner = untag_ptr(this_arg);
54293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54295         this_arg_conv.is_owned = false;
54296         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
54297         return ret_conv;
54298 }
54299
54300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
54301         LDKInitFeatures this_arg_conv;
54302         this_arg_conv.inner = untag_ptr(this_arg);
54303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54305         this_arg_conv.is_owned = false;
54306         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
54307         return ret_conv;
54308 }
54309
54310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
54311         LDKNodeFeatures this_arg_conv;
54312         this_arg_conv.inner = untag_ptr(this_arg);
54313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54315         this_arg_conv.is_owned = false;
54316         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
54317         return ret_conv;
54318 }
54319
54320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54321         LDKInitFeatures this_arg_conv;
54322         this_arg_conv.inner = untag_ptr(this_arg);
54323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54325         this_arg_conv.is_owned = false;
54326         InitFeatures_set_onion_messages_optional(&this_arg_conv);
54327 }
54328
54329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54330         LDKInitFeatures this_arg_conv;
54331         this_arg_conv.inner = untag_ptr(this_arg);
54332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54334         this_arg_conv.is_owned = false;
54335         InitFeatures_set_onion_messages_required(&this_arg_conv);
54336 }
54337
54338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
54339         LDKInitFeatures this_arg_conv;
54340         this_arg_conv.inner = untag_ptr(this_arg);
54341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54343         this_arg_conv.is_owned = false;
54344         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
54345         return ret_conv;
54346 }
54347
54348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54349         LDKNodeFeatures this_arg_conv;
54350         this_arg_conv.inner = untag_ptr(this_arg);
54351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54353         this_arg_conv.is_owned = false;
54354         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
54355 }
54356
54357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54358         LDKNodeFeatures this_arg_conv;
54359         this_arg_conv.inner = untag_ptr(this_arg);
54360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54362         this_arg_conv.is_owned = false;
54363         NodeFeatures_set_onion_messages_required(&this_arg_conv);
54364 }
54365
54366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
54367         LDKNodeFeatures this_arg_conv;
54368         this_arg_conv.inner = untag_ptr(this_arg);
54369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54371         this_arg_conv.is_owned = false;
54372         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
54373         return ret_conv;
54374 }
54375
54376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
54377         LDKInitFeatures this_arg_conv;
54378         this_arg_conv.inner = untag_ptr(this_arg);
54379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54381         this_arg_conv.is_owned = false;
54382         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
54383         return ret_conv;
54384 }
54385
54386 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
54387         LDKNodeFeatures this_arg_conv;
54388         this_arg_conv.inner = untag_ptr(this_arg);
54389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54391         this_arg_conv.is_owned = false;
54392         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
54393         return ret_conv;
54394 }
54395
54396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54397         LDKInitFeatures this_arg_conv;
54398         this_arg_conv.inner = untag_ptr(this_arg);
54399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54401         this_arg_conv.is_owned = false;
54402         InitFeatures_set_channel_type_optional(&this_arg_conv);
54403 }
54404
54405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54406         LDKInitFeatures this_arg_conv;
54407         this_arg_conv.inner = untag_ptr(this_arg);
54408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54410         this_arg_conv.is_owned = false;
54411         InitFeatures_set_channel_type_required(&this_arg_conv);
54412 }
54413
54414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
54415         LDKInitFeatures this_arg_conv;
54416         this_arg_conv.inner = untag_ptr(this_arg);
54417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54419         this_arg_conv.is_owned = false;
54420         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
54421         return ret_conv;
54422 }
54423
54424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54425         LDKNodeFeatures this_arg_conv;
54426         this_arg_conv.inner = untag_ptr(this_arg);
54427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54429         this_arg_conv.is_owned = false;
54430         NodeFeatures_set_channel_type_optional(&this_arg_conv);
54431 }
54432
54433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54434         LDKNodeFeatures this_arg_conv;
54435         this_arg_conv.inner = untag_ptr(this_arg);
54436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54438         this_arg_conv.is_owned = false;
54439         NodeFeatures_set_channel_type_required(&this_arg_conv);
54440 }
54441
54442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
54443         LDKNodeFeatures this_arg_conv;
54444         this_arg_conv.inner = untag_ptr(this_arg);
54445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54447         this_arg_conv.is_owned = false;
54448         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
54449         return ret_conv;
54450 }
54451
54452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
54453         LDKInitFeatures this_arg_conv;
54454         this_arg_conv.inner = untag_ptr(this_arg);
54455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54457         this_arg_conv.is_owned = false;
54458         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
54459         return ret_conv;
54460 }
54461
54462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
54463         LDKNodeFeatures this_arg_conv;
54464         this_arg_conv.inner = untag_ptr(this_arg);
54465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54467         this_arg_conv.is_owned = false;
54468         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
54469         return ret_conv;
54470 }
54471
54472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54473         LDKInitFeatures this_arg_conv;
54474         this_arg_conv.inner = untag_ptr(this_arg);
54475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54477         this_arg_conv.is_owned = false;
54478         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
54479 }
54480
54481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54482         LDKInitFeatures this_arg_conv;
54483         this_arg_conv.inner = untag_ptr(this_arg);
54484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54486         this_arg_conv.is_owned = false;
54487         InitFeatures_set_scid_privacy_required(&this_arg_conv);
54488 }
54489
54490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54491         LDKInitFeatures this_arg_conv;
54492         this_arg_conv.inner = untag_ptr(this_arg);
54493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54495         this_arg_conv.is_owned = false;
54496         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
54497         return ret_conv;
54498 }
54499
54500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54501         LDKNodeFeatures this_arg_conv;
54502         this_arg_conv.inner = untag_ptr(this_arg);
54503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54505         this_arg_conv.is_owned = false;
54506         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
54507 }
54508
54509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54510         LDKNodeFeatures this_arg_conv;
54511         this_arg_conv.inner = untag_ptr(this_arg);
54512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54514         this_arg_conv.is_owned = false;
54515         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
54516 }
54517
54518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54519         LDKNodeFeatures this_arg_conv;
54520         this_arg_conv.inner = untag_ptr(this_arg);
54521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54523         this_arg_conv.is_owned = false;
54524         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
54525         return ret_conv;
54526 }
54527
54528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54529         LDKChannelTypeFeatures this_arg_conv;
54530         this_arg_conv.inner = untag_ptr(this_arg);
54531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54533         this_arg_conv.is_owned = false;
54534         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
54535 }
54536
54537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54538         LDKChannelTypeFeatures this_arg_conv;
54539         this_arg_conv.inner = untag_ptr(this_arg);
54540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54542         this_arg_conv.is_owned = false;
54543         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
54544 }
54545
54546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54547         LDKChannelTypeFeatures this_arg_conv;
54548         this_arg_conv.inner = untag_ptr(this_arg);
54549         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54551         this_arg_conv.is_owned = false;
54552         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
54553         return ret_conv;
54554 }
54555
54556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54557         LDKInitFeatures this_arg_conv;
54558         this_arg_conv.inner = untag_ptr(this_arg);
54559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54561         this_arg_conv.is_owned = false;
54562         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
54563         return ret_conv;
54564 }
54565
54566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54567         LDKNodeFeatures this_arg_conv;
54568         this_arg_conv.inner = untag_ptr(this_arg);
54569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54571         this_arg_conv.is_owned = false;
54572         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
54573         return ret_conv;
54574 }
54575
54576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54577         LDKChannelTypeFeatures this_arg_conv;
54578         this_arg_conv.inner = untag_ptr(this_arg);
54579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54581         this_arg_conv.is_owned = false;
54582         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
54583         return ret_conv;
54584 }
54585
54586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54587         LDKBolt11InvoiceFeatures this_arg_conv;
54588         this_arg_conv.inner = untag_ptr(this_arg);
54589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54591         this_arg_conv.is_owned = false;
54592         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
54593 }
54594
54595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54596         LDKBolt11InvoiceFeatures this_arg_conv;
54597         this_arg_conv.inner = untag_ptr(this_arg);
54598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54600         this_arg_conv.is_owned = false;
54601         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
54602 }
54603
54604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
54605         LDKBolt11InvoiceFeatures this_arg_conv;
54606         this_arg_conv.inner = untag_ptr(this_arg);
54607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54609         this_arg_conv.is_owned = false;
54610         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
54611         return ret_conv;
54612 }
54613
54614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
54615         LDKBolt11InvoiceFeatures this_arg_conv;
54616         this_arg_conv.inner = untag_ptr(this_arg);
54617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54619         this_arg_conv.is_owned = false;
54620         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
54621         return ret_conv;
54622 }
54623
54624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54625         LDKInitFeatures this_arg_conv;
54626         this_arg_conv.inner = untag_ptr(this_arg);
54627         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54629         this_arg_conv.is_owned = false;
54630         InitFeatures_set_zero_conf_optional(&this_arg_conv);
54631 }
54632
54633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54634         LDKInitFeatures this_arg_conv;
54635         this_arg_conv.inner = untag_ptr(this_arg);
54636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54638         this_arg_conv.is_owned = false;
54639         InitFeatures_set_zero_conf_required(&this_arg_conv);
54640 }
54641
54642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54643         LDKInitFeatures this_arg_conv;
54644         this_arg_conv.inner = untag_ptr(this_arg);
54645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54647         this_arg_conv.is_owned = false;
54648         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
54649         return ret_conv;
54650 }
54651
54652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54653         LDKNodeFeatures this_arg_conv;
54654         this_arg_conv.inner = untag_ptr(this_arg);
54655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54657         this_arg_conv.is_owned = false;
54658         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
54659 }
54660
54661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54662         LDKNodeFeatures this_arg_conv;
54663         this_arg_conv.inner = untag_ptr(this_arg);
54664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54666         this_arg_conv.is_owned = false;
54667         NodeFeatures_set_zero_conf_required(&this_arg_conv);
54668 }
54669
54670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54671         LDKNodeFeatures this_arg_conv;
54672         this_arg_conv.inner = untag_ptr(this_arg);
54673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54675         this_arg_conv.is_owned = false;
54676         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
54677         return ret_conv;
54678 }
54679
54680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54681         LDKChannelTypeFeatures this_arg_conv;
54682         this_arg_conv.inner = untag_ptr(this_arg);
54683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54685         this_arg_conv.is_owned = false;
54686         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
54687 }
54688
54689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54690         LDKChannelTypeFeatures this_arg_conv;
54691         this_arg_conv.inner = untag_ptr(this_arg);
54692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54694         this_arg_conv.is_owned = false;
54695         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
54696 }
54697
54698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54699         LDKChannelTypeFeatures this_arg_conv;
54700         this_arg_conv.inner = untag_ptr(this_arg);
54701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54703         this_arg_conv.is_owned = false;
54704         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
54705         return ret_conv;
54706 }
54707
54708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54709         LDKInitFeatures this_arg_conv;
54710         this_arg_conv.inner = untag_ptr(this_arg);
54711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54713         this_arg_conv.is_owned = false;
54714         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
54715         return ret_conv;
54716 }
54717
54718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54719         LDKNodeFeatures this_arg_conv;
54720         this_arg_conv.inner = untag_ptr(this_arg);
54721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54723         this_arg_conv.is_owned = false;
54724         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
54725         return ret_conv;
54726 }
54727
54728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54729         LDKChannelTypeFeatures this_arg_conv;
54730         this_arg_conv.inner = untag_ptr(this_arg);
54731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54733         this_arg_conv.is_owned = false;
54734         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
54735         return ret_conv;
54736 }
54737
54738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54739         LDKNodeFeatures this_arg_conv;
54740         this_arg_conv.inner = untag_ptr(this_arg);
54741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54743         this_arg_conv.is_owned = false;
54744         NodeFeatures_set_keysend_optional(&this_arg_conv);
54745 }
54746
54747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54748         LDKNodeFeatures this_arg_conv;
54749         this_arg_conv.inner = untag_ptr(this_arg);
54750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54752         this_arg_conv.is_owned = false;
54753         NodeFeatures_set_keysend_required(&this_arg_conv);
54754 }
54755
54756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
54757         LDKNodeFeatures this_arg_conv;
54758         this_arg_conv.inner = untag_ptr(this_arg);
54759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54761         this_arg_conv.is_owned = false;
54762         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
54763         return ret_conv;
54764 }
54765
54766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
54767         LDKNodeFeatures this_arg_conv;
54768         this_arg_conv.inner = untag_ptr(this_arg);
54769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54771         this_arg_conv.is_owned = false;
54772         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
54773         return ret_conv;
54774 }
54775
54776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54777         LDKShutdownScript this_obj_conv;
54778         this_obj_conv.inner = untag_ptr(this_obj);
54779         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54781         ShutdownScript_free(this_obj_conv);
54782 }
54783
54784 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
54785         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
54786         int64_t ret_ref = 0;
54787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54789         return ret_ref;
54790 }
54791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54792         LDKShutdownScript arg_conv;
54793         arg_conv.inner = untag_ptr(arg);
54794         arg_conv.is_owned = ptr_is_owned(arg);
54795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54796         arg_conv.is_owned = false;
54797         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
54798         return ret_conv;
54799 }
54800
54801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54802         LDKShutdownScript orig_conv;
54803         orig_conv.inner = untag_ptr(orig);
54804         orig_conv.is_owned = ptr_is_owned(orig);
54805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54806         orig_conv.is_owned = false;
54807         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
54808         int64_t ret_ref = 0;
54809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54811         return ret_ref;
54812 }
54813
54814 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54815         LDKShutdownScript a_conv;
54816         a_conv.inner = untag_ptr(a);
54817         a_conv.is_owned = ptr_is_owned(a);
54818         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54819         a_conv.is_owned = false;
54820         LDKShutdownScript b_conv;
54821         b_conv.inner = untag_ptr(b);
54822         b_conv.is_owned = ptr_is_owned(b);
54823         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54824         b_conv.is_owned = false;
54825         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
54826         return ret_conv;
54827 }
54828
54829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54830         LDKInvalidShutdownScript this_obj_conv;
54831         this_obj_conv.inner = untag_ptr(this_obj);
54832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54834         InvalidShutdownScript_free(this_obj_conv);
54835 }
54836
54837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
54838         LDKInvalidShutdownScript this_ptr_conv;
54839         this_ptr_conv.inner = untag_ptr(this_ptr);
54840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54842         this_ptr_conv.is_owned = false;
54843         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
54844         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54845         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54846         return ret_arr;
54847 }
54848
54849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54850         LDKInvalidShutdownScript this_ptr_conv;
54851         this_ptr_conv.inner = untag_ptr(this_ptr);
54852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54854         this_ptr_conv.is_owned = false;
54855         LDKCVec_u8Z val_ref;
54856         val_ref.datalen = (*env)->GetArrayLength(env, val);
54857         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54858         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54859         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
54860 }
54861
54862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
54863         LDKCVec_u8Z script_arg_ref;
54864         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
54865         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54866         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
54867         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
54868         int64_t ret_ref = 0;
54869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54871         return ret_ref;
54872 }
54873
54874 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
54875         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
54876         int64_t ret_ref = 0;
54877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54879         return ret_ref;
54880 }
54881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54882         LDKInvalidShutdownScript arg_conv;
54883         arg_conv.inner = untag_ptr(arg);
54884         arg_conv.is_owned = ptr_is_owned(arg);
54885         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54886         arg_conv.is_owned = false;
54887         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
54888         return ret_conv;
54889 }
54890
54891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54892         LDKInvalidShutdownScript orig_conv;
54893         orig_conv.inner = untag_ptr(orig);
54894         orig_conv.is_owned = ptr_is_owned(orig);
54895         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54896         orig_conv.is_owned = false;
54897         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
54898         int64_t ret_ref = 0;
54899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54901         return ret_ref;
54902 }
54903
54904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
54905         LDKShutdownScript obj_conv;
54906         obj_conv.inner = untag_ptr(obj);
54907         obj_conv.is_owned = ptr_is_owned(obj);
54908         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54909         obj_conv.is_owned = false;
54910         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
54911         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54912         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54913         CVec_u8Z_free(ret_var);
54914         return ret_arr;
54915 }
54916
54917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54918         LDKu8slice ser_ref;
54919         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54920         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54921         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
54922         *ret_conv = ShutdownScript_read(ser_ref);
54923         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54924         return tag_ptr(ret_conv, true);
54925 }
54926
54927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
54928         uint8_t pubkey_hash_arr[20];
54929         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
54930         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
54931         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
54932         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
54933         int64_t ret_ref = 0;
54934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54936         return ret_ref;
54937 }
54938
54939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
54940         uint8_t script_hash_arr[32];
54941         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
54942         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
54943         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
54944         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
54945         int64_t ret_ref = 0;
54946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54948         return ret_ref;
54949 }
54950
54951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
54952         
54953         LDKu8slice program_ref;
54954         program_ref.datalen = (*env)->GetArrayLength(env, program);
54955         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
54956         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
54957         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
54958         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
54959         return tag_ptr(ret_conv, true);
54960 }
54961
54962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
54963         LDKShutdownScript this_arg_conv;
54964         this_arg_conv.inner = untag_ptr(this_arg);
54965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54967         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
54968         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
54969         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54970         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54971         CVec_u8Z_free(ret_var);
54972         return ret_arr;
54973 }
54974
54975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
54976         LDKShutdownScript this_arg_conv;
54977         this_arg_conv.inner = untag_ptr(this_arg);
54978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54980         this_arg_conv.is_owned = false;
54981         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
54982         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
54983         return ret_arr;
54984 }
54985
54986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
54987         LDKShutdownScript this_arg_conv;
54988         this_arg_conv.inner = untag_ptr(this_arg);
54989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54991         this_arg_conv.is_owned = false;
54992         LDKInitFeatures features_conv;
54993         features_conv.inner = untag_ptr(features);
54994         features_conv.is_owned = ptr_is_owned(features);
54995         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
54996         features_conv.is_owned = false;
54997         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
54998         return ret_conv;
54999 }
55000
55001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55002         if (!ptr_is_owned(this_ptr)) return;
55003         void* this_ptr_ptr = untag_ptr(this_ptr);
55004         CHECK_ACCESS(this_ptr_ptr);
55005         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
55006         FREE(untag_ptr(this_ptr));
55007         Retry_free(this_ptr_conv);
55008 }
55009
55010 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
55011         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
55012         *ret_copy = Retry_clone(arg);
55013         int64_t ret_ref = tag_ptr(ret_copy, true);
55014         return ret_ref;
55015 }
55016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55017         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
55018         int64_t ret_conv = Retry_clone_ptr(arg_conv);
55019         return ret_conv;
55020 }
55021
55022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55023         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
55024         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
55025         *ret_copy = Retry_clone(orig_conv);
55026         int64_t ret_ref = tag_ptr(ret_copy, true);
55027         return ret_ref;
55028 }
55029
55030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
55031         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
55032         *ret_copy = Retry_attempts(a);
55033         int64_t ret_ref = tag_ptr(ret_copy, true);
55034         return ret_ref;
55035 }
55036
55037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
55038         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
55039         *ret_copy = Retry_timeout(a);
55040         int64_t ret_ref = tag_ptr(ret_copy, true);
55041         return ret_ref;
55042 }
55043
55044 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55045         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
55046         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
55047         jboolean ret_conv = Retry_eq(a_conv, b_conv);
55048         return ret_conv;
55049 }
55050
55051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
55052         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
55053         int64_t ret_conv = Retry_hash(o_conv);
55054         return ret_conv;
55055 }
55056
55057 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55058         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
55059         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
55060         return ret_conv;
55061 }
55062
55063 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
55064         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
55065         return ret_conv;
55066 }
55067
55068 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
55069         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
55070         return ret_conv;
55071 }
55072
55073 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
55074         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
55075         return ret_conv;
55076 }
55077
55078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55079         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
55080         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
55081         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
55082         return ret_conv;
55083 }
55084
55085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55086         if (!ptr_is_owned(this_ptr)) return;
55087         void* this_ptr_ptr = untag_ptr(this_ptr);
55088         CHECK_ACCESS(this_ptr_ptr);
55089         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
55090         FREE(untag_ptr(this_ptr));
55091         PaymentSendFailure_free(this_ptr_conv);
55092 }
55093
55094 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
55095         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55096         *ret_copy = PaymentSendFailure_clone(arg);
55097         int64_t ret_ref = tag_ptr(ret_copy, true);
55098         return ret_ref;
55099 }
55100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55101         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
55102         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
55103         return ret_conv;
55104 }
55105
55106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55107         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
55108         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55109         *ret_copy = PaymentSendFailure_clone(orig_conv);
55110         int64_t ret_ref = tag_ptr(ret_copy, true);
55111         return ret_ref;
55112 }
55113
55114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
55115         void* a_ptr = untag_ptr(a);
55116         CHECK_ACCESS(a_ptr);
55117         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
55118         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
55119         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55120         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
55121         int64_t ret_ref = tag_ptr(ret_copy, true);
55122         return ret_ref;
55123 }
55124
55125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
55126         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
55127         a_constr.datalen = (*env)->GetArrayLength(env, a);
55128         if (a_constr.datalen > 0)
55129                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
55130         else
55131                 a_constr.data = NULL;
55132         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
55133         for (size_t w = 0; w < a_constr.datalen; w++) {
55134                 int64_t a_conv_22 = a_vals[w];
55135                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
55136                 CHECK_ACCESS(a_conv_22_ptr);
55137                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
55138                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
55139                 a_constr.data[w] = a_conv_22_conv;
55140         }
55141         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
55142         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55143         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
55144         int64_t ret_ref = tag_ptr(ret_copy, true);
55145         return ret_ref;
55146 }
55147
55148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
55149         LDKCVec_APIErrorZ a_constr;
55150         a_constr.datalen = (*env)->GetArrayLength(env, a);
55151         if (a_constr.datalen > 0)
55152                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
55153         else
55154                 a_constr.data = NULL;
55155         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
55156         for (size_t k = 0; k < a_constr.datalen; k++) {
55157                 int64_t a_conv_10 = a_vals[k];
55158                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
55159                 CHECK_ACCESS(a_conv_10_ptr);
55160                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
55161                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
55162                 a_constr.data[k] = a_conv_10_conv;
55163         }
55164         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
55165         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55166         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
55167         int64_t ret_ref = tag_ptr(ret_copy, true);
55168         return ret_ref;
55169 }
55170
55171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
55172         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55173         *ret_copy = PaymentSendFailure_duplicate_payment();
55174         int64_t ret_ref = tag_ptr(ret_copy, true);
55175         return ret_ref;
55176 }
55177
55178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
55179         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
55180         results_constr.datalen = (*env)->GetArrayLength(env, results);
55181         if (results_constr.datalen > 0)
55182                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
55183         else
55184                 results_constr.data = NULL;
55185         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
55186         for (size_t w = 0; w < results_constr.datalen; w++) {
55187                 int64_t results_conv_22 = results_vals[w];
55188                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
55189                 CHECK_ACCESS(results_conv_22_ptr);
55190                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
55191                 results_constr.data[w] = results_conv_22_conv;
55192         }
55193         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
55194         LDKRouteParameters failed_paths_retry_conv;
55195         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
55196         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
55197         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
55198         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
55199         LDKThirtyTwoBytes payment_id_ref;
55200         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
55201         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
55202         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55203         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
55204         int64_t ret_ref = tag_ptr(ret_copy, true);
55205         return ret_ref;
55206 }
55207
55208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55209         LDKRecipientOnionFields this_obj_conv;
55210         this_obj_conv.inner = untag_ptr(this_obj);
55211         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55213         RecipientOnionFields_free(this_obj_conv);
55214 }
55215
55216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
55217         LDKRecipientOnionFields this_ptr_conv;
55218         this_ptr_conv.inner = untag_ptr(this_ptr);
55219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55221         this_ptr_conv.is_owned = false;
55222         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
55223         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
55224         int64_t ret_ref = tag_ptr(ret_copy, true);
55225         return ret_ref;
55226 }
55227
55228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55229         LDKRecipientOnionFields this_ptr_conv;
55230         this_ptr_conv.inner = untag_ptr(this_ptr);
55231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55233         this_ptr_conv.is_owned = false;
55234         void* val_ptr = untag_ptr(val);
55235         CHECK_ACCESS(val_ptr);
55236         LDKCOption_PaymentSecretZ val_conv = *(LDKCOption_PaymentSecretZ*)(val_ptr);
55237         val_conv = COption_PaymentSecretZ_clone((LDKCOption_PaymentSecretZ*)untag_ptr(val));
55238         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
55239 }
55240
55241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
55242         LDKRecipientOnionFields this_ptr_conv;
55243         this_ptr_conv.inner = untag_ptr(this_ptr);
55244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55246         this_ptr_conv.is_owned = false;
55247         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
55248         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
55249         int64_t ret_ref = tag_ptr(ret_copy, true);
55250         return ret_ref;
55251 }
55252
55253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55254         LDKRecipientOnionFields this_ptr_conv;
55255         this_ptr_conv.inner = untag_ptr(this_ptr);
55256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55258         this_ptr_conv.is_owned = false;
55259         void* val_ptr = untag_ptr(val);
55260         CHECK_ACCESS(val_ptr);
55261         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
55262         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
55263         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
55264 }
55265
55266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1new(JNIEnv *env, jclass clz, int64_t payment_secret_arg, int64_t payment_metadata_arg) {
55267         void* payment_secret_arg_ptr = untag_ptr(payment_secret_arg);
55268         CHECK_ACCESS(payment_secret_arg_ptr);
55269         LDKCOption_PaymentSecretZ payment_secret_arg_conv = *(LDKCOption_PaymentSecretZ*)(payment_secret_arg_ptr);
55270         payment_secret_arg_conv = COption_PaymentSecretZ_clone((LDKCOption_PaymentSecretZ*)untag_ptr(payment_secret_arg));
55271         void* payment_metadata_arg_ptr = untag_ptr(payment_metadata_arg);
55272         CHECK_ACCESS(payment_metadata_arg_ptr);
55273         LDKCOption_CVec_u8ZZ payment_metadata_arg_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_arg_ptr);
55274         payment_metadata_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata_arg));
55275         LDKRecipientOnionFields ret_var = RecipientOnionFields_new(payment_secret_arg_conv, payment_metadata_arg_conv);
55276         int64_t ret_ref = 0;
55277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55279         return ret_ref;
55280 }
55281
55282 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
55283         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
55284         int64_t ret_ref = 0;
55285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55287         return ret_ref;
55288 }
55289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55290         LDKRecipientOnionFields arg_conv;
55291         arg_conv.inner = untag_ptr(arg);
55292         arg_conv.is_owned = ptr_is_owned(arg);
55293         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55294         arg_conv.is_owned = false;
55295         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
55296         return ret_conv;
55297 }
55298
55299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55300         LDKRecipientOnionFields orig_conv;
55301         orig_conv.inner = untag_ptr(orig);
55302         orig_conv.is_owned = ptr_is_owned(orig);
55303         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55304         orig_conv.is_owned = false;
55305         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
55306         int64_t ret_ref = 0;
55307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55309         return ret_ref;
55310 }
55311
55312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55313         LDKRecipientOnionFields a_conv;
55314         a_conv.inner = untag_ptr(a);
55315         a_conv.is_owned = ptr_is_owned(a);
55316         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55317         a_conv.is_owned = false;
55318         LDKRecipientOnionFields b_conv;
55319         b_conv.inner = untag_ptr(b);
55320         b_conv.is_owned = ptr_is_owned(b);
55321         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55322         b_conv.is_owned = false;
55323         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
55324         return ret_conv;
55325 }
55326
55327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
55328         LDKRecipientOnionFields obj_conv;
55329         obj_conv.inner = untag_ptr(obj);
55330         obj_conv.is_owned = ptr_is_owned(obj);
55331         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55332         obj_conv.is_owned = false;
55333         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
55334         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55335         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55336         CVec_u8Z_free(ret_var);
55337         return ret_arr;
55338 }
55339
55340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55341         LDKu8slice ser_ref;
55342         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55343         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55344         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
55345         *ret_conv = RecipientOnionFields_read(ser_ref);
55346         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55347         return tag_ptr(ret_conv, true);
55348 }
55349
55350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
55351         LDKThirtyTwoBytes payment_secret_ref;
55352         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
55353         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
55354         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
55355         int64_t ret_ref = 0;
55356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55358         return ret_ref;
55359 }
55360
55361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
55362         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
55363         int64_t ret_ref = 0;
55364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55366         return ret_ref;
55367 }
55368
55369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55370         if (!ptr_is_owned(this_ptr)) return;
55371         void* this_ptr_ptr = untag_ptr(this_ptr);
55372         CHECK_ACCESS(this_ptr_ptr);
55373         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
55374         FREE(untag_ptr(this_ptr));
55375         CustomMessageReader_free(this_ptr_conv);
55376 }
55377
55378 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
55379         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
55380         *ret_ret = Type_clone(arg);
55381         return tag_ptr(ret_ret, true);
55382 }
55383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55384         void* arg_ptr = untag_ptr(arg);
55385         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
55386         LDKType* arg_conv = (LDKType*)arg_ptr;
55387         int64_t ret_conv = Type_clone_ptr(arg_conv);
55388         return ret_conv;
55389 }
55390
55391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55392         void* orig_ptr = untag_ptr(orig);
55393         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
55394         LDKType* orig_conv = (LDKType*)orig_ptr;
55395         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
55396         *ret_ret = Type_clone(orig_conv);
55397         return tag_ptr(ret_ret, true);
55398 }
55399
55400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55401         if (!ptr_is_owned(this_ptr)) return;
55402         void* this_ptr_ptr = untag_ptr(this_ptr);
55403         CHECK_ACCESS(this_ptr_ptr);
55404         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
55405         FREE(untag_ptr(this_ptr));
55406         Type_free(this_ptr_conv);
55407 }
55408
55409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55410         LDKUnsignedBolt12Invoice this_obj_conv;
55411         this_obj_conv.inner = untag_ptr(this_obj);
55412         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55414         UnsignedBolt12Invoice_free(this_obj_conv);
55415 }
55416
55417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
55418         LDKUnsignedBolt12Invoice this_arg_conv;
55419         this_arg_conv.inner = untag_ptr(this_arg);
55420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55422         this_arg_conv.is_owned = false;
55423         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
55424         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
55425         return ret_arr;
55426 }
55427
55428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55429         LDKBolt12Invoice this_obj_conv;
55430         this_obj_conv.inner = untag_ptr(this_obj);
55431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55433         Bolt12Invoice_free(this_obj_conv);
55434 }
55435
55436 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
55437         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
55438         int64_t ret_ref = 0;
55439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55441         return ret_ref;
55442 }
55443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55444         LDKBolt12Invoice arg_conv;
55445         arg_conv.inner = untag_ptr(arg);
55446         arg_conv.is_owned = ptr_is_owned(arg);
55447         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55448         arg_conv.is_owned = false;
55449         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
55450         return ret_conv;
55451 }
55452
55453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55454         LDKBolt12Invoice orig_conv;
55455         orig_conv.inner = untag_ptr(orig);
55456         orig_conv.is_owned = ptr_is_owned(orig);
55457         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55458         orig_conv.is_owned = false;
55459         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
55460         int64_t ret_ref = 0;
55461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55463         return ret_ref;
55464 }
55465
55466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
55467         LDKBolt12Invoice this_arg_conv;
55468         this_arg_conv.inner = untag_ptr(this_arg);
55469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55471         this_arg_conv.is_owned = false;
55472         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
55473         int64_t ret_ref = 0;
55474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55476         return ret_ref;
55477 }
55478
55479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
55480         LDKBolt12Invoice this_arg_conv;
55481         this_arg_conv.inner = untag_ptr(this_arg);
55482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55484         this_arg_conv.is_owned = false;
55485         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
55486         return ret_conv;
55487 }
55488
55489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
55490         LDKBolt12Invoice this_arg_conv;
55491         this_arg_conv.inner = untag_ptr(this_arg);
55492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55494         this_arg_conv.is_owned = false;
55495         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
55496         return ret_conv;
55497 }
55498
55499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
55500         LDKBolt12Invoice this_arg_conv;
55501         this_arg_conv.inner = untag_ptr(this_arg);
55502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55504         this_arg_conv.is_owned = false;
55505         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
55506         return ret_conv;
55507 }
55508
55509 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
55510         LDKBolt12Invoice this_arg_conv;
55511         this_arg_conv.inner = untag_ptr(this_arg);
55512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55514         this_arg_conv.is_owned = false;
55515         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55516         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
55517         return ret_arr;
55518 }
55519
55520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
55521         LDKBolt12Invoice this_arg_conv;
55522         this_arg_conv.inner = untag_ptr(this_arg);
55523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55525         this_arg_conv.is_owned = false;
55526         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
55527         return ret_conv;
55528 }
55529
55530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
55531         LDKBolt12Invoice this_arg_conv;
55532         this_arg_conv.inner = untag_ptr(this_arg);
55533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55535         this_arg_conv.is_owned = false;
55536         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_features(&this_arg_conv);
55537         int64_t ret_ref = 0;
55538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55540         return ret_ref;
55541 }
55542
55543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
55544         LDKBolt12Invoice this_arg_conv;
55545         this_arg_conv.inner = untag_ptr(this_arg);
55546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55548         this_arg_conv.is_owned = false;
55549         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
55550         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
55551         return ret_arr;
55552 }
55553
55554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
55555         LDKBolt12Invoice this_arg_conv;
55556         this_arg_conv.inner = untag_ptr(this_arg);
55557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55559         this_arg_conv.is_owned = false;
55560         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55561         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
55562         return ret_arr;
55563 }
55564
55565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
55566         LDKBolt12Invoice this_arg_conv;
55567         this_arg_conv.inner = untag_ptr(this_arg);
55568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55570         this_arg_conv.is_owned = false;
55571         LDKExpandedKey key_conv;
55572         key_conv.inner = untag_ptr(key);
55573         key_conv.is_owned = ptr_is_owned(key);
55574         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
55575         key_conv.is_owned = false;
55576         jboolean ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
55577         return ret_conv;
55578 }
55579
55580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
55581         LDKBolt12Invoice obj_conv;
55582         obj_conv.inner = untag_ptr(obj);
55583         obj_conv.is_owned = ptr_is_owned(obj);
55584         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55585         obj_conv.is_owned = false;
55586         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
55587         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55588         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55589         CVec_u8Z_free(ret_var);
55590         return ret_arr;
55591 }
55592
55593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55594         LDKBlindedPayInfo this_obj_conv;
55595         this_obj_conv.inner = untag_ptr(this_obj);
55596         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55598         BlindedPayInfo_free(this_obj_conv);
55599 }
55600
55601 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55602         LDKBlindedPayInfo this_ptr_conv;
55603         this_ptr_conv.inner = untag_ptr(this_ptr);
55604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55606         this_ptr_conv.is_owned = false;
55607         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
55608         return ret_conv;
55609 }
55610
55611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55612         LDKBlindedPayInfo this_ptr_conv;
55613         this_ptr_conv.inner = untag_ptr(this_ptr);
55614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55616         this_ptr_conv.is_owned = false;
55617         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
55618 }
55619
55620 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
55621         LDKBlindedPayInfo this_ptr_conv;
55622         this_ptr_conv.inner = untag_ptr(this_ptr);
55623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55625         this_ptr_conv.is_owned = false;
55626         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
55627         return ret_conv;
55628 }
55629
55630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55631         LDKBlindedPayInfo this_ptr_conv;
55632         this_ptr_conv.inner = untag_ptr(this_ptr);
55633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55635         this_ptr_conv.is_owned = false;
55636         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
55637 }
55638
55639 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
55640         LDKBlindedPayInfo this_ptr_conv;
55641         this_ptr_conv.inner = untag_ptr(this_ptr);
55642         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55644         this_ptr_conv.is_owned = false;
55645         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
55646         return ret_conv;
55647 }
55648
55649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
55650         LDKBlindedPayInfo this_ptr_conv;
55651         this_ptr_conv.inner = untag_ptr(this_ptr);
55652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55654         this_ptr_conv.is_owned = false;
55655         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
55656 }
55657
55658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55659         LDKBlindedPayInfo this_ptr_conv;
55660         this_ptr_conv.inner = untag_ptr(this_ptr);
55661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55663         this_ptr_conv.is_owned = false;
55664         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
55665         return ret_conv;
55666 }
55667
55668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55669         LDKBlindedPayInfo this_ptr_conv;
55670         this_ptr_conv.inner = untag_ptr(this_ptr);
55671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55673         this_ptr_conv.is_owned = false;
55674         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
55675 }
55676
55677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55678         LDKBlindedPayInfo this_ptr_conv;
55679         this_ptr_conv.inner = untag_ptr(this_ptr);
55680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55682         this_ptr_conv.is_owned = false;
55683         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
55684         return ret_conv;
55685 }
55686
55687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55688         LDKBlindedPayInfo this_ptr_conv;
55689         this_ptr_conv.inner = untag_ptr(this_ptr);
55690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55692         this_ptr_conv.is_owned = false;
55693         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
55694 }
55695
55696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
55697         LDKBlindedPayInfo this_ptr_conv;
55698         this_ptr_conv.inner = untag_ptr(this_ptr);
55699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55701         this_ptr_conv.is_owned = false;
55702         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
55703         int64_t ret_ref = 0;
55704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55706         return ret_ref;
55707 }
55708
55709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55710         LDKBlindedPayInfo this_ptr_conv;
55711         this_ptr_conv.inner = untag_ptr(this_ptr);
55712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55714         this_ptr_conv.is_owned = false;
55715         LDKBlindedHopFeatures val_conv;
55716         val_conv.inner = untag_ptr(val);
55717         val_conv.is_owned = ptr_is_owned(val);
55718         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55719         val_conv = BlindedHopFeatures_clone(&val_conv);
55720         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
55721 }
55722
55723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t features_arg) {
55724         LDKBlindedHopFeatures features_arg_conv;
55725         features_arg_conv.inner = untag_ptr(features_arg);
55726         features_arg_conv.is_owned = ptr_is_owned(features_arg);
55727         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
55728         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
55729         LDKBlindedPayInfo ret_var = BlindedPayInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, features_arg_conv);
55730         int64_t ret_ref = 0;
55731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55733         return ret_ref;
55734 }
55735
55736 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
55737         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
55738         int64_t ret_ref = 0;
55739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55741         return ret_ref;
55742 }
55743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55744         LDKBlindedPayInfo arg_conv;
55745         arg_conv.inner = untag_ptr(arg);
55746         arg_conv.is_owned = ptr_is_owned(arg);
55747         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55748         arg_conv.is_owned = false;
55749         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
55750         return ret_conv;
55751 }
55752
55753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55754         LDKBlindedPayInfo orig_conv;
55755         orig_conv.inner = untag_ptr(orig);
55756         orig_conv.is_owned = ptr_is_owned(orig);
55757         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55758         orig_conv.is_owned = false;
55759         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
55760         int64_t ret_ref = 0;
55761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55763         return ret_ref;
55764 }
55765
55766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
55767         LDKBlindedPayInfo o_conv;
55768         o_conv.inner = untag_ptr(o);
55769         o_conv.is_owned = ptr_is_owned(o);
55770         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55771         o_conv.is_owned = false;
55772         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
55773         return ret_conv;
55774 }
55775
55776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55777         LDKBlindedPayInfo a_conv;
55778         a_conv.inner = untag_ptr(a);
55779         a_conv.is_owned = ptr_is_owned(a);
55780         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55781         a_conv.is_owned = false;
55782         LDKBlindedPayInfo b_conv;
55783         b_conv.inner = untag_ptr(b);
55784         b_conv.is_owned = ptr_is_owned(b);
55785         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55786         b_conv.is_owned = false;
55787         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
55788         return ret_conv;
55789 }
55790
55791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
55792         LDKBlindedPayInfo obj_conv;
55793         obj_conv.inner = untag_ptr(obj);
55794         obj_conv.is_owned = ptr_is_owned(obj);
55795         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55796         obj_conv.is_owned = false;
55797         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
55798         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55799         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55800         CVec_u8Z_free(ret_var);
55801         return ret_arr;
55802 }
55803
55804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55805         LDKu8slice ser_ref;
55806         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55807         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55808         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
55809         *ret_conv = BlindedPayInfo_read(ser_ref);
55810         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55811         return tag_ptr(ret_conv, true);
55812 }
55813
55814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55815         LDKInvoiceError this_obj_conv;
55816         this_obj_conv.inner = untag_ptr(this_obj);
55817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55819         InvoiceError_free(this_obj_conv);
55820 }
55821
55822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
55823         LDKInvoiceError this_ptr_conv;
55824         this_ptr_conv.inner = untag_ptr(this_ptr);
55825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55827         this_ptr_conv.is_owned = false;
55828         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
55829         int64_t ret_ref = 0;
55830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55832         return ret_ref;
55833 }
55834
55835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55836         LDKInvoiceError this_ptr_conv;
55837         this_ptr_conv.inner = untag_ptr(this_ptr);
55838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55840         this_ptr_conv.is_owned = false;
55841         LDKErroneousField val_conv;
55842         val_conv.inner = untag_ptr(val);
55843         val_conv.is_owned = ptr_is_owned(val);
55844         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55845         val_conv = ErroneousField_clone(&val_conv);
55846         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
55847 }
55848
55849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
55850         LDKInvoiceError this_ptr_conv;
55851         this_ptr_conv.inner = untag_ptr(this_ptr);
55852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55854         this_ptr_conv.is_owned = false;
55855         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
55856         int64_t ret_ref = 0;
55857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55859         return ret_ref;
55860 }
55861
55862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55863         LDKInvoiceError this_ptr_conv;
55864         this_ptr_conv.inner = untag_ptr(this_ptr);
55865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55867         this_ptr_conv.is_owned = false;
55868         LDKUntrustedString val_conv;
55869         val_conv.inner = untag_ptr(val);
55870         val_conv.is_owned = ptr_is_owned(val);
55871         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55872         val_conv = UntrustedString_clone(&val_conv);
55873         InvoiceError_set_message(&this_ptr_conv, val_conv);
55874 }
55875
55876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
55877         LDKErroneousField erroneous_field_arg_conv;
55878         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
55879         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
55880         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
55881         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
55882         LDKUntrustedString message_arg_conv;
55883         message_arg_conv.inner = untag_ptr(message_arg);
55884         message_arg_conv.is_owned = ptr_is_owned(message_arg);
55885         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
55886         message_arg_conv = UntrustedString_clone(&message_arg_conv);
55887         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
55888         int64_t ret_ref = 0;
55889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55891         return ret_ref;
55892 }
55893
55894 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
55895         LDKInvoiceError ret_var = InvoiceError_clone(arg);
55896         int64_t ret_ref = 0;
55897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55899         return ret_ref;
55900 }
55901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55902         LDKInvoiceError arg_conv;
55903         arg_conv.inner = untag_ptr(arg);
55904         arg_conv.is_owned = ptr_is_owned(arg);
55905         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55906         arg_conv.is_owned = false;
55907         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
55908         return ret_conv;
55909 }
55910
55911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55912         LDKInvoiceError orig_conv;
55913         orig_conv.inner = untag_ptr(orig);
55914         orig_conv.is_owned = ptr_is_owned(orig);
55915         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55916         orig_conv.is_owned = false;
55917         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
55918         int64_t ret_ref = 0;
55919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55921         return ret_ref;
55922 }
55923
55924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55925         LDKErroneousField this_obj_conv;
55926         this_obj_conv.inner = untag_ptr(this_obj);
55927         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55929         ErroneousField_free(this_obj_conv);
55930 }
55931
55932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
55933         LDKErroneousField this_ptr_conv;
55934         this_ptr_conv.inner = untag_ptr(this_ptr);
55935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55937         this_ptr_conv.is_owned = false;
55938         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
55939         return ret_conv;
55940 }
55941
55942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55943         LDKErroneousField this_ptr_conv;
55944         this_ptr_conv.inner = untag_ptr(this_ptr);
55945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55947         this_ptr_conv.is_owned = false;
55948         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
55949 }
55950
55951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
55952         LDKErroneousField this_ptr_conv;
55953         this_ptr_conv.inner = untag_ptr(this_ptr);
55954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55956         this_ptr_conv.is_owned = false;
55957         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
55958         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
55959         int64_t ret_ref = tag_ptr(ret_copy, true);
55960         return ret_ref;
55961 }
55962
55963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55964         LDKErroneousField this_ptr_conv;
55965         this_ptr_conv.inner = untag_ptr(this_ptr);
55966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55968         this_ptr_conv.is_owned = false;
55969         void* val_ptr = untag_ptr(val);
55970         CHECK_ACCESS(val_ptr);
55971         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
55972         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
55973         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
55974 }
55975
55976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1new(JNIEnv *env, jclass clz, int64_t tlv_fieldnum_arg, int64_t suggested_value_arg) {
55977         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
55978         CHECK_ACCESS(suggested_value_arg_ptr);
55979         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
55980         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
55981         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
55982         int64_t ret_ref = 0;
55983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55985         return ret_ref;
55986 }
55987
55988 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
55989         LDKErroneousField ret_var = ErroneousField_clone(arg);
55990         int64_t ret_ref = 0;
55991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55993         return ret_ref;
55994 }
55995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55996         LDKErroneousField arg_conv;
55997         arg_conv.inner = untag_ptr(arg);
55998         arg_conv.is_owned = ptr_is_owned(arg);
55999         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56000         arg_conv.is_owned = false;
56001         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
56002         return ret_conv;
56003 }
56004
56005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56006         LDKErroneousField orig_conv;
56007         orig_conv.inner = untag_ptr(orig);
56008         orig_conv.is_owned = ptr_is_owned(orig);
56009         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56010         orig_conv.is_owned = false;
56011         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
56012         int64_t ret_ref = 0;
56013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56015         return ret_ref;
56016 }
56017
56018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
56019         LDKInvoiceError obj_conv;
56020         obj_conv.inner = untag_ptr(obj);
56021         obj_conv.is_owned = ptr_is_owned(obj);
56022         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56023         obj_conv.is_owned = false;
56024         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
56025         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56026         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56027         CVec_u8Z_free(ret_var);
56028         return ret_arr;
56029 }
56030
56031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56032         LDKu8slice ser_ref;
56033         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56034         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56035         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
56036         *ret_conv = InvoiceError_read(ser_ref);
56037         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56038         return tag_ptr(ret_conv, true);
56039 }
56040
56041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56042         LDKUnsignedInvoiceRequest this_obj_conv;
56043         this_obj_conv.inner = untag_ptr(this_obj);
56044         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56046         UnsignedInvoiceRequest_free(this_obj_conv);
56047 }
56048
56049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56050         LDKInvoiceRequest this_obj_conv;
56051         this_obj_conv.inner = untag_ptr(this_obj);
56052         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56054         InvoiceRequest_free(this_obj_conv);
56055 }
56056
56057 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
56058         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
56059         int64_t ret_ref = 0;
56060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56062         return ret_ref;
56063 }
56064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56065         LDKInvoiceRequest arg_conv;
56066         arg_conv.inner = untag_ptr(arg);
56067         arg_conv.is_owned = ptr_is_owned(arg);
56068         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56069         arg_conv.is_owned = false;
56070         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
56071         return ret_conv;
56072 }
56073
56074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56075         LDKInvoiceRequest orig_conv;
56076         orig_conv.inner = untag_ptr(orig);
56077         orig_conv.is_owned = ptr_is_owned(orig);
56078         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56079         orig_conv.is_owned = false;
56080         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
56081         int64_t ret_ref = 0;
56082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56084         return ret_ref;
56085 }
56086
56087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
56088         LDKInvoiceRequest this_arg_conv;
56089         this_arg_conv.inner = untag_ptr(this_arg);
56090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56092         this_arg_conv.is_owned = false;
56093         LDKu8slice ret_var = InvoiceRequest_metadata(&this_arg_conv);
56094         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56095         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56096         return ret_arr;
56097 }
56098
56099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
56100         LDKInvoiceRequest this_arg_conv;
56101         this_arg_conv.inner = untag_ptr(this_arg);
56102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56104         this_arg_conv.is_owned = false;
56105         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56106         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
56107         return ret_arr;
56108 }
56109
56110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
56111         LDKInvoiceRequest this_arg_conv;
56112         this_arg_conv.inner = untag_ptr(this_arg);
56113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56115         this_arg_conv.is_owned = false;
56116         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56117         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
56118         int64_t ret_ref = tag_ptr(ret_copy, true);
56119         return ret_ref;
56120 }
56121
56122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
56123         LDKInvoiceRequest this_arg_conv;
56124         this_arg_conv.inner = untag_ptr(this_arg);
56125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56127         this_arg_conv.is_owned = false;
56128         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_features(&this_arg_conv);
56129         int64_t ret_ref = 0;
56130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56132         return ret_ref;
56133 }
56134
56135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
56136         LDKInvoiceRequest this_arg_conv;
56137         this_arg_conv.inner = untag_ptr(this_arg);
56138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56140         this_arg_conv.is_owned = false;
56141         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56142         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
56143         int64_t ret_ref = tag_ptr(ret_copy, true);
56144         return ret_ref;
56145 }
56146
56147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
56148         LDKInvoiceRequest this_arg_conv;
56149         this_arg_conv.inner = untag_ptr(this_arg);
56150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56152         this_arg_conv.is_owned = false;
56153         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56154         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
56155         return ret_arr;
56156 }
56157
56158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
56159         LDKInvoiceRequest this_arg_conv;
56160         this_arg_conv.inner = untag_ptr(this_arg);
56161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56163         this_arg_conv.is_owned = false;
56164         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
56165         int64_t ret_ref = 0;
56166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56168         return ret_ref;
56169 }
56170
56171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
56172         LDKInvoiceRequest this_arg_conv;
56173         this_arg_conv.inner = untag_ptr(this_arg);
56174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56176         this_arg_conv.is_owned = false;
56177         LDKExpandedKey key_conv;
56178         key_conv.inner = untag_ptr(key);
56179         key_conv.is_owned = ptr_is_owned(key);
56180         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
56181         key_conv.is_owned = false;
56182         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
56183         *ret_conv = InvoiceRequest_verify(&this_arg_conv, &key_conv);
56184         return tag_ptr(ret_conv, true);
56185 }
56186
56187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
56188         LDKInvoiceRequest obj_conv;
56189         obj_conv.inner = untag_ptr(obj);
56190         obj_conv.is_owned = ptr_is_owned(obj);
56191         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56192         obj_conv.is_owned = false;
56193         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
56194         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56195         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56196         CVec_u8Z_free(ret_var);
56197         return ret_arr;
56198 }
56199
56200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56201         LDKOffer this_obj_conv;
56202         this_obj_conv.inner = untag_ptr(this_obj);
56203         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56205         Offer_free(this_obj_conv);
56206 }
56207
56208 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
56209         LDKOffer ret_var = Offer_clone(arg);
56210         int64_t ret_ref = 0;
56211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56213         return ret_ref;
56214 }
56215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56216         LDKOffer arg_conv;
56217         arg_conv.inner = untag_ptr(arg);
56218         arg_conv.is_owned = ptr_is_owned(arg);
56219         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56220         arg_conv.is_owned = false;
56221         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
56222         return ret_conv;
56223 }
56224
56225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56226         LDKOffer orig_conv;
56227         orig_conv.inner = untag_ptr(orig);
56228         orig_conv.is_owned = ptr_is_owned(orig);
56229         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56230         orig_conv.is_owned = false;
56231         LDKOffer ret_var = Offer_clone(&orig_conv);
56232         int64_t ret_ref = 0;
56233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56235         return ret_ref;
56236 }
56237
56238 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
56239         LDKOffer this_arg_conv;
56240         this_arg_conv.inner = untag_ptr(this_arg);
56241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56243         this_arg_conv.is_owned = false;
56244         LDKCVec_ChainHashZ ret_var = Offer_chains(&this_arg_conv);
56245         jobjectArray ret_arr = NULL;
56246         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
56247         ;
56248         for (size_t i = 0; i < ret_var.datalen; i++) {
56249                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
56250                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
56251                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
56252         }
56253         
56254         FREE(ret_var.data);
56255         return ret_arr;
56256 }
56257
56258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
56259         LDKOffer this_arg_conv;
56260         this_arg_conv.inner = untag_ptr(this_arg);
56261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56263         this_arg_conv.is_owned = false;
56264         LDKThirtyTwoBytes chain_ref;
56265         CHECK((*env)->GetArrayLength(env, chain) == 32);
56266         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
56267         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
56268         return ret_conv;
56269 }
56270
56271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
56272         LDKOffer this_arg_conv;
56273         this_arg_conv.inner = untag_ptr(this_arg);
56274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56276         this_arg_conv.is_owned = false;
56277         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
56278         *ret_copy = Offer_metadata(&this_arg_conv);
56279         int64_t ret_ref = tag_ptr(ret_copy, true);
56280         return ret_ref;
56281 }
56282
56283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
56284         LDKOffer this_arg_conv;
56285         this_arg_conv.inner = untag_ptr(this_arg);
56286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56288         this_arg_conv.is_owned = false;
56289         LDKAmount ret_var = Offer_amount(&this_arg_conv);
56290         int64_t ret_ref = 0;
56291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56293         return ret_ref;
56294 }
56295
56296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
56297         LDKOffer this_arg_conv;
56298         this_arg_conv.inner = untag_ptr(this_arg);
56299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56301         this_arg_conv.is_owned = false;
56302         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
56303         int64_t ret_ref = 0;
56304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56306         return ret_ref;
56307 }
56308
56309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
56310         LDKOffer this_arg_conv;
56311         this_arg_conv.inner = untag_ptr(this_arg);
56312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56314         this_arg_conv.is_owned = false;
56315         LDKOfferFeatures ret_var = Offer_features(&this_arg_conv);
56316         int64_t ret_ref = 0;
56317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56319         return ret_ref;
56320 }
56321
56322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
56323         LDKOffer this_arg_conv;
56324         this_arg_conv.inner = untag_ptr(this_arg);
56325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56327         this_arg_conv.is_owned = false;
56328         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
56329         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
56330         int64_t ret_ref = tag_ptr(ret_copy, true);
56331         return ret_ref;
56332 }
56333
56334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
56335         LDKOffer this_arg_conv;
56336         this_arg_conv.inner = untag_ptr(this_arg);
56337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56339         this_arg_conv.is_owned = false;
56340         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
56341         return ret_conv;
56342 }
56343
56344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
56345         LDKOffer this_arg_conv;
56346         this_arg_conv.inner = untag_ptr(this_arg);
56347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56349         this_arg_conv.is_owned = false;
56350         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
56351         int64_t ret_ref = 0;
56352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56354         return ret_ref;
56355 }
56356
56357 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
56358         LDKOffer this_arg_conv;
56359         this_arg_conv.inner = untag_ptr(this_arg);
56360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56362         this_arg_conv.is_owned = false;
56363         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
56364         int64_tArray ret_arr = NULL;
56365         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
56366         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
56367         for (size_t n = 0; n < ret_var.datalen; n++) {
56368                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
56369                 int64_t ret_conv_13_ref = 0;
56370                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
56371                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
56372                 ret_arr_ptr[n] = ret_conv_13_ref;
56373         }
56374         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
56375         FREE(ret_var.data);
56376         return ret_arr;
56377 }
56378
56379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
56380         LDKOffer this_arg_conv;
56381         this_arg_conv.inner = untag_ptr(this_arg);
56382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56384         this_arg_conv.is_owned = false;
56385         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
56386         int64_t ret_ref = 0;
56387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56389         return ret_ref;
56390 }
56391
56392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
56393         LDKOffer this_arg_conv;
56394         this_arg_conv.inner = untag_ptr(this_arg);
56395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56397         this_arg_conv.is_owned = false;
56398         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
56399         return ret_conv;
56400 }
56401
56402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
56403         LDKOffer this_arg_conv;
56404         this_arg_conv.inner = untag_ptr(this_arg);
56405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56407         this_arg_conv.is_owned = false;
56408         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
56409         return ret_conv;
56410 }
56411
56412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
56413         LDKOffer this_arg_conv;
56414         this_arg_conv.inner = untag_ptr(this_arg);
56415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56417         this_arg_conv.is_owned = false;
56418         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56419         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
56420         return ret_arr;
56421 }
56422
56423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
56424         LDKOffer obj_conv;
56425         obj_conv.inner = untag_ptr(obj);
56426         obj_conv.is_owned = ptr_is_owned(obj);
56427         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56428         obj_conv.is_owned = false;
56429         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
56430         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56431         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56432         CVec_u8Z_free(ret_var);
56433         return ret_arr;
56434 }
56435
56436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56437         LDKAmount this_obj_conv;
56438         this_obj_conv.inner = untag_ptr(this_obj);
56439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56441         Amount_free(this_obj_conv);
56442 }
56443
56444 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
56445         LDKAmount ret_var = Amount_clone(arg);
56446         int64_t ret_ref = 0;
56447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56449         return ret_ref;
56450 }
56451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56452         LDKAmount arg_conv;
56453         arg_conv.inner = untag_ptr(arg);
56454         arg_conv.is_owned = ptr_is_owned(arg);
56455         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56456         arg_conv.is_owned = false;
56457         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
56458         return ret_conv;
56459 }
56460
56461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56462         LDKAmount orig_conv;
56463         orig_conv.inner = untag_ptr(orig);
56464         orig_conv.is_owned = ptr_is_owned(orig);
56465         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56466         orig_conv.is_owned = false;
56467         LDKAmount ret_var = Amount_clone(&orig_conv);
56468         int64_t ret_ref = 0;
56469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56471         return ret_ref;
56472 }
56473
56474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56475         LDKQuantity this_obj_conv;
56476         this_obj_conv.inner = untag_ptr(this_obj);
56477         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56479         Quantity_free(this_obj_conv);
56480 }
56481
56482 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
56483         LDKQuantity ret_var = Quantity_clone(arg);
56484         int64_t ret_ref = 0;
56485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56487         return ret_ref;
56488 }
56489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56490         LDKQuantity arg_conv;
56491         arg_conv.inner = untag_ptr(arg);
56492         arg_conv.is_owned = ptr_is_owned(arg);
56493         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56494         arg_conv.is_owned = false;
56495         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
56496         return ret_conv;
56497 }
56498
56499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56500         LDKQuantity orig_conv;
56501         orig_conv.inner = untag_ptr(orig);
56502         orig_conv.is_owned = ptr_is_owned(orig);
56503         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56504         orig_conv.is_owned = false;
56505         LDKQuantity ret_var = Quantity_clone(&orig_conv);
56506         int64_t ret_ref = 0;
56507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56509         return ret_ref;
56510 }
56511
56512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
56513         LDKStr s_conv = java_to_owned_str(env, s);
56514         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
56515         *ret_conv = Offer_from_str(s_conv);
56516         return tag_ptr(ret_conv, true);
56517 }
56518
56519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56520         LDKBolt12ParseError this_obj_conv;
56521         this_obj_conv.inner = untag_ptr(this_obj);
56522         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56524         Bolt12ParseError_free(this_obj_conv);
56525 }
56526
56527 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
56528         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
56529         int64_t ret_ref = 0;
56530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56532         return ret_ref;
56533 }
56534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56535         LDKBolt12ParseError arg_conv;
56536         arg_conv.inner = untag_ptr(arg);
56537         arg_conv.is_owned = ptr_is_owned(arg);
56538         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56539         arg_conv.is_owned = false;
56540         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
56541         return ret_conv;
56542 }
56543
56544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56545         LDKBolt12ParseError orig_conv;
56546         orig_conv.inner = untag_ptr(orig);
56547         orig_conv.is_owned = ptr_is_owned(orig);
56548         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56549         orig_conv.is_owned = false;
56550         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
56551         int64_t ret_ref = 0;
56552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56554         return ret_ref;
56555 }
56556
56557 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56558         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
56559         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
56560         return ret_conv;
56561 }
56562
56563 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
56564         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
56565         return ret_conv;
56566 }
56567
56568 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
56569         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
56570         return ret_conv;
56571 }
56572
56573 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
56574         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
56575         return ret_conv;
56576 }
56577
56578 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
56579         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
56580         return ret_conv;
56581 }
56582
56583 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
56584         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
56585         return ret_conv;
56586 }
56587
56588 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
56589         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
56590         return ret_conv;
56591 }
56592
56593 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
56594         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
56595         return ret_conv;
56596 }
56597
56598 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
56599         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
56600         return ret_conv;
56601 }
56602
56603 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
56604         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
56605         return ret_conv;
56606 }
56607
56608 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
56609         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
56610         return ret_conv;
56611 }
56612
56613 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
56614         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
56615         return ret_conv;
56616 }
56617
56618 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
56619         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
56620         return ret_conv;
56621 }
56622
56623 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
56624         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
56625         return ret_conv;
56626 }
56627
56628 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
56629         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
56630         return ret_conv;
56631 }
56632
56633 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
56634         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
56635         return ret_conv;
56636 }
56637
56638 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
56639         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
56640         return ret_conv;
56641 }
56642
56643 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
56644         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
56645         return ret_conv;
56646 }
56647
56648 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
56649         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
56650         return ret_conv;
56651 }
56652
56653 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
56654         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
56655         return ret_conv;
56656 }
56657
56658 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
56659         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
56660         return ret_conv;
56661 }
56662
56663 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
56664         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
56665         return ret_conv;
56666 }
56667
56668 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
56669         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
56670         return ret_conv;
56671 }
56672
56673 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
56674         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
56675         return ret_conv;
56676 }
56677
56678 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
56679         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
56680         return ret_conv;
56681 }
56682
56683 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
56684         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
56685         return ret_conv;
56686 }
56687
56688 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
56689         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
56690         return ret_conv;
56691 }
56692
56693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56694         LDKRefund this_obj_conv;
56695         this_obj_conv.inner = untag_ptr(this_obj);
56696         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56698         Refund_free(this_obj_conv);
56699 }
56700
56701 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
56702         LDKRefund ret_var = Refund_clone(arg);
56703         int64_t ret_ref = 0;
56704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56706         return ret_ref;
56707 }
56708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56709         LDKRefund arg_conv;
56710         arg_conv.inner = untag_ptr(arg);
56711         arg_conv.is_owned = ptr_is_owned(arg);
56712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56713         arg_conv.is_owned = false;
56714         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
56715         return ret_conv;
56716 }
56717
56718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56719         LDKRefund orig_conv;
56720         orig_conv.inner = untag_ptr(orig);
56721         orig_conv.is_owned = ptr_is_owned(orig);
56722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56723         orig_conv.is_owned = false;
56724         LDKRefund ret_var = Refund_clone(&orig_conv);
56725         int64_t ret_ref = 0;
56726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56728         return ret_ref;
56729 }
56730
56731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
56732         LDKRefund this_arg_conv;
56733         this_arg_conv.inner = untag_ptr(this_arg);
56734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56736         this_arg_conv.is_owned = false;
56737         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
56738         int64_t ret_ref = 0;
56739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56741         return ret_ref;
56742 }
56743
56744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
56745         LDKRefund this_arg_conv;
56746         this_arg_conv.inner = untag_ptr(this_arg);
56747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56749         this_arg_conv.is_owned = false;
56750         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
56751         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
56752         int64_t ret_ref = tag_ptr(ret_copy, true);
56753         return ret_ref;
56754 }
56755
56756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
56757         LDKRefund this_arg_conv;
56758         this_arg_conv.inner = untag_ptr(this_arg);
56759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56761         this_arg_conv.is_owned = false;
56762         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
56763         return ret_conv;
56764 }
56765
56766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
56767         LDKRefund this_arg_conv;
56768         this_arg_conv.inner = untag_ptr(this_arg);
56769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56771         this_arg_conv.is_owned = false;
56772         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
56773         int64_t ret_ref = 0;
56774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56776         return ret_ref;
56777 }
56778
56779 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
56780         LDKRefund this_arg_conv;
56781         this_arg_conv.inner = untag_ptr(this_arg);
56782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56784         this_arg_conv.is_owned = false;
56785         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
56786         int64_tArray ret_arr = NULL;
56787         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
56788         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
56789         for (size_t n = 0; n < ret_var.datalen; n++) {
56790                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
56791                 int64_t ret_conv_13_ref = 0;
56792                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
56793                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
56794                 ret_arr_ptr[n] = ret_conv_13_ref;
56795         }
56796         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
56797         FREE(ret_var.data);
56798         return ret_arr;
56799 }
56800
56801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
56802         LDKRefund this_arg_conv;
56803         this_arg_conv.inner = untag_ptr(this_arg);
56804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56806         this_arg_conv.is_owned = false;
56807         LDKu8slice ret_var = Refund_metadata(&this_arg_conv);
56808         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56809         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56810         return ret_arr;
56811 }
56812
56813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
56814         LDKRefund this_arg_conv;
56815         this_arg_conv.inner = untag_ptr(this_arg);
56816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56818         this_arg_conv.is_owned = false;
56819         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56820         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
56821         return ret_arr;
56822 }
56823
56824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
56825         LDKRefund this_arg_conv;
56826         this_arg_conv.inner = untag_ptr(this_arg);
56827         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56829         this_arg_conv.is_owned = false;
56830         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
56831         return ret_conv;
56832 }
56833
56834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
56835         LDKRefund this_arg_conv;
56836         this_arg_conv.inner = untag_ptr(this_arg);
56837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56839         this_arg_conv.is_owned = false;
56840         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
56841         int64_t ret_ref = 0;
56842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56844         return ret_ref;
56845 }
56846
56847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
56848         LDKRefund this_arg_conv;
56849         this_arg_conv.inner = untag_ptr(this_arg);
56850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56852         this_arg_conv.is_owned = false;
56853         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56854         *ret_copy = Refund_quantity(&this_arg_conv);
56855         int64_t ret_ref = tag_ptr(ret_copy, true);
56856         return ret_ref;
56857 }
56858
56859 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
56860         LDKRefund this_arg_conv;
56861         this_arg_conv.inner = untag_ptr(this_arg);
56862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56864         this_arg_conv.is_owned = false;
56865         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56866         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
56867         return ret_arr;
56868 }
56869
56870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
56871         LDKRefund this_arg_conv;
56872         this_arg_conv.inner = untag_ptr(this_arg);
56873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56875         this_arg_conv.is_owned = false;
56876         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
56877         int64_t ret_ref = 0;
56878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56880         return ret_ref;
56881 }
56882
56883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
56884         LDKRefund obj_conv;
56885         obj_conv.inner = untag_ptr(obj);
56886         obj_conv.is_owned = ptr_is_owned(obj);
56887         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56888         obj_conv.is_owned = false;
56889         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
56890         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56891         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56892         CVec_u8Z_free(ret_var);
56893         return ret_arr;
56894 }
56895
56896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
56897         LDKStr s_conv = java_to_owned_str(env, s);
56898         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
56899         *ret_conv = Refund_from_str(s_conv);
56900         return tag_ptr(ret_conv, true);
56901 }
56902
56903 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56904         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
56905         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
56906         return ret_conv;
56907 }
56908
56909 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
56910         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
56911         return ret_conv;
56912 }
56913
56914 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
56915         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
56916         return ret_conv;
56917 }
56918
56919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56920         if (!ptr_is_owned(this_ptr)) return;
56921         void* this_ptr_ptr = untag_ptr(this_ptr);
56922         CHECK_ACCESS(this_ptr_ptr);
56923         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
56924         FREE(untag_ptr(this_ptr));
56925         UtxoResult_free(this_ptr_conv);
56926 }
56927
56928 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
56929         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56930         *ret_copy = UtxoResult_clone(arg);
56931         int64_t ret_ref = tag_ptr(ret_copy, true);
56932         return ret_ref;
56933 }
56934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56935         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
56936         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
56937         return ret_conv;
56938 }
56939
56940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56941         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
56942         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56943         *ret_copy = UtxoResult_clone(orig_conv);
56944         int64_t ret_ref = tag_ptr(ret_copy, true);
56945         return ret_ref;
56946 }
56947
56948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
56949         void* a_ptr = untag_ptr(a);
56950         CHECK_ACCESS(a_ptr);
56951         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
56952         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
56953         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56954         *ret_copy = UtxoResult_sync(a_conv);
56955         int64_t ret_ref = tag_ptr(ret_copy, true);
56956         return ret_ref;
56957 }
56958
56959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
56960         LDKUtxoFuture a_conv;
56961         a_conv.inner = untag_ptr(a);
56962         a_conv.is_owned = ptr_is_owned(a);
56963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56964         a_conv = UtxoFuture_clone(&a_conv);
56965         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56966         *ret_copy = UtxoResult_async(a_conv);
56967         int64_t ret_ref = tag_ptr(ret_copy, true);
56968         return ret_ref;
56969 }
56970
56971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56972         if (!ptr_is_owned(this_ptr)) return;
56973         void* this_ptr_ptr = untag_ptr(this_ptr);
56974         CHECK_ACCESS(this_ptr_ptr);
56975         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
56976         FREE(untag_ptr(this_ptr));
56977         UtxoLookup_free(this_ptr_conv);
56978 }
56979
56980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56981         LDKUtxoFuture this_obj_conv;
56982         this_obj_conv.inner = untag_ptr(this_obj);
56983         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56985         UtxoFuture_free(this_obj_conv);
56986 }
56987
56988 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
56989         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
56990         int64_t ret_ref = 0;
56991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56993         return ret_ref;
56994 }
56995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56996         LDKUtxoFuture arg_conv;
56997         arg_conv.inner = untag_ptr(arg);
56998         arg_conv.is_owned = ptr_is_owned(arg);
56999         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57000         arg_conv.is_owned = false;
57001         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
57002         return ret_conv;
57003 }
57004
57005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57006         LDKUtxoFuture orig_conv;
57007         orig_conv.inner = untag_ptr(orig);
57008         orig_conv.is_owned = ptr_is_owned(orig);
57009         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57010         orig_conv.is_owned = false;
57011         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
57012         int64_t ret_ref = 0;
57013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57015         return ret_ref;
57016 }
57017
57018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
57019         LDKUtxoFuture ret_var = UtxoFuture_new();
57020         int64_t ret_ref = 0;
57021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57023         return ret_ref;
57024 }
57025
57026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve_1without_1forwarding(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t result) {
57027         LDKUtxoFuture this_arg_conv;
57028         this_arg_conv.inner = untag_ptr(this_arg);
57029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57031         this_arg_conv.is_owned = false;
57032         LDKNetworkGraph graph_conv;
57033         graph_conv.inner = untag_ptr(graph);
57034         graph_conv.is_owned = ptr_is_owned(graph);
57035         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
57036         graph_conv.is_owned = false;
57037         void* result_ptr = untag_ptr(result);
57038         CHECK_ACCESS(result_ptr);
57039         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
57040         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
57041 }
57042
57043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1resolve(JNIEnv *env, jclass clz, int64_t this_arg, int64_t graph, int64_t gossip, int64_t result) {
57044         LDKUtxoFuture this_arg_conv;
57045         this_arg_conv.inner = untag_ptr(this_arg);
57046         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57048         this_arg_conv.is_owned = false;
57049         LDKNetworkGraph graph_conv;
57050         graph_conv.inner = untag_ptr(graph);
57051         graph_conv.is_owned = ptr_is_owned(graph);
57052         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
57053         graph_conv.is_owned = false;
57054         LDKP2PGossipSync gossip_conv;
57055         gossip_conv.inner = untag_ptr(gossip);
57056         gossip_conv.is_owned = ptr_is_owned(gossip);
57057         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
57058         gossip_conv.is_owned = false;
57059         void* result_ptr = untag_ptr(result);
57060         CHECK_ACCESS(result_ptr);
57061         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
57062         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
57063 }
57064
57065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57066         LDKNodeId this_obj_conv;
57067         this_obj_conv.inner = untag_ptr(this_obj);
57068         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57070         NodeId_free(this_obj_conv);
57071 }
57072
57073 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
57074         LDKNodeId ret_var = NodeId_clone(arg);
57075         int64_t ret_ref = 0;
57076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57078         return ret_ref;
57079 }
57080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57081         LDKNodeId arg_conv;
57082         arg_conv.inner = untag_ptr(arg);
57083         arg_conv.is_owned = ptr_is_owned(arg);
57084         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57085         arg_conv.is_owned = false;
57086         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
57087         return ret_conv;
57088 }
57089
57090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57091         LDKNodeId orig_conv;
57092         orig_conv.inner = untag_ptr(orig);
57093         orig_conv.is_owned = ptr_is_owned(orig);
57094         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57095         orig_conv.is_owned = false;
57096         LDKNodeId ret_var = NodeId_clone(&orig_conv);
57097         int64_t ret_ref = 0;
57098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57100         return ret_ref;
57101 }
57102
57103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
57104         LDKPublicKey pubkey_ref;
57105         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
57106         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
57107         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
57108         int64_t ret_ref = 0;
57109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57111         return ret_ref;
57112 }
57113
57114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
57115         LDKNodeId this_arg_conv;
57116         this_arg_conv.inner = untag_ptr(this_arg);
57117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57119         this_arg_conv.is_owned = false;
57120         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
57121         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57122         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57123         return ret_arr;
57124 }
57125
57126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
57127         LDKNodeId this_arg_conv;
57128         this_arg_conv.inner = untag_ptr(this_arg);
57129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57131         this_arg_conv.is_owned = false;
57132         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
57133         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
57134         return tag_ptr(ret_conv, true);
57135 }
57136
57137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
57138         LDKNodeId o_conv;
57139         o_conv.inner = untag_ptr(o);
57140         o_conv.is_owned = ptr_is_owned(o);
57141         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57142         o_conv.is_owned = false;
57143         int64_t ret_conv = NodeId_hash(&o_conv);
57144         return ret_conv;
57145 }
57146
57147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
57148         LDKNodeId obj_conv;
57149         obj_conv.inner = untag_ptr(obj);
57150         obj_conv.is_owned = ptr_is_owned(obj);
57151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57152         obj_conv.is_owned = false;
57153         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
57154         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57155         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57156         CVec_u8Z_free(ret_var);
57157         return ret_arr;
57158 }
57159
57160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57161         LDKu8slice ser_ref;
57162         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57163         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57164         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
57165         *ret_conv = NodeId_read(ser_ref);
57166         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57167         return tag_ptr(ret_conv, true);
57168 }
57169
57170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57171         LDKNetworkGraph this_obj_conv;
57172         this_obj_conv.inner = untag_ptr(this_obj);
57173         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57175         NetworkGraph_free(this_obj_conv);
57176 }
57177
57178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57179         LDKReadOnlyNetworkGraph this_obj_conv;
57180         this_obj_conv.inner = untag_ptr(this_obj);
57181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57183         ReadOnlyNetworkGraph_free(this_obj_conv);
57184 }
57185
57186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57187         if (!ptr_is_owned(this_ptr)) return;
57188         void* this_ptr_ptr = untag_ptr(this_ptr);
57189         CHECK_ACCESS(this_ptr_ptr);
57190         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
57191         FREE(untag_ptr(this_ptr));
57192         NetworkUpdate_free(this_ptr_conv);
57193 }
57194
57195 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
57196         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57197         *ret_copy = NetworkUpdate_clone(arg);
57198         int64_t ret_ref = tag_ptr(ret_copy, true);
57199         return ret_ref;
57200 }
57201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57202         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
57203         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
57204         return ret_conv;
57205 }
57206
57207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57208         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
57209         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57210         *ret_copy = NetworkUpdate_clone(orig_conv);
57211         int64_t ret_ref = tag_ptr(ret_copy, true);
57212         return ret_ref;
57213 }
57214
57215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
57216         LDKChannelUpdate msg_conv;
57217         msg_conv.inner = untag_ptr(msg);
57218         msg_conv.is_owned = ptr_is_owned(msg);
57219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57220         msg_conv = ChannelUpdate_clone(&msg_conv);
57221         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57222         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
57223         int64_t ret_ref = tag_ptr(ret_copy, true);
57224         return ret_ref;
57225 }
57226
57227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
57228         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57229         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
57230         int64_t ret_ref = tag_ptr(ret_copy, true);
57231         return ret_ref;
57232 }
57233
57234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
57235         LDKPublicKey node_id_ref;
57236         CHECK((*env)->GetArrayLength(env, node_id) == 33);
57237         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
57238         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57239         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
57240         int64_t ret_ref = tag_ptr(ret_copy, true);
57241         return ret_ref;
57242 }
57243
57244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57245         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
57246         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
57247         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
57248         return ret_conv;
57249 }
57250
57251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
57252         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
57253         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
57254         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57255         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57256         CVec_u8Z_free(ret_var);
57257         return ret_arr;
57258 }
57259
57260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57261         LDKu8slice ser_ref;
57262         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57263         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57264         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
57265         *ret_conv = NetworkUpdate_read(ser_ref);
57266         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57267         return tag_ptr(ret_conv, true);
57268 }
57269
57270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57271         LDKP2PGossipSync this_obj_conv;
57272         this_obj_conv.inner = untag_ptr(this_obj);
57273         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57275         P2PGossipSync_free(this_obj_conv);
57276 }
57277
57278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t utxo_lookup, int64_t logger) {
57279         LDKNetworkGraph network_graph_conv;
57280         network_graph_conv.inner = untag_ptr(network_graph);
57281         network_graph_conv.is_owned = ptr_is_owned(network_graph);
57282         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
57283         network_graph_conv.is_owned = false;
57284         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
57285         CHECK_ACCESS(utxo_lookup_ptr);
57286         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
57287         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
57288         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
57289                 // Manually implement clone for Java trait instances
57290                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
57291                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57292                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
57293                 }
57294         }
57295         void* logger_ptr = untag_ptr(logger);
57296         CHECK_ACCESS(logger_ptr);
57297         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57298         if (logger_conv.free == LDKLogger_JCalls_free) {
57299                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57300                 LDKLogger_JCalls_cloned(&logger_conv);
57301         }
57302         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
57303         int64_t ret_ref = 0;
57304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57306         return ret_ref;
57307 }
57308
57309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
57310         LDKP2PGossipSync this_arg_conv;
57311         this_arg_conv.inner = untag_ptr(this_arg);
57312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57314         this_arg_conv.is_owned = false;
57315         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
57316         CHECK_ACCESS(utxo_lookup_ptr);
57317         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
57318         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
57319         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
57320                 // Manually implement clone for Java trait instances
57321                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
57322                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57323                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
57324                 }
57325         }
57326         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
57327 }
57328
57329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
57330         LDKNetworkGraph this_arg_conv;
57331         this_arg_conv.inner = untag_ptr(this_arg);
57332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57334         this_arg_conv.is_owned = false;
57335         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
57336         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
57337 }
57338
57339 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1genesis_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
57340         LDKNetworkGraph this_arg_conv;
57341         this_arg_conv.inner = untag_ptr(this_arg);
57342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57344         this_arg_conv.is_owned = false;
57345         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
57346         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_genesis_hash(&this_arg_conv).data);
57347         return ret_arr;
57348 }
57349
57350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
57351         LDKNodeAnnouncement msg_conv;
57352         msg_conv.inner = untag_ptr(msg);
57353         msg_conv.is_owned = ptr_is_owned(msg);
57354         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57355         msg_conv.is_owned = false;
57356         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57357         *ret_conv = verify_node_announcement(&msg_conv);
57358         return tag_ptr(ret_conv, true);
57359 }
57360
57361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
57362         LDKChannelAnnouncement msg_conv;
57363         msg_conv.inner = untag_ptr(msg);
57364         msg_conv.is_owned = ptr_is_owned(msg);
57365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57366         msg_conv.is_owned = false;
57367         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57368         *ret_conv = verify_channel_announcement(&msg_conv);
57369         return tag_ptr(ret_conv, true);
57370 }
57371
57372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57373         LDKP2PGossipSync this_arg_conv;
57374         this_arg_conv.inner = untag_ptr(this_arg);
57375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57377         this_arg_conv.is_owned = false;
57378         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
57379         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
57380         return tag_ptr(ret_ret, true);
57381 }
57382
57383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
57384         LDKP2PGossipSync this_arg_conv;
57385         this_arg_conv.inner = untag_ptr(this_arg);
57386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57388         this_arg_conv.is_owned = false;
57389         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57390         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
57391         return tag_ptr(ret_ret, true);
57392 }
57393
57394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57395         LDKChannelUpdateInfo this_obj_conv;
57396         this_obj_conv.inner = untag_ptr(this_obj);
57397         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57399         ChannelUpdateInfo_free(this_obj_conv);
57400 }
57401
57402 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
57403         LDKChannelUpdateInfo this_ptr_conv;
57404         this_ptr_conv.inner = untag_ptr(this_ptr);
57405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57407         this_ptr_conv.is_owned = false;
57408         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
57409         return ret_conv;
57410 }
57411
57412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
57413         LDKChannelUpdateInfo this_ptr_conv;
57414         this_ptr_conv.inner = untag_ptr(this_ptr);
57415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57417         this_ptr_conv.is_owned = false;
57418         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
57419 }
57420
57421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
57422         LDKChannelUpdateInfo this_ptr_conv;
57423         this_ptr_conv.inner = untag_ptr(this_ptr);
57424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57426         this_ptr_conv.is_owned = false;
57427         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
57428         return ret_conv;
57429 }
57430
57431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
57432         LDKChannelUpdateInfo this_ptr_conv;
57433         this_ptr_conv.inner = untag_ptr(this_ptr);
57434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57436         this_ptr_conv.is_owned = false;
57437         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
57438 }
57439
57440 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
57441         LDKChannelUpdateInfo this_ptr_conv;
57442         this_ptr_conv.inner = untag_ptr(this_ptr);
57443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57445         this_ptr_conv.is_owned = false;
57446         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
57447         return ret_conv;
57448 }
57449
57450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
57451         LDKChannelUpdateInfo this_ptr_conv;
57452         this_ptr_conv.inner = untag_ptr(this_ptr);
57453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57455         this_ptr_conv.is_owned = false;
57456         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
57457 }
57458
57459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
57460         LDKChannelUpdateInfo this_ptr_conv;
57461         this_ptr_conv.inner = untag_ptr(this_ptr);
57462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57464         this_ptr_conv.is_owned = false;
57465         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
57466         return ret_conv;
57467 }
57468
57469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57470         LDKChannelUpdateInfo this_ptr_conv;
57471         this_ptr_conv.inner = untag_ptr(this_ptr);
57472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57474         this_ptr_conv.is_owned = false;
57475         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
57476 }
57477
57478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
57479         LDKChannelUpdateInfo this_ptr_conv;
57480         this_ptr_conv.inner = untag_ptr(this_ptr);
57481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57483         this_ptr_conv.is_owned = false;
57484         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
57485         return ret_conv;
57486 }
57487
57488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57489         LDKChannelUpdateInfo this_ptr_conv;
57490         this_ptr_conv.inner = untag_ptr(this_ptr);
57491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57493         this_ptr_conv.is_owned = false;
57494         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
57495 }
57496
57497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
57498         LDKChannelUpdateInfo this_ptr_conv;
57499         this_ptr_conv.inner = untag_ptr(this_ptr);
57500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57502         this_ptr_conv.is_owned = false;
57503         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
57504         int64_t ret_ref = 0;
57505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57507         return ret_ref;
57508 }
57509
57510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57511         LDKChannelUpdateInfo this_ptr_conv;
57512         this_ptr_conv.inner = untag_ptr(this_ptr);
57513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57515         this_ptr_conv.is_owned = false;
57516         LDKRoutingFees val_conv;
57517         val_conv.inner = untag_ptr(val);
57518         val_conv.is_owned = ptr_is_owned(val);
57519         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57520         val_conv = RoutingFees_clone(&val_conv);
57521         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
57522 }
57523
57524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
57525         LDKChannelUpdateInfo this_ptr_conv;
57526         this_ptr_conv.inner = untag_ptr(this_ptr);
57527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57529         this_ptr_conv.is_owned = false;
57530         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
57531         int64_t ret_ref = 0;
57532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57534         return ret_ref;
57535 }
57536
57537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57538         LDKChannelUpdateInfo this_ptr_conv;
57539         this_ptr_conv.inner = untag_ptr(this_ptr);
57540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57542         this_ptr_conv.is_owned = false;
57543         LDKChannelUpdate val_conv;
57544         val_conv.inner = untag_ptr(val);
57545         val_conv.is_owned = ptr_is_owned(val);
57546         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57547         val_conv = ChannelUpdate_clone(&val_conv);
57548         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
57549 }
57550
57551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
57552         LDKRoutingFees fees_arg_conv;
57553         fees_arg_conv.inner = untag_ptr(fees_arg);
57554         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
57555         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
57556         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
57557         LDKChannelUpdate last_update_message_arg_conv;
57558         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
57559         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
57560         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
57561         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
57562         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg_conv, last_update_message_arg_conv);
57563         int64_t ret_ref = 0;
57564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57566         return ret_ref;
57567 }
57568
57569 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
57570         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
57571         int64_t ret_ref = 0;
57572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57574         return ret_ref;
57575 }
57576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57577         LDKChannelUpdateInfo arg_conv;
57578         arg_conv.inner = untag_ptr(arg);
57579         arg_conv.is_owned = ptr_is_owned(arg);
57580         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57581         arg_conv.is_owned = false;
57582         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
57583         return ret_conv;
57584 }
57585
57586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57587         LDKChannelUpdateInfo orig_conv;
57588         orig_conv.inner = untag_ptr(orig);
57589         orig_conv.is_owned = ptr_is_owned(orig);
57590         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57591         orig_conv.is_owned = false;
57592         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
57593         int64_t ret_ref = 0;
57594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57596         return ret_ref;
57597 }
57598
57599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57600         LDKChannelUpdateInfo a_conv;
57601         a_conv.inner = untag_ptr(a);
57602         a_conv.is_owned = ptr_is_owned(a);
57603         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57604         a_conv.is_owned = false;
57605         LDKChannelUpdateInfo b_conv;
57606         b_conv.inner = untag_ptr(b);
57607         b_conv.is_owned = ptr_is_owned(b);
57608         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57609         b_conv.is_owned = false;
57610         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
57611         return ret_conv;
57612 }
57613
57614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
57615         LDKChannelUpdateInfo obj_conv;
57616         obj_conv.inner = untag_ptr(obj);
57617         obj_conv.is_owned = ptr_is_owned(obj);
57618         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57619         obj_conv.is_owned = false;
57620         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
57621         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57622         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57623         CVec_u8Z_free(ret_var);
57624         return ret_arr;
57625 }
57626
57627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57628         LDKu8slice ser_ref;
57629         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57630         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57631         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
57632         *ret_conv = ChannelUpdateInfo_read(ser_ref);
57633         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57634         return tag_ptr(ret_conv, true);
57635 }
57636
57637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57638         LDKChannelInfo this_obj_conv;
57639         this_obj_conv.inner = untag_ptr(this_obj);
57640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57642         ChannelInfo_free(this_obj_conv);
57643 }
57644
57645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
57646         LDKChannelInfo this_ptr_conv;
57647         this_ptr_conv.inner = untag_ptr(this_ptr);
57648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57650         this_ptr_conv.is_owned = false;
57651         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
57652         int64_t ret_ref = 0;
57653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57655         return ret_ref;
57656 }
57657
57658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57659         LDKChannelInfo this_ptr_conv;
57660         this_ptr_conv.inner = untag_ptr(this_ptr);
57661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57663         this_ptr_conv.is_owned = false;
57664         LDKChannelFeatures val_conv;
57665         val_conv.inner = untag_ptr(val);
57666         val_conv.is_owned = ptr_is_owned(val);
57667         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57668         val_conv = ChannelFeatures_clone(&val_conv);
57669         ChannelInfo_set_features(&this_ptr_conv, val_conv);
57670 }
57671
57672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
57673         LDKChannelInfo this_ptr_conv;
57674         this_ptr_conv.inner = untag_ptr(this_ptr);
57675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57677         this_ptr_conv.is_owned = false;
57678         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
57679         int64_t ret_ref = 0;
57680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57682         return ret_ref;
57683 }
57684
57685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57686         LDKChannelInfo this_ptr_conv;
57687         this_ptr_conv.inner = untag_ptr(this_ptr);
57688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57690         this_ptr_conv.is_owned = false;
57691         LDKNodeId val_conv;
57692         val_conv.inner = untag_ptr(val);
57693         val_conv.is_owned = ptr_is_owned(val);
57694         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57695         val_conv = NodeId_clone(&val_conv);
57696         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
57697 }
57698
57699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
57700         LDKChannelInfo this_ptr_conv;
57701         this_ptr_conv.inner = untag_ptr(this_ptr);
57702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57704         this_ptr_conv.is_owned = false;
57705         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
57706         int64_t ret_ref = 0;
57707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57709         return ret_ref;
57710 }
57711
57712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57713         LDKChannelInfo this_ptr_conv;
57714         this_ptr_conv.inner = untag_ptr(this_ptr);
57715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57717         this_ptr_conv.is_owned = false;
57718         LDKChannelUpdateInfo val_conv;
57719         val_conv.inner = untag_ptr(val);
57720         val_conv.is_owned = ptr_is_owned(val);
57721         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57722         val_conv = ChannelUpdateInfo_clone(&val_conv);
57723         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
57724 }
57725
57726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
57727         LDKChannelInfo this_ptr_conv;
57728         this_ptr_conv.inner = untag_ptr(this_ptr);
57729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57731         this_ptr_conv.is_owned = false;
57732         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
57733         int64_t ret_ref = 0;
57734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57736         return ret_ref;
57737 }
57738
57739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57740         LDKChannelInfo this_ptr_conv;
57741         this_ptr_conv.inner = untag_ptr(this_ptr);
57742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57744         this_ptr_conv.is_owned = false;
57745         LDKNodeId val_conv;
57746         val_conv.inner = untag_ptr(val);
57747         val_conv.is_owned = ptr_is_owned(val);
57748         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57749         val_conv = NodeId_clone(&val_conv);
57750         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
57751 }
57752
57753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
57754         LDKChannelInfo this_ptr_conv;
57755         this_ptr_conv.inner = untag_ptr(this_ptr);
57756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57758         this_ptr_conv.is_owned = false;
57759         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
57760         int64_t ret_ref = 0;
57761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57763         return ret_ref;
57764 }
57765
57766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57767         LDKChannelInfo this_ptr_conv;
57768         this_ptr_conv.inner = untag_ptr(this_ptr);
57769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57771         this_ptr_conv.is_owned = false;
57772         LDKChannelUpdateInfo val_conv;
57773         val_conv.inner = untag_ptr(val);
57774         val_conv.is_owned = ptr_is_owned(val);
57775         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57776         val_conv = ChannelUpdateInfo_clone(&val_conv);
57777         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
57778 }
57779
57780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
57781         LDKChannelInfo this_ptr_conv;
57782         this_ptr_conv.inner = untag_ptr(this_ptr);
57783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57785         this_ptr_conv.is_owned = false;
57786         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
57787         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
57788         int64_t ret_ref = tag_ptr(ret_copy, true);
57789         return ret_ref;
57790 }
57791
57792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57793         LDKChannelInfo this_ptr_conv;
57794         this_ptr_conv.inner = untag_ptr(this_ptr);
57795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57797         this_ptr_conv.is_owned = false;
57798         void* val_ptr = untag_ptr(val);
57799         CHECK_ACCESS(val_ptr);
57800         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
57801         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
57802         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
57803 }
57804
57805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
57806         LDKChannelInfo this_ptr_conv;
57807         this_ptr_conv.inner = untag_ptr(this_ptr);
57808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57810         this_ptr_conv.is_owned = false;
57811         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
57812         int64_t ret_ref = 0;
57813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57815         return ret_ref;
57816 }
57817
57818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57819         LDKChannelInfo this_ptr_conv;
57820         this_ptr_conv.inner = untag_ptr(this_ptr);
57821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57823         this_ptr_conv.is_owned = false;
57824         LDKChannelAnnouncement val_conv;
57825         val_conv.inner = untag_ptr(val);
57826         val_conv.is_owned = ptr_is_owned(val);
57827         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57828         val_conv = ChannelAnnouncement_clone(&val_conv);
57829         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
57830 }
57831
57832 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
57833         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
57834         int64_t ret_ref = 0;
57835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57837         return ret_ref;
57838 }
57839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57840         LDKChannelInfo arg_conv;
57841         arg_conv.inner = untag_ptr(arg);
57842         arg_conv.is_owned = ptr_is_owned(arg);
57843         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57844         arg_conv.is_owned = false;
57845         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
57846         return ret_conv;
57847 }
57848
57849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57850         LDKChannelInfo orig_conv;
57851         orig_conv.inner = untag_ptr(orig);
57852         orig_conv.is_owned = ptr_is_owned(orig);
57853         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57854         orig_conv.is_owned = false;
57855         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
57856         int64_t ret_ref = 0;
57857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57859         return ret_ref;
57860 }
57861
57862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57863         LDKChannelInfo a_conv;
57864         a_conv.inner = untag_ptr(a);
57865         a_conv.is_owned = ptr_is_owned(a);
57866         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57867         a_conv.is_owned = false;
57868         LDKChannelInfo b_conv;
57869         b_conv.inner = untag_ptr(b);
57870         b_conv.is_owned = ptr_is_owned(b);
57871         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57872         b_conv.is_owned = false;
57873         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
57874         return ret_conv;
57875 }
57876
57877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1directional_1info(JNIEnv *env, jclass clz, int64_t this_arg, int8_t channel_flags) {
57878         LDKChannelInfo this_arg_conv;
57879         this_arg_conv.inner = untag_ptr(this_arg);
57880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57882         this_arg_conv.is_owned = false;
57883         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
57884         int64_t ret_ref = 0;
57885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57887         return ret_ref;
57888 }
57889
57890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
57891         LDKChannelInfo obj_conv;
57892         obj_conv.inner = untag_ptr(obj);
57893         obj_conv.is_owned = ptr_is_owned(obj);
57894         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57895         obj_conv.is_owned = false;
57896         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
57897         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57898         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57899         CVec_u8Z_free(ret_var);
57900         return ret_arr;
57901 }
57902
57903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57904         LDKu8slice ser_ref;
57905         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57906         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57907         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
57908         *ret_conv = ChannelInfo_read(ser_ref);
57909         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57910         return tag_ptr(ret_conv, true);
57911 }
57912
57913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57914         LDKDirectedChannelInfo this_obj_conv;
57915         this_obj_conv.inner = untag_ptr(this_obj);
57916         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57918         DirectedChannelInfo_free(this_obj_conv);
57919 }
57920
57921 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
57922         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
57923         int64_t ret_ref = 0;
57924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57926         return ret_ref;
57927 }
57928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57929         LDKDirectedChannelInfo arg_conv;
57930         arg_conv.inner = untag_ptr(arg);
57931         arg_conv.is_owned = ptr_is_owned(arg);
57932         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57933         arg_conv.is_owned = false;
57934         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
57935         return ret_conv;
57936 }
57937
57938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57939         LDKDirectedChannelInfo orig_conv;
57940         orig_conv.inner = untag_ptr(orig);
57941         orig_conv.is_owned = ptr_is_owned(orig);
57942         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57943         orig_conv.is_owned = false;
57944         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
57945         int64_t ret_ref = 0;
57946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57948         return ret_ref;
57949 }
57950
57951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
57952         LDKDirectedChannelInfo this_arg_conv;
57953         this_arg_conv.inner = untag_ptr(this_arg);
57954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57956         this_arg_conv.is_owned = false;
57957         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
57958         int64_t ret_ref = 0;
57959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57961         return ret_ref;
57962 }
57963
57964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
57965         LDKDirectedChannelInfo this_arg_conv;
57966         this_arg_conv.inner = untag_ptr(this_arg);
57967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57969         this_arg_conv.is_owned = false;
57970         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
57971         return ret_conv;
57972 }
57973
57974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
57975         LDKDirectedChannelInfo this_arg_conv;
57976         this_arg_conv.inner = untag_ptr(this_arg);
57977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57979         this_arg_conv.is_owned = false;
57980         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57981         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
57982         int64_t ret_ref = tag_ptr(ret_copy, true);
57983         return ret_ref;
57984 }
57985
57986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57987         if (!ptr_is_owned(this_ptr)) return;
57988         void* this_ptr_ptr = untag_ptr(this_ptr);
57989         CHECK_ACCESS(this_ptr_ptr);
57990         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
57991         FREE(untag_ptr(this_ptr));
57992         EffectiveCapacity_free(this_ptr_conv);
57993 }
57994
57995 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
57996         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57997         *ret_copy = EffectiveCapacity_clone(arg);
57998         int64_t ret_ref = tag_ptr(ret_copy, true);
57999         return ret_ref;
58000 }
58001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58002         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
58003         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
58004         return ret_conv;
58005 }
58006
58007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58008         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
58009         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58010         *ret_copy = EffectiveCapacity_clone(orig_conv);
58011         int64_t ret_ref = tag_ptr(ret_copy, true);
58012         return ret_ref;
58013 }
58014
58015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
58016         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58017         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
58018         int64_t ret_ref = tag_ptr(ret_copy, true);
58019         return ret_ref;
58020 }
58021
58022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
58023         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58024         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
58025         int64_t ret_ref = tag_ptr(ret_copy, true);
58026         return ret_ref;
58027 }
58028
58029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
58030         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58031         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
58032         int64_t ret_ref = tag_ptr(ret_copy, true);
58033         return ret_ref;
58034 }
58035
58036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
58037         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58038         *ret_copy = EffectiveCapacity_infinite();
58039         int64_t ret_ref = tag_ptr(ret_copy, true);
58040         return ret_ref;
58041 }
58042
58043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
58044         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58045         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
58046         int64_t ret_ref = tag_ptr(ret_copy, true);
58047         return ret_ref;
58048 }
58049
58050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
58051         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58052         *ret_copy = EffectiveCapacity_unknown();
58053         int64_t ret_ref = tag_ptr(ret_copy, true);
58054         return ret_ref;
58055 }
58056
58057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
58058         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
58059         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
58060         return ret_conv;
58061 }
58062
58063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58064         LDKRoutingFees this_obj_conv;
58065         this_obj_conv.inner = untag_ptr(this_obj);
58066         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58068         RoutingFees_free(this_obj_conv);
58069 }
58070
58071 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58072         LDKRoutingFees this_ptr_conv;
58073         this_ptr_conv.inner = untag_ptr(this_ptr);
58074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58076         this_ptr_conv.is_owned = false;
58077         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
58078         return ret_conv;
58079 }
58080
58081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58082         LDKRoutingFees this_ptr_conv;
58083         this_ptr_conv.inner = untag_ptr(this_ptr);
58084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58086         this_ptr_conv.is_owned = false;
58087         RoutingFees_set_base_msat(&this_ptr_conv, val);
58088 }
58089
58090 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
58091         LDKRoutingFees this_ptr_conv;
58092         this_ptr_conv.inner = untag_ptr(this_ptr);
58093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58095         this_ptr_conv.is_owned = false;
58096         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
58097         return ret_conv;
58098 }
58099
58100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58101         LDKRoutingFees this_ptr_conv;
58102         this_ptr_conv.inner = untag_ptr(this_ptr);
58103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58105         this_ptr_conv.is_owned = false;
58106         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
58107 }
58108
58109 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) {
58110         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
58111         int64_t ret_ref = 0;
58112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58114         return ret_ref;
58115 }
58116
58117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58118         LDKRoutingFees a_conv;
58119         a_conv.inner = untag_ptr(a);
58120         a_conv.is_owned = ptr_is_owned(a);
58121         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58122         a_conv.is_owned = false;
58123         LDKRoutingFees b_conv;
58124         b_conv.inner = untag_ptr(b);
58125         b_conv.is_owned = ptr_is_owned(b);
58126         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58127         b_conv.is_owned = false;
58128         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
58129         return ret_conv;
58130 }
58131
58132 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
58133         LDKRoutingFees ret_var = RoutingFees_clone(arg);
58134         int64_t ret_ref = 0;
58135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58137         return ret_ref;
58138 }
58139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58140         LDKRoutingFees arg_conv;
58141         arg_conv.inner = untag_ptr(arg);
58142         arg_conv.is_owned = ptr_is_owned(arg);
58143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58144         arg_conv.is_owned = false;
58145         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
58146         return ret_conv;
58147 }
58148
58149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58150         LDKRoutingFees orig_conv;
58151         orig_conv.inner = untag_ptr(orig);
58152         orig_conv.is_owned = ptr_is_owned(orig);
58153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58154         orig_conv.is_owned = false;
58155         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
58156         int64_t ret_ref = 0;
58157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58159         return ret_ref;
58160 }
58161
58162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
58163         LDKRoutingFees o_conv;
58164         o_conv.inner = untag_ptr(o);
58165         o_conv.is_owned = ptr_is_owned(o);
58166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58167         o_conv.is_owned = false;
58168         int64_t ret_conv = RoutingFees_hash(&o_conv);
58169         return ret_conv;
58170 }
58171
58172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
58173         LDKRoutingFees obj_conv;
58174         obj_conv.inner = untag_ptr(obj);
58175         obj_conv.is_owned = ptr_is_owned(obj);
58176         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58177         obj_conv.is_owned = false;
58178         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
58179         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58180         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58181         CVec_u8Z_free(ret_var);
58182         return ret_arr;
58183 }
58184
58185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58186         LDKu8slice ser_ref;
58187         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58188         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58189         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
58190         *ret_conv = RoutingFees_read(ser_ref);
58191         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58192         return tag_ptr(ret_conv, true);
58193 }
58194
58195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58196         LDKNodeAnnouncementInfo this_obj_conv;
58197         this_obj_conv.inner = untag_ptr(this_obj);
58198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58200         NodeAnnouncementInfo_free(this_obj_conv);
58201 }
58202
58203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
58204         LDKNodeAnnouncementInfo this_ptr_conv;
58205         this_ptr_conv.inner = untag_ptr(this_ptr);
58206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58208         this_ptr_conv.is_owned = false;
58209         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
58210         int64_t ret_ref = 0;
58211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58213         return ret_ref;
58214 }
58215
58216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58217         LDKNodeAnnouncementInfo this_ptr_conv;
58218         this_ptr_conv.inner = untag_ptr(this_ptr);
58219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58221         this_ptr_conv.is_owned = false;
58222         LDKNodeFeatures val_conv;
58223         val_conv.inner = untag_ptr(val);
58224         val_conv.is_owned = ptr_is_owned(val);
58225         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58226         val_conv = NodeFeatures_clone(&val_conv);
58227         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
58228 }
58229
58230 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
58231         LDKNodeAnnouncementInfo this_ptr_conv;
58232         this_ptr_conv.inner = untag_ptr(this_ptr);
58233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58235         this_ptr_conv.is_owned = false;
58236         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
58237         return ret_conv;
58238 }
58239
58240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58241         LDKNodeAnnouncementInfo this_ptr_conv;
58242         this_ptr_conv.inner = untag_ptr(this_ptr);
58243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58245         this_ptr_conv.is_owned = false;
58246         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
58247 }
58248
58249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
58250         LDKNodeAnnouncementInfo this_ptr_conv;
58251         this_ptr_conv.inner = untag_ptr(this_ptr);
58252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58254         this_ptr_conv.is_owned = false;
58255         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
58256         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
58257         return ret_arr;
58258 }
58259
58260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58261         LDKNodeAnnouncementInfo this_ptr_conv;
58262         this_ptr_conv.inner = untag_ptr(this_ptr);
58263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58265         this_ptr_conv.is_owned = false;
58266         LDKThreeBytes val_ref;
58267         CHECK((*env)->GetArrayLength(env, val) == 3);
58268         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
58269         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
58270 }
58271
58272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
58273         LDKNodeAnnouncementInfo this_ptr_conv;
58274         this_ptr_conv.inner = untag_ptr(this_ptr);
58275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58277         this_ptr_conv.is_owned = false;
58278         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
58279         int64_t ret_ref = 0;
58280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58282         return ret_ref;
58283 }
58284
58285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58286         LDKNodeAnnouncementInfo this_ptr_conv;
58287         this_ptr_conv.inner = untag_ptr(this_ptr);
58288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58290         this_ptr_conv.is_owned = false;
58291         LDKNodeAlias val_conv;
58292         val_conv.inner = untag_ptr(val);
58293         val_conv.is_owned = ptr_is_owned(val);
58294         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58295         val_conv = NodeAlias_clone(&val_conv);
58296         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
58297 }
58298
58299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
58300         LDKNodeAnnouncementInfo this_ptr_conv;
58301         this_ptr_conv.inner = untag_ptr(this_ptr);
58302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58304         this_ptr_conv.is_owned = false;
58305         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
58306         int64_t ret_ref = 0;
58307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58309         return ret_ref;
58310 }
58311
58312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58313         LDKNodeAnnouncementInfo this_ptr_conv;
58314         this_ptr_conv.inner = untag_ptr(this_ptr);
58315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58317         this_ptr_conv.is_owned = false;
58318         LDKNodeAnnouncement val_conv;
58319         val_conv.inner = untag_ptr(val);
58320         val_conv.is_owned = ptr_is_owned(val);
58321         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58322         val_conv = NodeAnnouncement_clone(&val_conv);
58323         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
58324 }
58325
58326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int64_t alias_arg, int64_t announcement_message_arg) {
58327         LDKNodeFeatures features_arg_conv;
58328         features_arg_conv.inner = untag_ptr(features_arg);
58329         features_arg_conv.is_owned = ptr_is_owned(features_arg);
58330         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
58331         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
58332         LDKThreeBytes rgb_arg_ref;
58333         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
58334         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
58335         LDKNodeAlias alias_arg_conv;
58336         alias_arg_conv.inner = untag_ptr(alias_arg);
58337         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
58338         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
58339         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
58340         LDKNodeAnnouncement announcement_message_arg_conv;
58341         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
58342         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
58343         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
58344         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
58345         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
58346         int64_t ret_ref = 0;
58347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58349         return ret_ref;
58350 }
58351
58352 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
58353         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
58354         int64_t ret_ref = 0;
58355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58357         return ret_ref;
58358 }
58359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58360         LDKNodeAnnouncementInfo arg_conv;
58361         arg_conv.inner = untag_ptr(arg);
58362         arg_conv.is_owned = ptr_is_owned(arg);
58363         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58364         arg_conv.is_owned = false;
58365         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
58366         return ret_conv;
58367 }
58368
58369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58370         LDKNodeAnnouncementInfo orig_conv;
58371         orig_conv.inner = untag_ptr(orig);
58372         orig_conv.is_owned = ptr_is_owned(orig);
58373         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58374         orig_conv.is_owned = false;
58375         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
58376         int64_t ret_ref = 0;
58377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58379         return ret_ref;
58380 }
58381
58382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58383         LDKNodeAnnouncementInfo a_conv;
58384         a_conv.inner = untag_ptr(a);
58385         a_conv.is_owned = ptr_is_owned(a);
58386         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58387         a_conv.is_owned = false;
58388         LDKNodeAnnouncementInfo b_conv;
58389         b_conv.inner = untag_ptr(b);
58390         b_conv.is_owned = ptr_is_owned(b);
58391         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58392         b_conv.is_owned = false;
58393         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
58394         return ret_conv;
58395 }
58396
58397 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
58398         LDKNodeAnnouncementInfo this_arg_conv;
58399         this_arg_conv.inner = untag_ptr(this_arg);
58400         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58402         this_arg_conv.is_owned = false;
58403         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
58404         int64_tArray ret_arr = NULL;
58405         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58406         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58407         for (size_t m = 0; m < ret_var.datalen; m++) {
58408                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
58409                 *ret_conv_12_copy = ret_var.data[m];
58410                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
58411                 ret_arr_ptr[m] = ret_conv_12_ref;
58412         }
58413         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58414         FREE(ret_var.data);
58415         return ret_arr;
58416 }
58417
58418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
58419         LDKNodeAnnouncementInfo obj_conv;
58420         obj_conv.inner = untag_ptr(obj);
58421         obj_conv.is_owned = ptr_is_owned(obj);
58422         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58423         obj_conv.is_owned = false;
58424         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
58425         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58426         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58427         CVec_u8Z_free(ret_var);
58428         return ret_arr;
58429 }
58430
58431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58432         LDKu8slice ser_ref;
58433         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58434         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58435         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
58436         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
58437         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58438         return tag_ptr(ret_conv, true);
58439 }
58440
58441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58442         LDKNodeAlias this_obj_conv;
58443         this_obj_conv.inner = untag_ptr(this_obj);
58444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58446         NodeAlias_free(this_obj_conv);
58447 }
58448
58449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
58450         LDKNodeAlias this_ptr_conv;
58451         this_ptr_conv.inner = untag_ptr(this_ptr);
58452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58454         this_ptr_conv.is_owned = false;
58455         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58456         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
58457         return ret_arr;
58458 }
58459
58460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58461         LDKNodeAlias this_ptr_conv;
58462         this_ptr_conv.inner = untag_ptr(this_ptr);
58463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58465         this_ptr_conv.is_owned = false;
58466         LDKThirtyTwoBytes val_ref;
58467         CHECK((*env)->GetArrayLength(env, val) == 32);
58468         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58469         NodeAlias_set_a(&this_ptr_conv, val_ref);
58470 }
58471
58472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
58473         LDKThirtyTwoBytes a_arg_ref;
58474         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
58475         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
58476         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
58477         int64_t ret_ref = 0;
58478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58480         return ret_ref;
58481 }
58482
58483 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
58484         LDKNodeAlias ret_var = NodeAlias_clone(arg);
58485         int64_t ret_ref = 0;
58486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58488         return ret_ref;
58489 }
58490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58491         LDKNodeAlias arg_conv;
58492         arg_conv.inner = untag_ptr(arg);
58493         arg_conv.is_owned = ptr_is_owned(arg);
58494         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58495         arg_conv.is_owned = false;
58496         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
58497         return ret_conv;
58498 }
58499
58500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58501         LDKNodeAlias orig_conv;
58502         orig_conv.inner = untag_ptr(orig);
58503         orig_conv.is_owned = ptr_is_owned(orig);
58504         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58505         orig_conv.is_owned = false;
58506         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
58507         int64_t ret_ref = 0;
58508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58510         return ret_ref;
58511 }
58512
58513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58514         LDKNodeAlias a_conv;
58515         a_conv.inner = untag_ptr(a);
58516         a_conv.is_owned = ptr_is_owned(a);
58517         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58518         a_conv.is_owned = false;
58519         LDKNodeAlias b_conv;
58520         b_conv.inner = untag_ptr(b);
58521         b_conv.is_owned = ptr_is_owned(b);
58522         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58523         b_conv.is_owned = false;
58524         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
58525         return ret_conv;
58526 }
58527
58528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
58529         LDKNodeAlias obj_conv;
58530         obj_conv.inner = untag_ptr(obj);
58531         obj_conv.is_owned = ptr_is_owned(obj);
58532         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58533         obj_conv.is_owned = false;
58534         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
58535         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58536         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58537         CVec_u8Z_free(ret_var);
58538         return ret_arr;
58539 }
58540
58541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58542         LDKu8slice ser_ref;
58543         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58544         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58545         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
58546         *ret_conv = NodeAlias_read(ser_ref);
58547         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58548         return tag_ptr(ret_conv, true);
58549 }
58550
58551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58552         LDKNodeInfo this_obj_conv;
58553         this_obj_conv.inner = untag_ptr(this_obj);
58554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58556         NodeInfo_free(this_obj_conv);
58557 }
58558
58559 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
58560         LDKNodeInfo this_ptr_conv;
58561         this_ptr_conv.inner = untag_ptr(this_ptr);
58562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58564         this_ptr_conv.is_owned = false;
58565         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
58566         int64_tArray ret_arr = NULL;
58567         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58568         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58569         for (size_t g = 0; g < ret_var.datalen; g++) {
58570                 int64_t ret_conv_6_conv = ret_var.data[g];
58571                 ret_arr_ptr[g] = ret_conv_6_conv;
58572         }
58573         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58574         FREE(ret_var.data);
58575         return ret_arr;
58576 }
58577
58578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
58579         LDKNodeInfo this_ptr_conv;
58580         this_ptr_conv.inner = untag_ptr(this_ptr);
58581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58583         this_ptr_conv.is_owned = false;
58584         LDKCVec_u64Z val_constr;
58585         val_constr.datalen = (*env)->GetArrayLength(env, val);
58586         if (val_constr.datalen > 0)
58587                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
58588         else
58589                 val_constr.data = NULL;
58590         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
58591         for (size_t g = 0; g < val_constr.datalen; g++) {
58592                 int64_t val_conv_6 = val_vals[g];
58593                 val_constr.data[g] = val_conv_6;
58594         }
58595         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
58596         NodeInfo_set_channels(&this_ptr_conv, val_constr);
58597 }
58598
58599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
58600         LDKNodeInfo this_ptr_conv;
58601         this_ptr_conv.inner = untag_ptr(this_ptr);
58602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58604         this_ptr_conv.is_owned = false;
58605         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
58606         int64_t ret_ref = 0;
58607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58609         return ret_ref;
58610 }
58611
58612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58613         LDKNodeInfo this_ptr_conv;
58614         this_ptr_conv.inner = untag_ptr(this_ptr);
58615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58617         this_ptr_conv.is_owned = false;
58618         LDKNodeAnnouncementInfo val_conv;
58619         val_conv.inner = untag_ptr(val);
58620         val_conv.is_owned = ptr_is_owned(val);
58621         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58622         val_conv = NodeAnnouncementInfo_clone(&val_conv);
58623         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
58624 }
58625
58626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
58627         LDKCVec_u64Z channels_arg_constr;
58628         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
58629         if (channels_arg_constr.datalen > 0)
58630                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
58631         else
58632                 channels_arg_constr.data = NULL;
58633         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
58634         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
58635                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
58636                 channels_arg_constr.data[g] = channels_arg_conv_6;
58637         }
58638         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
58639         LDKNodeAnnouncementInfo announcement_info_arg_conv;
58640         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
58641         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
58642         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
58643         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
58644         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
58645         int64_t ret_ref = 0;
58646         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58647         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58648         return ret_ref;
58649 }
58650
58651 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
58652         LDKNodeInfo ret_var = NodeInfo_clone(arg);
58653         int64_t ret_ref = 0;
58654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58656         return ret_ref;
58657 }
58658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58659         LDKNodeInfo arg_conv;
58660         arg_conv.inner = untag_ptr(arg);
58661         arg_conv.is_owned = ptr_is_owned(arg);
58662         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58663         arg_conv.is_owned = false;
58664         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
58665         return ret_conv;
58666 }
58667
58668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58669         LDKNodeInfo orig_conv;
58670         orig_conv.inner = untag_ptr(orig);
58671         orig_conv.is_owned = ptr_is_owned(orig);
58672         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58673         orig_conv.is_owned = false;
58674         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
58675         int64_t ret_ref = 0;
58676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58678         return ret_ref;
58679 }
58680
58681 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58682         LDKNodeInfo a_conv;
58683         a_conv.inner = untag_ptr(a);
58684         a_conv.is_owned = ptr_is_owned(a);
58685         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58686         a_conv.is_owned = false;
58687         LDKNodeInfo b_conv;
58688         b_conv.inner = untag_ptr(b);
58689         b_conv.is_owned = ptr_is_owned(b);
58690         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58691         b_conv.is_owned = false;
58692         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
58693         return ret_conv;
58694 }
58695
58696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
58697         LDKNodeInfo obj_conv;
58698         obj_conv.inner = untag_ptr(obj);
58699         obj_conv.is_owned = ptr_is_owned(obj);
58700         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58701         obj_conv.is_owned = false;
58702         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
58703         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58704         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58705         CVec_u8Z_free(ret_var);
58706         return ret_arr;
58707 }
58708
58709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58710         LDKu8slice ser_ref;
58711         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58712         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58713         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
58714         *ret_conv = NodeInfo_read(ser_ref);
58715         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58716         return tag_ptr(ret_conv, true);
58717 }
58718
58719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
58720         LDKNetworkGraph obj_conv;
58721         obj_conv.inner = untag_ptr(obj);
58722         obj_conv.is_owned = ptr_is_owned(obj);
58723         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58724         obj_conv.is_owned = false;
58725         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
58726         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58727         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58728         CVec_u8Z_free(ret_var);
58729         return ret_arr;
58730 }
58731
58732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
58733         LDKu8slice ser_ref;
58734         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58735         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58736         void* arg_ptr = untag_ptr(arg);
58737         CHECK_ACCESS(arg_ptr);
58738         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
58739         if (arg_conv.free == LDKLogger_JCalls_free) {
58740                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58741                 LDKLogger_JCalls_cloned(&arg_conv);
58742         }
58743         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
58744         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
58745         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58746         return tag_ptr(ret_conv, true);
58747 }
58748
58749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
58750         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
58751         void* logger_ptr = untag_ptr(logger);
58752         CHECK_ACCESS(logger_ptr);
58753         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
58754         if (logger_conv.free == LDKLogger_JCalls_free) {
58755                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58756                 LDKLogger_JCalls_cloned(&logger_conv);
58757         }
58758         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
58759         int64_t ret_ref = 0;
58760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58762         return ret_ref;
58763 }
58764
58765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
58766         LDKNetworkGraph this_arg_conv;
58767         this_arg_conv.inner = untag_ptr(this_arg);
58768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58770         this_arg_conv.is_owned = false;
58771         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
58772         int64_t ret_ref = 0;
58773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58775         return ret_ref;
58776 }
58777
58778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
58779         LDKNetworkGraph this_arg_conv;
58780         this_arg_conv.inner = untag_ptr(this_arg);
58781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58783         this_arg_conv.is_owned = false;
58784         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
58785         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
58786         int64_t ret_ref = tag_ptr(ret_copy, true);
58787         return ret_ref;
58788 }
58789
58790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1set_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg, int32_t last_rapid_gossip_sync_timestamp) {
58791         LDKNetworkGraph this_arg_conv;
58792         this_arg_conv.inner = untag_ptr(this_arg);
58793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58795         this_arg_conv.is_owned = false;
58796         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
58797 }
58798
58799 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) {
58800         LDKNetworkGraph this_arg_conv;
58801         this_arg_conv.inner = untag_ptr(this_arg);
58802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58804         this_arg_conv.is_owned = false;
58805         LDKNodeAnnouncement msg_conv;
58806         msg_conv.inner = untag_ptr(msg);
58807         msg_conv.is_owned = ptr_is_owned(msg);
58808         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58809         msg_conv.is_owned = false;
58810         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58811         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
58812         return tag_ptr(ret_conv, true);
58813 }
58814
58815 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) {
58816         LDKNetworkGraph this_arg_conv;
58817         this_arg_conv.inner = untag_ptr(this_arg);
58818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58820         this_arg_conv.is_owned = false;
58821         LDKUnsignedNodeAnnouncement msg_conv;
58822         msg_conv.inner = untag_ptr(msg);
58823         msg_conv.is_owned = ptr_is_owned(msg);
58824         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58825         msg_conv.is_owned = false;
58826         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58827         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
58828         return tag_ptr(ret_conv, true);
58829 }
58830
58831 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 utxo_lookup) {
58832         LDKNetworkGraph this_arg_conv;
58833         this_arg_conv.inner = untag_ptr(this_arg);
58834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58836         this_arg_conv.is_owned = false;
58837         LDKChannelAnnouncement msg_conv;
58838         msg_conv.inner = untag_ptr(msg);
58839         msg_conv.is_owned = ptr_is_owned(msg);
58840         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58841         msg_conv.is_owned = false;
58842         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
58843         CHECK_ACCESS(utxo_lookup_ptr);
58844         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
58845         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
58846         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
58847                 // Manually implement clone for Java trait instances
58848                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
58849                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58850                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
58851                 }
58852         }
58853         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58854         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
58855         return tag_ptr(ret_conv, true);
58856 }
58857
58858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement_1no_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
58859         LDKNetworkGraph this_arg_conv;
58860         this_arg_conv.inner = untag_ptr(this_arg);
58861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58863         this_arg_conv.is_owned = false;
58864         LDKChannelAnnouncement msg_conv;
58865         msg_conv.inner = untag_ptr(msg);
58866         msg_conv.is_owned = ptr_is_owned(msg);
58867         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58868         msg_conv.is_owned = false;
58869         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58870         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
58871         return tag_ptr(ret_conv, true);
58872 }
58873
58874 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 utxo_lookup) {
58875         LDKNetworkGraph this_arg_conv;
58876         this_arg_conv.inner = untag_ptr(this_arg);
58877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58879         this_arg_conv.is_owned = false;
58880         LDKUnsignedChannelAnnouncement msg_conv;
58881         msg_conv.inner = untag_ptr(msg);
58882         msg_conv.is_owned = ptr_is_owned(msg);
58883         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58884         msg_conv.is_owned = false;
58885         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
58886         CHECK_ACCESS(utxo_lookup_ptr);
58887         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
58888         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
58889         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
58890                 // Manually implement clone for Java trait instances
58891                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
58892                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58893                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
58894                 }
58895         }
58896         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58897         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
58898         return tag_ptr(ret_conv, true);
58899 }
58900
58901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1add_1channel_1from_1partial_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t timestamp, int64_t features, int8_tArray node_id_1, int8_tArray node_id_2) {
58902         LDKNetworkGraph this_arg_conv;
58903         this_arg_conv.inner = untag_ptr(this_arg);
58904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58906         this_arg_conv.is_owned = false;
58907         LDKChannelFeatures features_conv;
58908         features_conv.inner = untag_ptr(features);
58909         features_conv.is_owned = ptr_is_owned(features);
58910         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58911         features_conv = ChannelFeatures_clone(&features_conv);
58912         LDKPublicKey node_id_1_ref;
58913         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
58914         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
58915         LDKPublicKey node_id_2_ref;
58916         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
58917         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
58918         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58919         *ret_conv = NetworkGraph_add_channel_from_partial_announcement(&this_arg_conv, short_channel_id, timestamp, features_conv, node_id_1_ref, node_id_2_ref);
58920         return tag_ptr(ret_conv, true);
58921 }
58922
58923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1channel_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
58924         LDKNetworkGraph this_arg_conv;
58925         this_arg_conv.inner = untag_ptr(this_arg);
58926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58928         this_arg_conv.is_owned = false;
58929         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
58930 }
58931
58932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
58933         LDKNetworkGraph this_arg_conv;
58934         this_arg_conv.inner = untag_ptr(this_arg);
58935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58937         this_arg_conv.is_owned = false;
58938         LDKPublicKey node_id_ref;
58939         CHECK((*env)->GetArrayLength(env, node_id) == 33);
58940         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
58941         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
58942 }
58943
58944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
58945         LDKNetworkGraph this_arg_conv;
58946         this_arg_conv.inner = untag_ptr(this_arg);
58947         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58949         this_arg_conv.is_owned = false;
58950         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
58951 }
58952
58953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) {
58954         LDKNetworkGraph this_arg_conv;
58955         this_arg_conv.inner = untag_ptr(this_arg);
58956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58958         this_arg_conv.is_owned = false;
58959         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
58960 }
58961
58962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
58963         LDKNetworkGraph this_arg_conv;
58964         this_arg_conv.inner = untag_ptr(this_arg);
58965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58967         this_arg_conv.is_owned = false;
58968         LDKChannelUpdate msg_conv;
58969         msg_conv.inner = untag_ptr(msg);
58970         msg_conv.is_owned = ptr_is_owned(msg);
58971         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58972         msg_conv.is_owned = false;
58973         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58974         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
58975         return tag_ptr(ret_conv, true);
58976 }
58977
58978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
58979         LDKNetworkGraph this_arg_conv;
58980         this_arg_conv.inner = untag_ptr(this_arg);
58981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58983         this_arg_conv.is_owned = false;
58984         LDKUnsignedChannelUpdate msg_conv;
58985         msg_conv.inner = untag_ptr(msg);
58986         msg_conv.is_owned = ptr_is_owned(msg);
58987         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58988         msg_conv.is_owned = false;
58989         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58990         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
58991         return tag_ptr(ret_conv, true);
58992 }
58993
58994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
58995         LDKReadOnlyNetworkGraph this_arg_conv;
58996         this_arg_conv.inner = untag_ptr(this_arg);
58997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58999         this_arg_conv.is_owned = false;
59000         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
59001         int64_t ret_ref = 0;
59002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59004         return ret_ref;
59005 }
59006
59007 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
59008         LDKReadOnlyNetworkGraph this_arg_conv;
59009         this_arg_conv.inner = untag_ptr(this_arg);
59010         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59012         this_arg_conv.is_owned = false;
59013         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
59014         int64_tArray ret_arr = NULL;
59015         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59016         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59017         for (size_t g = 0; g < ret_var.datalen; g++) {
59018                 int64_t ret_conv_6_conv = ret_var.data[g];
59019                 ret_arr_ptr[g] = ret_conv_6_conv;
59020         }
59021         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59022         FREE(ret_var.data);
59023         return ret_arr;
59024 }
59025
59026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
59027         LDKReadOnlyNetworkGraph this_arg_conv;
59028         this_arg_conv.inner = untag_ptr(this_arg);
59029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59031         this_arg_conv.is_owned = false;
59032         LDKNodeId node_id_conv;
59033         node_id_conv.inner = untag_ptr(node_id);
59034         node_id_conv.is_owned = ptr_is_owned(node_id);
59035         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
59036         node_id_conv.is_owned = false;
59037         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
59038         int64_t ret_ref = 0;
59039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59041         return ret_ref;
59042 }
59043
59044 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
59045         LDKReadOnlyNetworkGraph this_arg_conv;
59046         this_arg_conv.inner = untag_ptr(this_arg);
59047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59049         this_arg_conv.is_owned = false;
59050         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
59051         int64_tArray ret_arr = NULL;
59052         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59053         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59054         for (size_t i = 0; i < ret_var.datalen; i++) {
59055                 LDKNodeId ret_conv_8_var = ret_var.data[i];
59056                 int64_t ret_conv_8_ref = 0;
59057                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
59058                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
59059                 ret_arr_ptr[i] = ret_conv_8_ref;
59060         }
59061         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59062         FREE(ret_var.data);
59063         return ret_arr;
59064 }
59065
59066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
59067         LDKReadOnlyNetworkGraph this_arg_conv;
59068         this_arg_conv.inner = untag_ptr(this_arg);
59069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59071         this_arg_conv.is_owned = false;
59072         LDKPublicKey pubkey_ref;
59073         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
59074         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
59075         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
59076         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
59077         int64_t ret_ref = tag_ptr(ret_copy, true);
59078         return ret_ref;
59079 }
59080
59081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59082         LDKDefaultRouter this_obj_conv;
59083         this_obj_conv.inner = untag_ptr(this_obj);
59084         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59086         DefaultRouter_free(this_obj_conv);
59087 }
59088
59089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes, int64_t scorer, int64_t score_params) {
59090         LDKNetworkGraph network_graph_conv;
59091         network_graph_conv.inner = untag_ptr(network_graph);
59092         network_graph_conv.is_owned = ptr_is_owned(network_graph);
59093         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
59094         network_graph_conv.is_owned = false;
59095         void* logger_ptr = untag_ptr(logger);
59096         CHECK_ACCESS(logger_ptr);
59097         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
59098         if (logger_conv.free == LDKLogger_JCalls_free) {
59099                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59100                 LDKLogger_JCalls_cloned(&logger_conv);
59101         }
59102         LDKThirtyTwoBytes random_seed_bytes_ref;
59103         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
59104         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
59105         void* scorer_ptr = untag_ptr(scorer);
59106         CHECK_ACCESS(scorer_ptr);
59107         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
59108         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
59109                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59110                 LDKLockableScore_JCalls_cloned(&scorer_conv);
59111         }
59112         LDKProbabilisticScoringFeeParameters score_params_conv;
59113         score_params_conv.inner = untag_ptr(score_params);
59114         score_params_conv.is_owned = ptr_is_owned(score_params);
59115         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
59116         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
59117         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
59118         int64_t ret_ref = 0;
59119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59121         return ret_ref;
59122 }
59123
59124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
59125         LDKDefaultRouter this_arg_conv;
59126         this_arg_conv.inner = untag_ptr(this_arg);
59127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59129         this_arg_conv.is_owned = false;
59130         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
59131         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
59132         return tag_ptr(ret_ret, true);
59133 }
59134
59135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
59136         if (!ptr_is_owned(this_ptr)) return;
59137         void* this_ptr_ptr = untag_ptr(this_ptr);
59138         CHECK_ACCESS(this_ptr_ptr);
59139         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
59140         FREE(untag_ptr(this_ptr));
59141         Router_free(this_ptr_conv);
59142 }
59143
59144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59145         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
59146         this_obj_conv.inner = untag_ptr(this_obj);
59147         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59149         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
59150 }
59151
59152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
59153         void* scorer_ptr = untag_ptr(scorer);
59154         CHECK_ACCESS(scorer_ptr);
59155         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
59156         if (scorer_conv.free == LDKScore_JCalls_free) {
59157                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59158                 LDKScore_JCalls_cloned(&scorer_conv);
59159         }
59160         LDKInFlightHtlcs inflight_htlcs_conv;
59161         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
59162         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
59163         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
59164         inflight_htlcs_conv.is_owned = false;
59165         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
59166         int64_t ret_ref = 0;
59167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59169         return ret_ref;
59170 }
59171
59172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
59173         LDKScorerAccountingForInFlightHtlcs obj_conv;
59174         obj_conv.inner = untag_ptr(obj);
59175         obj_conv.is_owned = ptr_is_owned(obj);
59176         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59177         obj_conv.is_owned = false;
59178         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
59179         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59180         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59181         CVec_u8Z_free(ret_var);
59182         return ret_arr;
59183 }
59184
59185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
59186         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
59187         this_arg_conv.inner = untag_ptr(this_arg);
59188         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59190         this_arg_conv.is_owned = false;
59191         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
59192         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
59193         return tag_ptr(ret_ret, true);
59194 }
59195
59196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59197         LDKInFlightHtlcs this_obj_conv;
59198         this_obj_conv.inner = untag_ptr(this_obj);
59199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59201         InFlightHtlcs_free(this_obj_conv);
59202 }
59203
59204 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
59205         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
59206         int64_t ret_ref = 0;
59207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59209         return ret_ref;
59210 }
59211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59212         LDKInFlightHtlcs arg_conv;
59213         arg_conv.inner = untag_ptr(arg);
59214         arg_conv.is_owned = ptr_is_owned(arg);
59215         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59216         arg_conv.is_owned = false;
59217         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
59218         return ret_conv;
59219 }
59220
59221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59222         LDKInFlightHtlcs orig_conv;
59223         orig_conv.inner = untag_ptr(orig);
59224         orig_conv.is_owned = ptr_is_owned(orig);
59225         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59226         orig_conv.is_owned = false;
59227         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
59228         int64_t ret_ref = 0;
59229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59231         return ret_ref;
59232 }
59233
59234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
59235         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
59236         int64_t ret_ref = 0;
59237         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59238         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59239         return ret_ref;
59240 }
59241
59242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1process_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int8_tArray payer_node_id) {
59243         LDKInFlightHtlcs this_arg_conv;
59244         this_arg_conv.inner = untag_ptr(this_arg);
59245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59247         this_arg_conv.is_owned = false;
59248         LDKPath path_conv;
59249         path_conv.inner = untag_ptr(path);
59250         path_conv.is_owned = ptr_is_owned(path);
59251         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59252         path_conv.is_owned = false;
59253         LDKPublicKey payer_node_id_ref;
59254         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
59255         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
59256         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
59257 }
59258
59259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1add_1inflight_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid, int64_t used_msat) {
59260         LDKInFlightHtlcs this_arg_conv;
59261         this_arg_conv.inner = untag_ptr(this_arg);
59262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59264         this_arg_conv.is_owned = false;
59265         LDKNodeId source_conv;
59266         source_conv.inner = untag_ptr(source);
59267         source_conv.is_owned = ptr_is_owned(source);
59268         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
59269         source_conv.is_owned = false;
59270         LDKNodeId target_conv;
59271         target_conv.inner = untag_ptr(target);
59272         target_conv.is_owned = ptr_is_owned(target);
59273         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
59274         target_conv.is_owned = false;
59275         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
59276 }
59277
59278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1used_1liquidity_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t source, int64_t target, int64_t channel_scid) {
59279         LDKInFlightHtlcs this_arg_conv;
59280         this_arg_conv.inner = untag_ptr(this_arg);
59281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59283         this_arg_conv.is_owned = false;
59284         LDKNodeId source_conv;
59285         source_conv.inner = untag_ptr(source);
59286         source_conv.is_owned = ptr_is_owned(source);
59287         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
59288         source_conv.is_owned = false;
59289         LDKNodeId target_conv;
59290         target_conv.inner = untag_ptr(target);
59291         target_conv.is_owned = ptr_is_owned(target);
59292         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
59293         target_conv.is_owned = false;
59294         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59295         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
59296         int64_t ret_ref = tag_ptr(ret_copy, true);
59297         return ret_ref;
59298 }
59299
59300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
59301         LDKInFlightHtlcs obj_conv;
59302         obj_conv.inner = untag_ptr(obj);
59303         obj_conv.is_owned = ptr_is_owned(obj);
59304         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59305         obj_conv.is_owned = false;
59306         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
59307         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59308         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59309         CVec_u8Z_free(ret_var);
59310         return ret_arr;
59311 }
59312
59313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59314         LDKu8slice ser_ref;
59315         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59316         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59317         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
59318         *ret_conv = InFlightHtlcs_read(ser_ref);
59319         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59320         return tag_ptr(ret_conv, true);
59321 }
59322
59323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59324         LDKRouteHop this_obj_conv;
59325         this_obj_conv.inner = untag_ptr(this_obj);
59326         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59328         RouteHop_free(this_obj_conv);
59329 }
59330
59331 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
59332         LDKRouteHop this_ptr_conv;
59333         this_ptr_conv.inner = untag_ptr(this_ptr);
59334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59336         this_ptr_conv.is_owned = false;
59337         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59338         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
59339         return ret_arr;
59340 }
59341
59342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59343         LDKRouteHop this_ptr_conv;
59344         this_ptr_conv.inner = untag_ptr(this_ptr);
59345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59347         this_ptr_conv.is_owned = false;
59348         LDKPublicKey val_ref;
59349         CHECK((*env)->GetArrayLength(env, val) == 33);
59350         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
59351         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
59352 }
59353
59354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59355         LDKRouteHop this_ptr_conv;
59356         this_ptr_conv.inner = untag_ptr(this_ptr);
59357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59359         this_ptr_conv.is_owned = false;
59360         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
59361         int64_t ret_ref = 0;
59362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59364         return ret_ref;
59365 }
59366
59367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59368         LDKRouteHop this_ptr_conv;
59369         this_ptr_conv.inner = untag_ptr(this_ptr);
59370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59372         this_ptr_conv.is_owned = false;
59373         LDKNodeFeatures val_conv;
59374         val_conv.inner = untag_ptr(val);
59375         val_conv.is_owned = ptr_is_owned(val);
59376         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59377         val_conv = NodeFeatures_clone(&val_conv);
59378         RouteHop_set_node_features(&this_ptr_conv, val_conv);
59379 }
59380
59381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
59382         LDKRouteHop this_ptr_conv;
59383         this_ptr_conv.inner = untag_ptr(this_ptr);
59384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59386         this_ptr_conv.is_owned = false;
59387         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
59388         return ret_conv;
59389 }
59390
59391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59392         LDKRouteHop this_ptr_conv;
59393         this_ptr_conv.inner = untag_ptr(this_ptr);
59394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59396         this_ptr_conv.is_owned = false;
59397         RouteHop_set_short_channel_id(&this_ptr_conv, val);
59398 }
59399
59400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59401         LDKRouteHop this_ptr_conv;
59402         this_ptr_conv.inner = untag_ptr(this_ptr);
59403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59405         this_ptr_conv.is_owned = false;
59406         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
59407         int64_t ret_ref = 0;
59408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59410         return ret_ref;
59411 }
59412
59413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59414         LDKRouteHop this_ptr_conv;
59415         this_ptr_conv.inner = untag_ptr(this_ptr);
59416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59418         this_ptr_conv.is_owned = false;
59419         LDKChannelFeatures val_conv;
59420         val_conv.inner = untag_ptr(val);
59421         val_conv.is_owned = ptr_is_owned(val);
59422         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59423         val_conv = ChannelFeatures_clone(&val_conv);
59424         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
59425 }
59426
59427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59428         LDKRouteHop this_ptr_conv;
59429         this_ptr_conv.inner = untag_ptr(this_ptr);
59430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59432         this_ptr_conv.is_owned = false;
59433         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
59434         return ret_conv;
59435 }
59436
59437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59438         LDKRouteHop this_ptr_conv;
59439         this_ptr_conv.inner = untag_ptr(this_ptr);
59440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59442         this_ptr_conv.is_owned = false;
59443         RouteHop_set_fee_msat(&this_ptr_conv, val);
59444 }
59445
59446 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
59447         LDKRouteHop this_ptr_conv;
59448         this_ptr_conv.inner = untag_ptr(this_ptr);
59449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59451         this_ptr_conv.is_owned = false;
59452         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
59453         return ret_conv;
59454 }
59455
59456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59457         LDKRouteHop this_ptr_conv;
59458         this_ptr_conv.inner = untag_ptr(this_ptr);
59459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59461         this_ptr_conv.is_owned = false;
59462         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
59463 }
59464
59465 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) {
59466         LDKPublicKey pubkey_arg_ref;
59467         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
59468         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
59469         LDKNodeFeatures node_features_arg_conv;
59470         node_features_arg_conv.inner = untag_ptr(node_features_arg);
59471         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
59472         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
59473         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
59474         LDKChannelFeatures channel_features_arg_conv;
59475         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
59476         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
59477         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
59478         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
59479         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);
59480         int64_t ret_ref = 0;
59481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59483         return ret_ref;
59484 }
59485
59486 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
59487         LDKRouteHop ret_var = RouteHop_clone(arg);
59488         int64_t ret_ref = 0;
59489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59491         return ret_ref;
59492 }
59493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59494         LDKRouteHop arg_conv;
59495         arg_conv.inner = untag_ptr(arg);
59496         arg_conv.is_owned = ptr_is_owned(arg);
59497         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59498         arg_conv.is_owned = false;
59499         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
59500         return ret_conv;
59501 }
59502
59503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59504         LDKRouteHop orig_conv;
59505         orig_conv.inner = untag_ptr(orig);
59506         orig_conv.is_owned = ptr_is_owned(orig);
59507         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59508         orig_conv.is_owned = false;
59509         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
59510         int64_t ret_ref = 0;
59511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59513         return ret_ref;
59514 }
59515
59516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
59517         LDKRouteHop o_conv;
59518         o_conv.inner = untag_ptr(o);
59519         o_conv.is_owned = ptr_is_owned(o);
59520         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59521         o_conv.is_owned = false;
59522         int64_t ret_conv = RouteHop_hash(&o_conv);
59523         return ret_conv;
59524 }
59525
59526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59527         LDKRouteHop a_conv;
59528         a_conv.inner = untag_ptr(a);
59529         a_conv.is_owned = ptr_is_owned(a);
59530         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59531         a_conv.is_owned = false;
59532         LDKRouteHop b_conv;
59533         b_conv.inner = untag_ptr(b);
59534         b_conv.is_owned = ptr_is_owned(b);
59535         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59536         b_conv.is_owned = false;
59537         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
59538         return ret_conv;
59539 }
59540
59541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
59542         LDKRouteHop obj_conv;
59543         obj_conv.inner = untag_ptr(obj);
59544         obj_conv.is_owned = ptr_is_owned(obj);
59545         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59546         obj_conv.is_owned = false;
59547         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
59548         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59549         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59550         CVec_u8Z_free(ret_var);
59551         return ret_arr;
59552 }
59553
59554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59555         LDKu8slice ser_ref;
59556         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59557         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59558         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
59559         *ret_conv = RouteHop_read(ser_ref);
59560         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59561         return tag_ptr(ret_conv, true);
59562 }
59563
59564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59565         LDKBlindedTail this_obj_conv;
59566         this_obj_conv.inner = untag_ptr(this_obj);
59567         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59569         BlindedTail_free(this_obj_conv);
59570 }
59571
59572 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
59573         LDKBlindedTail this_ptr_conv;
59574         this_ptr_conv.inner = untag_ptr(this_ptr);
59575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59577         this_ptr_conv.is_owned = false;
59578         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
59579         int64_tArray ret_arr = NULL;
59580         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59581         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59582         for (size_t m = 0; m < ret_var.datalen; m++) {
59583                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
59584                 int64_t ret_conv_12_ref = 0;
59585                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
59586                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
59587                 ret_arr_ptr[m] = ret_conv_12_ref;
59588         }
59589         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59590         FREE(ret_var.data);
59591         return ret_arr;
59592 }
59593
59594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59595         LDKBlindedTail this_ptr_conv;
59596         this_ptr_conv.inner = untag_ptr(this_ptr);
59597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59599         this_ptr_conv.is_owned = false;
59600         LDKCVec_BlindedHopZ val_constr;
59601         val_constr.datalen = (*env)->GetArrayLength(env, val);
59602         if (val_constr.datalen > 0)
59603                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
59604         else
59605                 val_constr.data = NULL;
59606         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59607         for (size_t m = 0; m < val_constr.datalen; m++) {
59608                 int64_t val_conv_12 = val_vals[m];
59609                 LDKBlindedHop val_conv_12_conv;
59610                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
59611                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
59612                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
59613                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
59614                 val_constr.data[m] = val_conv_12_conv;
59615         }
59616         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59617         BlindedTail_set_hops(&this_ptr_conv, val_constr);
59618 }
59619
59620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
59621         LDKBlindedTail this_ptr_conv;
59622         this_ptr_conv.inner = untag_ptr(this_ptr);
59623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59625         this_ptr_conv.is_owned = false;
59626         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59627         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
59628         return ret_arr;
59629 }
59630
59631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59632         LDKBlindedTail this_ptr_conv;
59633         this_ptr_conv.inner = untag_ptr(this_ptr);
59634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59636         this_ptr_conv.is_owned = false;
59637         LDKPublicKey val_ref;
59638         CHECK((*env)->GetArrayLength(env, val) == 33);
59639         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
59640         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
59641 }
59642
59643 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
59644         LDKBlindedTail this_ptr_conv;
59645         this_ptr_conv.inner = untag_ptr(this_ptr);
59646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59648         this_ptr_conv.is_owned = false;
59649         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
59650         return ret_conv;
59651 }
59652
59653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59654         LDKBlindedTail this_ptr_conv;
59655         this_ptr_conv.inner = untag_ptr(this_ptr);
59656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59658         this_ptr_conv.is_owned = false;
59659         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
59660 }
59661
59662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59663         LDKBlindedTail this_ptr_conv;
59664         this_ptr_conv.inner = untag_ptr(this_ptr);
59665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59667         this_ptr_conv.is_owned = false;
59668         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
59669         return ret_conv;
59670 }
59671
59672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59673         LDKBlindedTail this_ptr_conv;
59674         this_ptr_conv.inner = untag_ptr(this_ptr);
59675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59677         this_ptr_conv.is_owned = false;
59678         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
59679 }
59680
59681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int8_tArray blinding_point_arg, int32_t excess_final_cltv_expiry_delta_arg, int64_t final_value_msat_arg) {
59682         LDKCVec_BlindedHopZ hops_arg_constr;
59683         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
59684         if (hops_arg_constr.datalen > 0)
59685                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
59686         else
59687                 hops_arg_constr.data = NULL;
59688         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
59689         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
59690                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
59691                 LDKBlindedHop hops_arg_conv_12_conv;
59692                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
59693                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
59694                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
59695                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
59696                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
59697         }
59698         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
59699         LDKPublicKey blinding_point_arg_ref;
59700         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
59701         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
59702         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
59703         int64_t ret_ref = 0;
59704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59706         return ret_ref;
59707 }
59708
59709 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
59710         LDKBlindedTail ret_var = BlindedTail_clone(arg);
59711         int64_t ret_ref = 0;
59712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59714         return ret_ref;
59715 }
59716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59717         LDKBlindedTail arg_conv;
59718         arg_conv.inner = untag_ptr(arg);
59719         arg_conv.is_owned = ptr_is_owned(arg);
59720         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59721         arg_conv.is_owned = false;
59722         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
59723         return ret_conv;
59724 }
59725
59726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59727         LDKBlindedTail orig_conv;
59728         orig_conv.inner = untag_ptr(orig);
59729         orig_conv.is_owned = ptr_is_owned(orig);
59730         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59731         orig_conv.is_owned = false;
59732         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
59733         int64_t ret_ref = 0;
59734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59736         return ret_ref;
59737 }
59738
59739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
59740         LDKBlindedTail o_conv;
59741         o_conv.inner = untag_ptr(o);
59742         o_conv.is_owned = ptr_is_owned(o);
59743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59744         o_conv.is_owned = false;
59745         int64_t ret_conv = BlindedTail_hash(&o_conv);
59746         return ret_conv;
59747 }
59748
59749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59750         LDKBlindedTail a_conv;
59751         a_conv.inner = untag_ptr(a);
59752         a_conv.is_owned = ptr_is_owned(a);
59753         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59754         a_conv.is_owned = false;
59755         LDKBlindedTail b_conv;
59756         b_conv.inner = untag_ptr(b);
59757         b_conv.is_owned = ptr_is_owned(b);
59758         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59759         b_conv.is_owned = false;
59760         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
59761         return ret_conv;
59762 }
59763
59764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
59765         LDKBlindedTail obj_conv;
59766         obj_conv.inner = untag_ptr(obj);
59767         obj_conv.is_owned = ptr_is_owned(obj);
59768         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59769         obj_conv.is_owned = false;
59770         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
59771         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59772         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59773         CVec_u8Z_free(ret_var);
59774         return ret_arr;
59775 }
59776
59777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59778         LDKu8slice ser_ref;
59779         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59780         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59781         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
59782         *ret_conv = BlindedTail_read(ser_ref);
59783         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59784         return tag_ptr(ret_conv, true);
59785 }
59786
59787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59788         LDKPath this_obj_conv;
59789         this_obj_conv.inner = untag_ptr(this_obj);
59790         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59792         Path_free(this_obj_conv);
59793 }
59794
59795 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
59796         LDKPath this_ptr_conv;
59797         this_ptr_conv.inner = untag_ptr(this_ptr);
59798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59800         this_ptr_conv.is_owned = false;
59801         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
59802         int64_tArray ret_arr = NULL;
59803         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59804         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59805         for (size_t k = 0; k < ret_var.datalen; k++) {
59806                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
59807                 int64_t ret_conv_10_ref = 0;
59808                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
59809                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
59810                 ret_arr_ptr[k] = ret_conv_10_ref;
59811         }
59812         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59813         FREE(ret_var.data);
59814         return ret_arr;
59815 }
59816
59817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59818         LDKPath this_ptr_conv;
59819         this_ptr_conv.inner = untag_ptr(this_ptr);
59820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59822         this_ptr_conv.is_owned = false;
59823         LDKCVec_RouteHopZ val_constr;
59824         val_constr.datalen = (*env)->GetArrayLength(env, val);
59825         if (val_constr.datalen > 0)
59826                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
59827         else
59828                 val_constr.data = NULL;
59829         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59830         for (size_t k = 0; k < val_constr.datalen; k++) {
59831                 int64_t val_conv_10 = val_vals[k];
59832                 LDKRouteHop val_conv_10_conv;
59833                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
59834                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
59835                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
59836                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
59837                 val_constr.data[k] = val_conv_10_conv;
59838         }
59839         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59840         Path_set_hops(&this_ptr_conv, val_constr);
59841 }
59842
59843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
59844         LDKPath this_ptr_conv;
59845         this_ptr_conv.inner = untag_ptr(this_ptr);
59846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59848         this_ptr_conv.is_owned = false;
59849         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
59850         int64_t ret_ref = 0;
59851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59853         return ret_ref;
59854 }
59855
59856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59857         LDKPath this_ptr_conv;
59858         this_ptr_conv.inner = untag_ptr(this_ptr);
59859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59861         this_ptr_conv.is_owned = false;
59862         LDKBlindedTail val_conv;
59863         val_conv.inner = untag_ptr(val);
59864         val_conv.is_owned = ptr_is_owned(val);
59865         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59866         val_conv = BlindedTail_clone(&val_conv);
59867         Path_set_blinded_tail(&this_ptr_conv, val_conv);
59868 }
59869
59870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
59871         LDKCVec_RouteHopZ hops_arg_constr;
59872         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
59873         if (hops_arg_constr.datalen > 0)
59874                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
59875         else
59876                 hops_arg_constr.data = NULL;
59877         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
59878         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
59879                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
59880                 LDKRouteHop hops_arg_conv_10_conv;
59881                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
59882                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
59883                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
59884                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
59885                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
59886         }
59887         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
59888         LDKBlindedTail blinded_tail_arg_conv;
59889         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
59890         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
59891         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
59892         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
59893         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
59894         int64_t ret_ref = 0;
59895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59897         return ret_ref;
59898 }
59899
59900 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
59901         LDKPath ret_var = Path_clone(arg);
59902         int64_t ret_ref = 0;
59903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59905         return ret_ref;
59906 }
59907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59908         LDKPath arg_conv;
59909         arg_conv.inner = untag_ptr(arg);
59910         arg_conv.is_owned = ptr_is_owned(arg);
59911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59912         arg_conv.is_owned = false;
59913         int64_t ret_conv = Path_clone_ptr(&arg_conv);
59914         return ret_conv;
59915 }
59916
59917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59918         LDKPath orig_conv;
59919         orig_conv.inner = untag_ptr(orig);
59920         orig_conv.is_owned = ptr_is_owned(orig);
59921         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59922         orig_conv.is_owned = false;
59923         LDKPath ret_var = Path_clone(&orig_conv);
59924         int64_t ret_ref = 0;
59925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59927         return ret_ref;
59928 }
59929
59930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
59931         LDKPath o_conv;
59932         o_conv.inner = untag_ptr(o);
59933         o_conv.is_owned = ptr_is_owned(o);
59934         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59935         o_conv.is_owned = false;
59936         int64_t ret_conv = Path_hash(&o_conv);
59937         return ret_conv;
59938 }
59939
59940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59941         LDKPath a_conv;
59942         a_conv.inner = untag_ptr(a);
59943         a_conv.is_owned = ptr_is_owned(a);
59944         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59945         a_conv.is_owned = false;
59946         LDKPath b_conv;
59947         b_conv.inner = untag_ptr(b);
59948         b_conv.is_owned = ptr_is_owned(b);
59949         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59950         b_conv.is_owned = false;
59951         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
59952         return ret_conv;
59953 }
59954
59955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
59956         LDKPath this_arg_conv;
59957         this_arg_conv.inner = untag_ptr(this_arg);
59958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59960         this_arg_conv.is_owned = false;
59961         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
59962         return ret_conv;
59963 }
59964
59965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
59966         LDKPath this_arg_conv;
59967         this_arg_conv.inner = untag_ptr(this_arg);
59968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59970         this_arg_conv.is_owned = false;
59971         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
59972         return ret_conv;
59973 }
59974
59975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
59976         LDKPath this_arg_conv;
59977         this_arg_conv.inner = untag_ptr(this_arg);
59978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59980         this_arg_conv.is_owned = false;
59981         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
59982         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
59983         int64_t ret_ref = tag_ptr(ret_copy, true);
59984         return ret_ref;
59985 }
59986
59987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59988         LDKRoute this_obj_conv;
59989         this_obj_conv.inner = untag_ptr(this_obj);
59990         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59992         Route_free(this_obj_conv);
59993 }
59994
59995 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
59996         LDKRoute this_ptr_conv;
59997         this_ptr_conv.inner = untag_ptr(this_ptr);
59998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60000         this_ptr_conv.is_owned = false;
60001         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
60002         int64_tArray ret_arr = NULL;
60003         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60004         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60005         for (size_t g = 0; g < ret_var.datalen; g++) {
60006                 LDKPath ret_conv_6_var = ret_var.data[g];
60007                 int64_t ret_conv_6_ref = 0;
60008                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
60009                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
60010                 ret_arr_ptr[g] = ret_conv_6_ref;
60011         }
60012         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60013         FREE(ret_var.data);
60014         return ret_arr;
60015 }
60016
60017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
60018         LDKRoute this_ptr_conv;
60019         this_ptr_conv.inner = untag_ptr(this_ptr);
60020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60022         this_ptr_conv.is_owned = false;
60023         LDKCVec_PathZ val_constr;
60024         val_constr.datalen = (*env)->GetArrayLength(env, val);
60025         if (val_constr.datalen > 0)
60026                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
60027         else
60028                 val_constr.data = NULL;
60029         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
60030         for (size_t g = 0; g < val_constr.datalen; g++) {
60031                 int64_t val_conv_6 = val_vals[g];
60032                 LDKPath val_conv_6_conv;
60033                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
60034                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
60035                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
60036                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
60037                 val_constr.data[g] = val_conv_6_conv;
60038         }
60039         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
60040         Route_set_paths(&this_ptr_conv, val_constr);
60041 }
60042
60043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
60044         LDKRoute this_ptr_conv;
60045         this_ptr_conv.inner = untag_ptr(this_ptr);
60046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60048         this_ptr_conv.is_owned = false;
60049         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
60050         int64_t ret_ref = 0;
60051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60053         return ret_ref;
60054 }
60055
60056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60057         LDKRoute this_ptr_conv;
60058         this_ptr_conv.inner = untag_ptr(this_ptr);
60059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60061         this_ptr_conv.is_owned = false;
60062         LDKPaymentParameters val_conv;
60063         val_conv.inner = untag_ptr(val);
60064         val_conv.is_owned = ptr_is_owned(val);
60065         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60066         val_conv = PaymentParameters_clone(&val_conv);
60067         Route_set_payment_params(&this_ptr_conv, val_conv);
60068 }
60069
60070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t payment_params_arg) {
60071         LDKCVec_PathZ paths_arg_constr;
60072         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
60073         if (paths_arg_constr.datalen > 0)
60074                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
60075         else
60076                 paths_arg_constr.data = NULL;
60077         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
60078         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
60079                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
60080                 LDKPath paths_arg_conv_6_conv;
60081                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
60082                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
60083                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
60084                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
60085                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
60086         }
60087         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
60088         LDKPaymentParameters payment_params_arg_conv;
60089         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
60090         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
60091         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
60092         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
60093         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
60094         int64_t ret_ref = 0;
60095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60097         return ret_ref;
60098 }
60099
60100 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
60101         LDKRoute ret_var = Route_clone(arg);
60102         int64_t ret_ref = 0;
60103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60105         return ret_ref;
60106 }
60107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60108         LDKRoute arg_conv;
60109         arg_conv.inner = untag_ptr(arg);
60110         arg_conv.is_owned = ptr_is_owned(arg);
60111         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60112         arg_conv.is_owned = false;
60113         int64_t ret_conv = Route_clone_ptr(&arg_conv);
60114         return ret_conv;
60115 }
60116
60117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60118         LDKRoute orig_conv;
60119         orig_conv.inner = untag_ptr(orig);
60120         orig_conv.is_owned = ptr_is_owned(orig);
60121         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60122         orig_conv.is_owned = false;
60123         LDKRoute ret_var = Route_clone(&orig_conv);
60124         int64_t ret_ref = 0;
60125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60127         return ret_ref;
60128 }
60129
60130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
60131         LDKRoute o_conv;
60132         o_conv.inner = untag_ptr(o);
60133         o_conv.is_owned = ptr_is_owned(o);
60134         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60135         o_conv.is_owned = false;
60136         int64_t ret_conv = Route_hash(&o_conv);
60137         return ret_conv;
60138 }
60139
60140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60141         LDKRoute a_conv;
60142         a_conv.inner = untag_ptr(a);
60143         a_conv.is_owned = ptr_is_owned(a);
60144         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60145         a_conv.is_owned = false;
60146         LDKRoute b_conv;
60147         b_conv.inner = untag_ptr(b);
60148         b_conv.is_owned = ptr_is_owned(b);
60149         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60150         b_conv.is_owned = false;
60151         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
60152         return ret_conv;
60153 }
60154
60155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
60156         LDKRoute this_arg_conv;
60157         this_arg_conv.inner = untag_ptr(this_arg);
60158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60160         this_arg_conv.is_owned = false;
60161         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
60162         return ret_conv;
60163 }
60164
60165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60166         LDKRoute this_arg_conv;
60167         this_arg_conv.inner = untag_ptr(this_arg);
60168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60170         this_arg_conv.is_owned = false;
60171         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
60172         return ret_conv;
60173 }
60174
60175 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
60176         LDKRoute obj_conv;
60177         obj_conv.inner = untag_ptr(obj);
60178         obj_conv.is_owned = ptr_is_owned(obj);
60179         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60180         obj_conv.is_owned = false;
60181         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
60182         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60183         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60184         CVec_u8Z_free(ret_var);
60185         return ret_arr;
60186 }
60187
60188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60189         LDKu8slice ser_ref;
60190         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60191         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60192         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
60193         *ret_conv = Route_read(ser_ref);
60194         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60195         return tag_ptr(ret_conv, true);
60196 }
60197
60198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60199         LDKRouteParameters this_obj_conv;
60200         this_obj_conv.inner = untag_ptr(this_obj);
60201         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60203         RouteParameters_free(this_obj_conv);
60204 }
60205
60206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
60207         LDKRouteParameters this_ptr_conv;
60208         this_ptr_conv.inner = untag_ptr(this_ptr);
60209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60211         this_ptr_conv.is_owned = false;
60212         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
60213         int64_t ret_ref = 0;
60214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60216         return ret_ref;
60217 }
60218
60219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60220         LDKRouteParameters this_ptr_conv;
60221         this_ptr_conv.inner = untag_ptr(this_ptr);
60222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60224         this_ptr_conv.is_owned = false;
60225         LDKPaymentParameters val_conv;
60226         val_conv.inner = untag_ptr(val);
60227         val_conv.is_owned = ptr_is_owned(val);
60228         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60229         val_conv = PaymentParameters_clone(&val_conv);
60230         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
60231 }
60232
60233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
60234         LDKRouteParameters this_ptr_conv;
60235         this_ptr_conv.inner = untag_ptr(this_ptr);
60236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60238         this_ptr_conv.is_owned = false;
60239         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
60240         return ret_conv;
60241 }
60242
60243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60244         LDKRouteParameters this_ptr_conv;
60245         this_ptr_conv.inner = untag_ptr(this_ptr);
60246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60248         this_ptr_conv.is_owned = false;
60249         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
60250 }
60251
60252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payment_params_arg, int64_t final_value_msat_arg) {
60253         LDKPaymentParameters payment_params_arg_conv;
60254         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
60255         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
60256         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
60257         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
60258         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
60259         int64_t ret_ref = 0;
60260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60262         return ret_ref;
60263 }
60264
60265 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
60266         LDKRouteParameters ret_var = RouteParameters_clone(arg);
60267         int64_t ret_ref = 0;
60268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60270         return ret_ref;
60271 }
60272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60273         LDKRouteParameters arg_conv;
60274         arg_conv.inner = untag_ptr(arg);
60275         arg_conv.is_owned = ptr_is_owned(arg);
60276         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60277         arg_conv.is_owned = false;
60278         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
60279         return ret_conv;
60280 }
60281
60282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60283         LDKRouteParameters orig_conv;
60284         orig_conv.inner = untag_ptr(orig);
60285         orig_conv.is_owned = ptr_is_owned(orig);
60286         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60287         orig_conv.is_owned = false;
60288         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
60289         int64_t ret_ref = 0;
60290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60292         return ret_ref;
60293 }
60294
60295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60296         LDKRouteParameters a_conv;
60297         a_conv.inner = untag_ptr(a);
60298         a_conv.is_owned = ptr_is_owned(a);
60299         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60300         a_conv.is_owned = false;
60301         LDKRouteParameters b_conv;
60302         b_conv.inner = untag_ptr(b);
60303         b_conv.is_owned = ptr_is_owned(b);
60304         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60305         b_conv.is_owned = false;
60306         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
60307         return ret_conv;
60308 }
60309
60310 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
60311         LDKRouteParameters obj_conv;
60312         obj_conv.inner = untag_ptr(obj);
60313         obj_conv.is_owned = ptr_is_owned(obj);
60314         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60315         obj_conv.is_owned = false;
60316         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
60317         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60318         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60319         CVec_u8Z_free(ret_var);
60320         return ret_arr;
60321 }
60322
60323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60324         LDKu8slice ser_ref;
60325         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60326         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60327         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
60328         *ret_conv = RouteParameters_read(ser_ref);
60329         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60330         return tag_ptr(ret_conv, true);
60331 }
60332
60333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60334         LDKPaymentParameters this_obj_conv;
60335         this_obj_conv.inner = untag_ptr(this_obj);
60336         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60338         PaymentParameters_free(this_obj_conv);
60339 }
60340
60341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
60342         LDKPaymentParameters this_ptr_conv;
60343         this_ptr_conv.inner = untag_ptr(this_ptr);
60344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60346         this_ptr_conv.is_owned = false;
60347         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60348         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
60349         int64_t ret_ref = tag_ptr(ret_copy, true);
60350         return ret_ref;
60351 }
60352
60353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60354         LDKPaymentParameters this_ptr_conv;
60355         this_ptr_conv.inner = untag_ptr(this_ptr);
60356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60358         this_ptr_conv.is_owned = false;
60359         void* val_ptr = untag_ptr(val);
60360         CHECK_ACCESS(val_ptr);
60361         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
60362         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
60363         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
60364 }
60365
60366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
60367         LDKPaymentParameters this_ptr_conv;
60368         this_ptr_conv.inner = untag_ptr(this_ptr);
60369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60371         this_ptr_conv.is_owned = false;
60372         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60373         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
60374         int64_t ret_ref = tag_ptr(ret_copy, true);
60375         return ret_ref;
60376 }
60377
60378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60379         LDKPaymentParameters this_ptr_conv;
60380         this_ptr_conv.inner = untag_ptr(this_ptr);
60381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60383         this_ptr_conv.is_owned = false;
60384         void* val_ptr = untag_ptr(val);
60385         CHECK_ACCESS(val_ptr);
60386         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
60387         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
60388         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
60389 }
60390
60391 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
60392         LDKPaymentParameters this_ptr_conv;
60393         this_ptr_conv.inner = untag_ptr(this_ptr);
60394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60396         this_ptr_conv.is_owned = false;
60397         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
60398         return ret_conv;
60399 }
60400
60401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
60402         LDKPaymentParameters this_ptr_conv;
60403         this_ptr_conv.inner = untag_ptr(this_ptr);
60404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60406         this_ptr_conv.is_owned = false;
60407         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
60408 }
60409
60410 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
60411         LDKPaymentParameters this_ptr_conv;
60412         this_ptr_conv.inner = untag_ptr(this_ptr);
60413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60415         this_ptr_conv.is_owned = false;
60416         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
60417         return ret_conv;
60418 }
60419
60420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
60421         LDKPaymentParameters this_ptr_conv;
60422         this_ptr_conv.inner = untag_ptr(this_ptr);
60423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60425         this_ptr_conv.is_owned = false;
60426         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
60427 }
60428
60429 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr) {
60430         LDKPaymentParameters this_ptr_conv;
60431         this_ptr_conv.inner = untag_ptr(this_ptr);
60432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60434         this_ptr_conv.is_owned = false;
60435         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
60436         return ret_conv;
60437 }
60438
60439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1channel_1saturation_1power_1of_1half(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
60440         LDKPaymentParameters this_ptr_conv;
60441         this_ptr_conv.inner = untag_ptr(this_ptr);
60442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60444         this_ptr_conv.is_owned = false;
60445         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
60446 }
60447
60448 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
60449         LDKPaymentParameters this_ptr_conv;
60450         this_ptr_conv.inner = untag_ptr(this_ptr);
60451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60453         this_ptr_conv.is_owned = false;
60454         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
60455         int64_tArray ret_arr = NULL;
60456         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60457         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60458         for (size_t g = 0; g < ret_var.datalen; g++) {
60459                 int64_t ret_conv_6_conv = ret_var.data[g];
60460                 ret_arr_ptr[g] = ret_conv_6_conv;
60461         }
60462         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60463         FREE(ret_var.data);
60464         return ret_arr;
60465 }
60466
60467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
60468         LDKPaymentParameters this_ptr_conv;
60469         this_ptr_conv.inner = untag_ptr(this_ptr);
60470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60472         this_ptr_conv.is_owned = false;
60473         LDKCVec_u64Z val_constr;
60474         val_constr.datalen = (*env)->GetArrayLength(env, val);
60475         if (val_constr.datalen > 0)
60476                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
60477         else
60478                 val_constr.data = NULL;
60479         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
60480         for (size_t g = 0; g < val_constr.datalen; g++) {
60481                 int64_t val_conv_6 = val_vals[g];
60482                 val_constr.data[g] = val_conv_6;
60483         }
60484         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
60485         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
60486 }
60487
60488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int64_t payee_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg) {
60489         void* payee_arg_ptr = untag_ptr(payee_arg);
60490         CHECK_ACCESS(payee_arg_ptr);
60491         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
60492         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
60493         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
60494         CHECK_ACCESS(expiry_time_arg_ptr);
60495         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
60496         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
60497         LDKCVec_u64Z previously_failed_channels_arg_constr;
60498         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
60499         if (previously_failed_channels_arg_constr.datalen > 0)
60500                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
60501         else
60502                 previously_failed_channels_arg_constr.data = NULL;
60503         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
60504         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
60505                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
60506                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
60507         }
60508         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
60509         LDKPaymentParameters ret_var = PaymentParameters_new(payee_arg_conv, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr);
60510         int64_t ret_ref = 0;
60511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60513         return ret_ref;
60514 }
60515
60516 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
60517         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
60518         int64_t ret_ref = 0;
60519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60521         return ret_ref;
60522 }
60523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60524         LDKPaymentParameters arg_conv;
60525         arg_conv.inner = untag_ptr(arg);
60526         arg_conv.is_owned = ptr_is_owned(arg);
60527         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60528         arg_conv.is_owned = false;
60529         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
60530         return ret_conv;
60531 }
60532
60533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60534         LDKPaymentParameters orig_conv;
60535         orig_conv.inner = untag_ptr(orig);
60536         orig_conv.is_owned = ptr_is_owned(orig);
60537         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60538         orig_conv.is_owned = false;
60539         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
60540         int64_t ret_ref = 0;
60541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60543         return ret_ref;
60544 }
60545
60546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
60547         LDKPaymentParameters o_conv;
60548         o_conv.inner = untag_ptr(o);
60549         o_conv.is_owned = ptr_is_owned(o);
60550         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60551         o_conv.is_owned = false;
60552         int64_t ret_conv = PaymentParameters_hash(&o_conv);
60553         return ret_conv;
60554 }
60555
60556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60557         LDKPaymentParameters a_conv;
60558         a_conv.inner = untag_ptr(a);
60559         a_conv.is_owned = ptr_is_owned(a);
60560         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60561         a_conv.is_owned = false;
60562         LDKPaymentParameters b_conv;
60563         b_conv.inner = untag_ptr(b);
60564         b_conv.is_owned = ptr_is_owned(b);
60565         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60566         b_conv.is_owned = false;
60567         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
60568         return ret_conv;
60569 }
60570
60571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
60572         LDKPaymentParameters obj_conv;
60573         obj_conv.inner = untag_ptr(obj);
60574         obj_conv.is_owned = ptr_is_owned(obj);
60575         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60576         obj_conv.is_owned = false;
60577         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
60578         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60579         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60580         CVec_u8Z_free(ret_var);
60581         return ret_arr;
60582 }
60583
60584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
60585         LDKu8slice ser_ref;
60586         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60587         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60588         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
60589         *ret_conv = PaymentParameters_read(ser_ref, arg);
60590         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60591         return tag_ptr(ret_conv, true);
60592 }
60593
60594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
60595         LDKPublicKey payee_pubkey_ref;
60596         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
60597         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
60598         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
60599         int64_t ret_ref = 0;
60600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60602         return ret_ref;
60603 }
60604
60605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta, jboolean allow_mpp) {
60606         LDKPublicKey payee_pubkey_ref;
60607         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
60608         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
60609         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
60610         int64_t ret_ref = 0;
60611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60613         return ret_ref;
60614 }
60615
60616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
60617         LDKBolt12Invoice invoice_conv;
60618         invoice_conv.inner = untag_ptr(invoice);
60619         invoice_conv.is_owned = ptr_is_owned(invoice);
60620         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
60621         invoice_conv.is_owned = false;
60622         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
60623         int64_t ret_ref = 0;
60624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60626         return ret_ref;
60627 }
60628
60629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60630         if (!ptr_is_owned(this_ptr)) return;
60631         void* this_ptr_ptr = untag_ptr(this_ptr);
60632         CHECK_ACCESS(this_ptr_ptr);
60633         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
60634         FREE(untag_ptr(this_ptr));
60635         Payee_free(this_ptr_conv);
60636 }
60637
60638 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
60639         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60640         *ret_copy = Payee_clone(arg);
60641         int64_t ret_ref = tag_ptr(ret_copy, true);
60642         return ret_ref;
60643 }
60644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60645         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
60646         int64_t ret_conv = Payee_clone_ptr(arg_conv);
60647         return ret_conv;
60648 }
60649
60650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60651         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
60652         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60653         *ret_copy = Payee_clone(orig_conv);
60654         int64_t ret_ref = tag_ptr(ret_copy, true);
60655         return ret_ref;
60656 }
60657
60658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
60659         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
60660         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
60661         if (route_hints_constr.datalen > 0)
60662                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
60663         else
60664                 route_hints_constr.data = NULL;
60665         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
60666         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
60667                 int64_t route_hints_conv_37 = route_hints_vals[l];
60668                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
60669                 CHECK_ACCESS(route_hints_conv_37_ptr);
60670                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
60671                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
60672                 route_hints_constr.data[l] = route_hints_conv_37_conv;
60673         }
60674         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
60675         LDKBolt12InvoiceFeatures features_conv;
60676         features_conv.inner = untag_ptr(features);
60677         features_conv.is_owned = ptr_is_owned(features);
60678         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
60679         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
60680         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60681         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
60682         int64_t ret_ref = tag_ptr(ret_copy, true);
60683         return ret_ref;
60684 }
60685
60686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clear(JNIEnv *env, jclass clz, int8_tArray node_id, int64_tArray route_hints, int64_t features, int32_t final_cltv_expiry_delta) {
60687         LDKPublicKey node_id_ref;
60688         CHECK((*env)->GetArrayLength(env, node_id) == 33);
60689         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
60690         LDKCVec_RouteHintZ route_hints_constr;
60691         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
60692         if (route_hints_constr.datalen > 0)
60693                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
60694         else
60695                 route_hints_constr.data = NULL;
60696         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
60697         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
60698                 int64_t route_hints_conv_11 = route_hints_vals[l];
60699                 LDKRouteHint route_hints_conv_11_conv;
60700                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
60701                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
60702                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
60703                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
60704                 route_hints_constr.data[l] = route_hints_conv_11_conv;
60705         }
60706         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
60707         LDKBolt11InvoiceFeatures features_conv;
60708         features_conv.inner = untag_ptr(features);
60709         features_conv.is_owned = ptr_is_owned(features);
60710         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
60711         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
60712         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60713         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
60714         int64_t ret_ref = tag_ptr(ret_copy, true);
60715         return ret_ref;
60716 }
60717
60718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
60719         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
60720         int64_t ret_conv = Payee_hash(o_conv);
60721         return ret_conv;
60722 }
60723
60724 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60725         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
60726         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
60727         jboolean ret_conv = Payee_eq(a_conv, b_conv);
60728         return ret_conv;
60729 }
60730
60731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60732         LDKRouteHint this_obj_conv;
60733         this_obj_conv.inner = untag_ptr(this_obj);
60734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60736         RouteHint_free(this_obj_conv);
60737 }
60738
60739 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
60740         LDKRouteHint this_ptr_conv;
60741         this_ptr_conv.inner = untag_ptr(this_ptr);
60742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60744         this_ptr_conv.is_owned = false;
60745         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
60746         int64_tArray ret_arr = NULL;
60747         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60748         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60749         for (size_t o = 0; o < ret_var.datalen; o++) {
60750                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
60751                 int64_t ret_conv_14_ref = 0;
60752                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
60753                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
60754                 ret_arr_ptr[o] = ret_conv_14_ref;
60755         }
60756         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60757         FREE(ret_var.data);
60758         return ret_arr;
60759 }
60760
60761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
60762         LDKRouteHint this_ptr_conv;
60763         this_ptr_conv.inner = untag_ptr(this_ptr);
60764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60766         this_ptr_conv.is_owned = false;
60767         LDKCVec_RouteHintHopZ val_constr;
60768         val_constr.datalen = (*env)->GetArrayLength(env, val);
60769         if (val_constr.datalen > 0)
60770                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
60771         else
60772                 val_constr.data = NULL;
60773         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
60774         for (size_t o = 0; o < val_constr.datalen; o++) {
60775                 int64_t val_conv_14 = val_vals[o];
60776                 LDKRouteHintHop val_conv_14_conv;
60777                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
60778                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
60779                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
60780                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
60781                 val_constr.data[o] = val_conv_14_conv;
60782         }
60783         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
60784         RouteHint_set_a(&this_ptr_conv, val_constr);
60785 }
60786
60787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
60788         LDKCVec_RouteHintHopZ a_arg_constr;
60789         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
60790         if (a_arg_constr.datalen > 0)
60791                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
60792         else
60793                 a_arg_constr.data = NULL;
60794         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
60795         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
60796                 int64_t a_arg_conv_14 = a_arg_vals[o];
60797                 LDKRouteHintHop a_arg_conv_14_conv;
60798                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
60799                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
60800                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
60801                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
60802                 a_arg_constr.data[o] = a_arg_conv_14_conv;
60803         }
60804         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
60805         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
60806         int64_t ret_ref = 0;
60807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60809         return ret_ref;
60810 }
60811
60812 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
60813         LDKRouteHint ret_var = RouteHint_clone(arg);
60814         int64_t ret_ref = 0;
60815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60817         return ret_ref;
60818 }
60819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60820         LDKRouteHint arg_conv;
60821         arg_conv.inner = untag_ptr(arg);
60822         arg_conv.is_owned = ptr_is_owned(arg);
60823         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60824         arg_conv.is_owned = false;
60825         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
60826         return ret_conv;
60827 }
60828
60829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60830         LDKRouteHint orig_conv;
60831         orig_conv.inner = untag_ptr(orig);
60832         orig_conv.is_owned = ptr_is_owned(orig);
60833         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60834         orig_conv.is_owned = false;
60835         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
60836         int64_t ret_ref = 0;
60837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60839         return ret_ref;
60840 }
60841
60842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
60843         LDKRouteHint o_conv;
60844         o_conv.inner = untag_ptr(o);
60845         o_conv.is_owned = ptr_is_owned(o);
60846         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60847         o_conv.is_owned = false;
60848         int64_t ret_conv = RouteHint_hash(&o_conv);
60849         return ret_conv;
60850 }
60851
60852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60853         LDKRouteHint a_conv;
60854         a_conv.inner = untag_ptr(a);
60855         a_conv.is_owned = ptr_is_owned(a);
60856         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60857         a_conv.is_owned = false;
60858         LDKRouteHint b_conv;
60859         b_conv.inner = untag_ptr(b);
60860         b_conv.is_owned = ptr_is_owned(b);
60861         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60862         b_conv.is_owned = false;
60863         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
60864         return ret_conv;
60865 }
60866
60867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
60868         LDKRouteHint obj_conv;
60869         obj_conv.inner = untag_ptr(obj);
60870         obj_conv.is_owned = ptr_is_owned(obj);
60871         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60872         obj_conv.is_owned = false;
60873         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
60874         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60875         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60876         CVec_u8Z_free(ret_var);
60877         return ret_arr;
60878 }
60879
60880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60881         LDKu8slice ser_ref;
60882         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60883         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60884         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
60885         *ret_conv = RouteHint_read(ser_ref);
60886         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60887         return tag_ptr(ret_conv, true);
60888 }
60889
60890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60891         LDKRouteHintHop this_obj_conv;
60892         this_obj_conv.inner = untag_ptr(this_obj);
60893         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60895         RouteHintHop_free(this_obj_conv);
60896 }
60897
60898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
60899         LDKRouteHintHop this_ptr_conv;
60900         this_ptr_conv.inner = untag_ptr(this_ptr);
60901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60903         this_ptr_conv.is_owned = false;
60904         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60905         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
60906         return ret_arr;
60907 }
60908
60909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60910         LDKRouteHintHop this_ptr_conv;
60911         this_ptr_conv.inner = untag_ptr(this_ptr);
60912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60914         this_ptr_conv.is_owned = false;
60915         LDKPublicKey val_ref;
60916         CHECK((*env)->GetArrayLength(env, val) == 33);
60917         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
60918         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
60919 }
60920
60921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
60922         LDKRouteHintHop this_ptr_conv;
60923         this_ptr_conv.inner = untag_ptr(this_ptr);
60924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60926         this_ptr_conv.is_owned = false;
60927         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
60928         return ret_conv;
60929 }
60930
60931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60932         LDKRouteHintHop this_ptr_conv;
60933         this_ptr_conv.inner = untag_ptr(this_ptr);
60934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60936         this_ptr_conv.is_owned = false;
60937         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
60938 }
60939
60940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
60941         LDKRouteHintHop this_ptr_conv;
60942         this_ptr_conv.inner = untag_ptr(this_ptr);
60943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60945         this_ptr_conv.is_owned = false;
60946         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
60947         int64_t ret_ref = 0;
60948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60950         return ret_ref;
60951 }
60952
60953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60954         LDKRouteHintHop this_ptr_conv;
60955         this_ptr_conv.inner = untag_ptr(this_ptr);
60956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60958         this_ptr_conv.is_owned = false;
60959         LDKRoutingFees val_conv;
60960         val_conv.inner = untag_ptr(val);
60961         val_conv.is_owned = ptr_is_owned(val);
60962         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60963         val_conv = RoutingFees_clone(&val_conv);
60964         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
60965 }
60966
60967 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
60968         LDKRouteHintHop this_ptr_conv;
60969         this_ptr_conv.inner = untag_ptr(this_ptr);
60970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60972         this_ptr_conv.is_owned = false;
60973         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
60974         return ret_conv;
60975 }
60976
60977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
60978         LDKRouteHintHop this_ptr_conv;
60979         this_ptr_conv.inner = untag_ptr(this_ptr);
60980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60982         this_ptr_conv.is_owned = false;
60983         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
60984 }
60985
60986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
60987         LDKRouteHintHop this_ptr_conv;
60988         this_ptr_conv.inner = untag_ptr(this_ptr);
60989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60991         this_ptr_conv.is_owned = false;
60992         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60993         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
60994         int64_t ret_ref = tag_ptr(ret_copy, true);
60995         return ret_ref;
60996 }
60997
60998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60999         LDKRouteHintHop this_ptr_conv;
61000         this_ptr_conv.inner = untag_ptr(this_ptr);
61001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61003         this_ptr_conv.is_owned = false;
61004         void* val_ptr = untag_ptr(val);
61005         CHECK_ACCESS(val_ptr);
61006         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
61007         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
61008         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
61009 }
61010
61011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61012         LDKRouteHintHop this_ptr_conv;
61013         this_ptr_conv.inner = untag_ptr(this_ptr);
61014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61016         this_ptr_conv.is_owned = false;
61017         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61018         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
61019         int64_t ret_ref = tag_ptr(ret_copy, true);
61020         return ret_ref;
61021 }
61022
61023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61024         LDKRouteHintHop this_ptr_conv;
61025         this_ptr_conv.inner = untag_ptr(this_ptr);
61026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61028         this_ptr_conv.is_owned = false;
61029         void* val_ptr = untag_ptr(val);
61030         CHECK_ACCESS(val_ptr);
61031         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
61032         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
61033         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
61034 }
61035
61036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) {
61037         LDKPublicKey src_node_id_arg_ref;
61038         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
61039         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
61040         LDKRoutingFees fees_arg_conv;
61041         fees_arg_conv.inner = untag_ptr(fees_arg);
61042         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
61043         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
61044         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
61045         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
61046         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
61047         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
61048         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
61049         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
61050         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
61051         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
61052         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
61053         LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
61054         int64_t ret_ref = 0;
61055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61057         return ret_ref;
61058 }
61059
61060 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
61061         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
61062         int64_t ret_ref = 0;
61063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61065         return ret_ref;
61066 }
61067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61068         LDKRouteHintHop arg_conv;
61069         arg_conv.inner = untag_ptr(arg);
61070         arg_conv.is_owned = ptr_is_owned(arg);
61071         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61072         arg_conv.is_owned = false;
61073         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
61074         return ret_conv;
61075 }
61076
61077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61078         LDKRouteHintHop orig_conv;
61079         orig_conv.inner = untag_ptr(orig);
61080         orig_conv.is_owned = ptr_is_owned(orig);
61081         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61082         orig_conv.is_owned = false;
61083         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
61084         int64_t ret_ref = 0;
61085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61087         return ret_ref;
61088 }
61089
61090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
61091         LDKRouteHintHop o_conv;
61092         o_conv.inner = untag_ptr(o);
61093         o_conv.is_owned = ptr_is_owned(o);
61094         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61095         o_conv.is_owned = false;
61096         int64_t ret_conv = RouteHintHop_hash(&o_conv);
61097         return ret_conv;
61098 }
61099
61100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61101         LDKRouteHintHop a_conv;
61102         a_conv.inner = untag_ptr(a);
61103         a_conv.is_owned = ptr_is_owned(a);
61104         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61105         a_conv.is_owned = false;
61106         LDKRouteHintHop b_conv;
61107         b_conv.inner = untag_ptr(b);
61108         b_conv.is_owned = ptr_is_owned(b);
61109         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61110         b_conv.is_owned = false;
61111         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
61112         return ret_conv;
61113 }
61114
61115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
61116         LDKRouteHintHop obj_conv;
61117         obj_conv.inner = untag_ptr(obj);
61118         obj_conv.is_owned = ptr_is_owned(obj);
61119         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61120         obj_conv.is_owned = false;
61121         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
61122         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61123         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61124         CVec_u8Z_free(ret_var);
61125         return ret_arr;
61126 }
61127
61128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61129         LDKu8slice ser_ref;
61130         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61131         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61132         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
61133         *ret_conv = RouteHintHop_read(ser_ref);
61134         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61135         return tag_ptr(ret_conv, true);
61136 }
61137
61138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network_graph, int64_tArray first_hops, int64_t logger, int64_t scorer, int64_t score_params, int8_tArray random_seed_bytes) {
61139         LDKPublicKey our_node_pubkey_ref;
61140         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
61141         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
61142         LDKRouteParameters route_params_conv;
61143         route_params_conv.inner = untag_ptr(route_params);
61144         route_params_conv.is_owned = ptr_is_owned(route_params);
61145         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
61146         route_params_conv.is_owned = false;
61147         LDKNetworkGraph network_graph_conv;
61148         network_graph_conv.inner = untag_ptr(network_graph);
61149         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61150         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61151         network_graph_conv.is_owned = false;
61152         LDKCVec_ChannelDetailsZ first_hops_constr;
61153         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
61154         if (first_hops != NULL) {
61155                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
61156                 if (first_hops_constr.datalen > 0)
61157                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
61158                 else
61159                         first_hops_constr.data = NULL;
61160                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
61161                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
61162                         int64_t first_hops_conv_16 = first_hops_vals[q];
61163                         LDKChannelDetails first_hops_conv_16_conv;
61164                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
61165                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
61166                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
61167                         first_hops_conv_16_conv.is_owned = false;
61168                         first_hops_constr.data[q] = first_hops_conv_16_conv;
61169                 }
61170                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
61171                 first_hops_ptr = &first_hops_constr;
61172         }
61173         void* logger_ptr = untag_ptr(logger);
61174         CHECK_ACCESS(logger_ptr);
61175         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61176         if (logger_conv.free == LDKLogger_JCalls_free) {
61177                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61178                 LDKLogger_JCalls_cloned(&logger_conv);
61179         }
61180         void* scorer_ptr = untag_ptr(scorer);
61181         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
61182         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
61183         LDKProbabilisticScoringFeeParameters score_params_conv;
61184         score_params_conv.inner = untag_ptr(score_params);
61185         score_params_conv.is_owned = ptr_is_owned(score_params);
61186         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
61187         score_params_conv.is_owned = false;
61188         uint8_t random_seed_bytes_arr[32];
61189         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
61190         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
61191         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
61192         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
61193         *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, &score_params_conv, random_seed_bytes_ref);
61194         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
61195         return tag_ptr(ret_conv, true);
61196 }
61197
61198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_build_1route_1from_1hops(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, jobjectArray hops, int64_t route_params, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) {
61199         LDKPublicKey our_node_pubkey_ref;
61200         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
61201         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
61202         LDKCVec_PublicKeyZ hops_constr;
61203         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
61204         if (hops_constr.datalen > 0)
61205                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
61206         else
61207                 hops_constr.data = NULL;
61208         for (size_t i = 0; i < hops_constr.datalen; i++) {
61209                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
61210                 LDKPublicKey hops_conv_8_ref;
61211                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
61212                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
61213                 hops_constr.data[i] = hops_conv_8_ref;
61214         }
61215         LDKRouteParameters route_params_conv;
61216         route_params_conv.inner = untag_ptr(route_params);
61217         route_params_conv.is_owned = ptr_is_owned(route_params);
61218         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
61219         route_params_conv.is_owned = false;
61220         LDKNetworkGraph network_graph_conv;
61221         network_graph_conv.inner = untag_ptr(network_graph);
61222         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61223         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61224         network_graph_conv.is_owned = false;
61225         void* logger_ptr = untag_ptr(logger);
61226         CHECK_ACCESS(logger_ptr);
61227         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61228         if (logger_conv.free == LDKLogger_JCalls_free) {
61229                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61230                 LDKLogger_JCalls_cloned(&logger_conv);
61231         }
61232         uint8_t random_seed_bytes_arr[32];
61233         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
61234         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
61235         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
61236         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
61237         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
61238         return tag_ptr(ret_conv, true);
61239 }
61240
61241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61242         if (!ptr_is_owned(this_ptr)) return;
61243         void* this_ptr_ptr = untag_ptr(this_ptr);
61244         CHECK_ACCESS(this_ptr_ptr);
61245         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
61246         FREE(untag_ptr(this_ptr));
61247         Score_free(this_ptr_conv);
61248 }
61249
61250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61251         if (!ptr_is_owned(this_ptr)) return;
61252         void* this_ptr_ptr = untag_ptr(this_ptr);
61253         CHECK_ACCESS(this_ptr_ptr);
61254         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
61255         FREE(untag_ptr(this_ptr));
61256         LockableScore_free(this_ptr_conv);
61257 }
61258
61259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61260         if (!ptr_is_owned(this_ptr)) return;
61261         void* this_ptr_ptr = untag_ptr(this_ptr);
61262         CHECK_ACCESS(this_ptr_ptr);
61263         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
61264         FREE(untag_ptr(this_ptr));
61265         WriteableScore_free(this_ptr_conv);
61266 }
61267
61268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61269         LDKMultiThreadedLockableScore this_obj_conv;
61270         this_obj_conv.inner = untag_ptr(this_obj);
61271         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61273         MultiThreadedLockableScore_free(this_obj_conv);
61274 }
61275
61276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
61277         LDKMultiThreadedLockableScore this_arg_conv;
61278         this_arg_conv.inner = untag_ptr(this_arg);
61279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61281         this_arg_conv.is_owned = false;
61282         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
61283         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
61284         return tag_ptr(ret_ret, true);
61285 }
61286
61287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
61288         LDKMultiThreadedLockableScore obj_conv;
61289         obj_conv.inner = untag_ptr(obj);
61290         obj_conv.is_owned = ptr_is_owned(obj);
61291         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61292         obj_conv.is_owned = false;
61293         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
61294         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61295         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61296         CVec_u8Z_free(ret_var);
61297         return ret_arr;
61298 }
61299
61300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
61301         LDKMultiThreadedLockableScore this_arg_conv;
61302         this_arg_conv.inner = untag_ptr(this_arg);
61303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61305         this_arg_conv.is_owned = false;
61306         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
61307         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
61308         return tag_ptr(ret_ret, true);
61309 }
61310
61311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
61312         void* score_ptr = untag_ptr(score);
61313         CHECK_ACCESS(score_ptr);
61314         LDKScore score_conv = *(LDKScore*)(score_ptr);
61315         if (score_conv.free == LDKScore_JCalls_free) {
61316                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61317                 LDKScore_JCalls_cloned(&score_conv);
61318         }
61319         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
61320         int64_t ret_ref = 0;
61321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61323         return ret_ref;
61324 }
61325
61326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61327         LDKMultiThreadedScoreLock this_obj_conv;
61328         this_obj_conv.inner = untag_ptr(this_obj);
61329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61331         MultiThreadedScoreLock_free(this_obj_conv);
61332 }
61333
61334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1write(JNIEnv *env, jclass clz, int64_t obj) {
61335         LDKMultiThreadedScoreLock obj_conv;
61336         obj_conv.inner = untag_ptr(obj);
61337         obj_conv.is_owned = ptr_is_owned(obj);
61338         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61339         obj_conv.is_owned = false;
61340         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
61341         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61342         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61343         CVec_u8Z_free(ret_var);
61344         return ret_arr;
61345 }
61346
61347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
61348         LDKMultiThreadedScoreLock this_arg_conv;
61349         this_arg_conv.inner = untag_ptr(this_arg);
61350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61352         this_arg_conv.is_owned = false;
61353         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
61354         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
61355         return tag_ptr(ret_ret, true);
61356 }
61357
61358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61359         LDKChannelUsage this_obj_conv;
61360         this_obj_conv.inner = untag_ptr(this_obj);
61361         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61363         ChannelUsage_free(this_obj_conv);
61364 }
61365
61366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61367         LDKChannelUsage this_ptr_conv;
61368         this_ptr_conv.inner = untag_ptr(this_ptr);
61369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61371         this_ptr_conv.is_owned = false;
61372         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
61373         return ret_conv;
61374 }
61375
61376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61377         LDKChannelUsage this_ptr_conv;
61378         this_ptr_conv.inner = untag_ptr(this_ptr);
61379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61381         this_ptr_conv.is_owned = false;
61382         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
61383 }
61384
61385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61386         LDKChannelUsage this_ptr_conv;
61387         this_ptr_conv.inner = untag_ptr(this_ptr);
61388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61390         this_ptr_conv.is_owned = false;
61391         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
61392         return ret_conv;
61393 }
61394
61395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61396         LDKChannelUsage this_ptr_conv;
61397         this_ptr_conv.inner = untag_ptr(this_ptr);
61398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61400         this_ptr_conv.is_owned = false;
61401         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
61402 }
61403
61404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
61405         LDKChannelUsage this_ptr_conv;
61406         this_ptr_conv.inner = untag_ptr(this_ptr);
61407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61409         this_ptr_conv.is_owned = false;
61410         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
61411         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
61412         int64_t ret_ref = tag_ptr(ret_copy, true);
61413         return ret_ref;
61414 }
61415
61416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61417         LDKChannelUsage this_ptr_conv;
61418         this_ptr_conv.inner = untag_ptr(this_ptr);
61419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61421         this_ptr_conv.is_owned = false;
61422         void* val_ptr = untag_ptr(val);
61423         CHECK_ACCESS(val_ptr);
61424         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
61425         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
61426         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
61427 }
61428
61429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1new(JNIEnv *env, jclass clz, int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, int64_t effective_capacity_arg) {
61430         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
61431         CHECK_ACCESS(effective_capacity_arg_ptr);
61432         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
61433         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
61434         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
61435         int64_t ret_ref = 0;
61436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61438         return ret_ref;
61439 }
61440
61441 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
61442         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
61443         int64_t ret_ref = 0;
61444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61446         return ret_ref;
61447 }
61448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61449         LDKChannelUsage arg_conv;
61450         arg_conv.inner = untag_ptr(arg);
61451         arg_conv.is_owned = ptr_is_owned(arg);
61452         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61453         arg_conv.is_owned = false;
61454         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
61455         return ret_conv;
61456 }
61457
61458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61459         LDKChannelUsage orig_conv;
61460         orig_conv.inner = untag_ptr(orig);
61461         orig_conv.is_owned = ptr_is_owned(orig);
61462         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61463         orig_conv.is_owned = false;
61464         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
61465         int64_t ret_ref = 0;
61466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61468         return ret_ref;
61469 }
61470
61471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61472         LDKFixedPenaltyScorer this_obj_conv;
61473         this_obj_conv.inner = untag_ptr(this_obj);
61474         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61476         FixedPenaltyScorer_free(this_obj_conv);
61477 }
61478
61479 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
61480         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
61481         int64_t ret_ref = 0;
61482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61484         return ret_ref;
61485 }
61486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61487         LDKFixedPenaltyScorer arg_conv;
61488         arg_conv.inner = untag_ptr(arg);
61489         arg_conv.is_owned = ptr_is_owned(arg);
61490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61491         arg_conv.is_owned = false;
61492         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
61493         return ret_conv;
61494 }
61495
61496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61497         LDKFixedPenaltyScorer orig_conv;
61498         orig_conv.inner = untag_ptr(orig);
61499         orig_conv.is_owned = ptr_is_owned(orig);
61500         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61501         orig_conv.is_owned = false;
61502         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
61503         int64_t ret_ref = 0;
61504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61506         return ret_ref;
61507 }
61508
61509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
61510         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
61511         int64_t ret_ref = 0;
61512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61514         return ret_ref;
61515 }
61516
61517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
61518         LDKFixedPenaltyScorer this_arg_conv;
61519         this_arg_conv.inner = untag_ptr(this_arg);
61520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61522         this_arg_conv.is_owned = false;
61523         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
61524         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
61525         return tag_ptr(ret_ret, true);
61526 }
61527
61528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
61529         LDKFixedPenaltyScorer obj_conv;
61530         obj_conv.inner = untag_ptr(obj);
61531         obj_conv.is_owned = ptr_is_owned(obj);
61532         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61533         obj_conv.is_owned = false;
61534         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
61535         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61536         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61537         CVec_u8Z_free(ret_var);
61538         return ret_arr;
61539 }
61540
61541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
61542         LDKu8slice ser_ref;
61543         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61544         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61545         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
61546         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
61547         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61548         return tag_ptr(ret_conv, true);
61549 }
61550
61551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61552         LDKProbabilisticScorer this_obj_conv;
61553         this_obj_conv.inner = untag_ptr(this_obj);
61554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61556         ProbabilisticScorer_free(this_obj_conv);
61557 }
61558
61559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61560         LDKProbabilisticScoringFeeParameters this_obj_conv;
61561         this_obj_conv.inner = untag_ptr(this_obj);
61562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61564         ProbabilisticScoringFeeParameters_free(this_obj_conv);
61565 }
61566
61567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61568         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61569         this_ptr_conv.inner = untag_ptr(this_ptr);
61570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61572         this_ptr_conv.is_owned = false;
61573         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
61574         return ret_conv;
61575 }
61576
61577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61578         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61579         this_ptr_conv.inner = untag_ptr(this_ptr);
61580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61582         this_ptr_conv.is_owned = false;
61583         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
61584 }
61585
61586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61587         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61588         this_ptr_conv.inner = untag_ptr(this_ptr);
61589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61591         this_ptr_conv.is_owned = false;
61592         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
61593         return ret_conv;
61594 }
61595
61596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61597         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61598         this_ptr_conv.inner = untag_ptr(this_ptr);
61599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61601         this_ptr_conv.is_owned = false;
61602         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
61603 }
61604
61605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61606         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61607         this_ptr_conv.inner = untag_ptr(this_ptr);
61608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61610         this_ptr_conv.is_owned = false;
61611         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
61612         return ret_conv;
61613 }
61614
61615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61616         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61617         this_ptr_conv.inner = untag_ptr(this_ptr);
61618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61620         this_ptr_conv.is_owned = false;
61621         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
61622 }
61623
61624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61625         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61626         this_ptr_conv.inner = untag_ptr(this_ptr);
61627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61629         this_ptr_conv.is_owned = false;
61630         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
61631         return ret_conv;
61632 }
61633
61634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61635         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61636         this_ptr_conv.inner = untag_ptr(this_ptr);
61637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61639         this_ptr_conv.is_owned = false;
61640         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
61641 }
61642
61643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61644         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61645         this_ptr_conv.inner = untag_ptr(this_ptr);
61646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61648         this_ptr_conv.is_owned = false;
61649         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
61650         return ret_conv;
61651 }
61652
61653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61654         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61655         this_ptr_conv.inner = untag_ptr(this_ptr);
61656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61658         this_ptr_conv.is_owned = false;
61659         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
61660 }
61661
61662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61663         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61664         this_ptr_conv.inner = untag_ptr(this_ptr);
61665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61667         this_ptr_conv.is_owned = false;
61668         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
61669         return ret_conv;
61670 }
61671
61672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1historical_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61673         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61674         this_ptr_conv.inner = untag_ptr(this_ptr);
61675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61677         this_ptr_conv.is_owned = false;
61678         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
61679 }
61680
61681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61682         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61683         this_ptr_conv.inner = untag_ptr(this_ptr);
61684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61686         this_ptr_conv.is_owned = false;
61687         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
61688         return ret_conv;
61689 }
61690
61691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61692         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61693         this_ptr_conv.inner = untag_ptr(this_ptr);
61694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61696         this_ptr_conv.is_owned = false;
61697         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
61698 }
61699
61700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61701         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61702         this_ptr_conv.inner = untag_ptr(this_ptr);
61703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61705         this_ptr_conv.is_owned = false;
61706         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
61707         return ret_conv;
61708 }
61709
61710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61711         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61712         this_ptr_conv.inner = untag_ptr(this_ptr);
61713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61715         this_ptr_conv.is_owned = false;
61716         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
61717 }
61718
61719 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
61720         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
61721         int64_t ret_ref = 0;
61722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61724         return ret_ref;
61725 }
61726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61727         LDKProbabilisticScoringFeeParameters arg_conv;
61728         arg_conv.inner = untag_ptr(arg);
61729         arg_conv.is_owned = ptr_is_owned(arg);
61730         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61731         arg_conv.is_owned = false;
61732         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
61733         return ret_conv;
61734 }
61735
61736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61737         LDKProbabilisticScoringFeeParameters orig_conv;
61738         orig_conv.inner = untag_ptr(orig);
61739         orig_conv.is_owned = ptr_is_owned(orig);
61740         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61741         orig_conv.is_owned = false;
61742         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
61743         int64_t ret_ref = 0;
61744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61746         return ret_ref;
61747 }
61748
61749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
61750         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
61751         int64_t ret_ref = 0;
61752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61754         return ret_ref;
61755 }
61756
61757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
61758         LDKProbabilisticScoringFeeParameters this_arg_conv;
61759         this_arg_conv.inner = untag_ptr(this_arg);
61760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61762         this_arg_conv.is_owned = false;
61763         LDKNodeId node_id_conv;
61764         node_id_conv.inner = untag_ptr(node_id);
61765         node_id_conv.is_owned = ptr_is_owned(node_id);
61766         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61767         node_id_conv.is_owned = false;
61768         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
61769 }
61770
61771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned_1from_1list(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray node_ids) {
61772         LDKProbabilisticScoringFeeParameters this_arg_conv;
61773         this_arg_conv.inner = untag_ptr(this_arg);
61774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61776         this_arg_conv.is_owned = false;
61777         LDKCVec_NodeIdZ node_ids_constr;
61778         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
61779         if (node_ids_constr.datalen > 0)
61780                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
61781         else
61782                 node_ids_constr.data = NULL;
61783         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
61784         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
61785                 int64_t node_ids_conv_8 = node_ids_vals[i];
61786                 LDKNodeId node_ids_conv_8_conv;
61787                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
61788                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
61789                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
61790                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
61791                 node_ids_constr.data[i] = node_ids_conv_8_conv;
61792         }
61793         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
61794         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
61795 }
61796
61797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
61798         LDKProbabilisticScoringFeeParameters this_arg_conv;
61799         this_arg_conv.inner = untag_ptr(this_arg);
61800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61802         this_arg_conv.is_owned = false;
61803         LDKNodeId node_id_conv;
61804         node_id_conv.inner = untag_ptr(node_id);
61805         node_id_conv.is_owned = ptr_is_owned(node_id);
61806         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61807         node_id_conv.is_owned = false;
61808         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
61809 }
61810
61811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id, int64_t penalty) {
61812         LDKProbabilisticScoringFeeParameters this_arg_conv;
61813         this_arg_conv.inner = untag_ptr(this_arg);
61814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61816         this_arg_conv.is_owned = false;
61817         LDKNodeId node_id_conv;
61818         node_id_conv.inner = untag_ptr(node_id);
61819         node_id_conv.is_owned = ptr_is_owned(node_id);
61820         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61821         node_id_conv.is_owned = false;
61822         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
61823 }
61824
61825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
61826         LDKProbabilisticScoringFeeParameters this_arg_conv;
61827         this_arg_conv.inner = untag_ptr(this_arg);
61828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61830         this_arg_conv.is_owned = false;
61831         LDKNodeId node_id_conv;
61832         node_id_conv.inner = untag_ptr(node_id);
61833         node_id_conv.is_owned = ptr_is_owned(node_id);
61834         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61835         node_id_conv.is_owned = false;
61836         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
61837 }
61838
61839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
61840         LDKProbabilisticScoringFeeParameters this_arg_conv;
61841         this_arg_conv.inner = untag_ptr(this_arg);
61842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61844         this_arg_conv.is_owned = false;
61845         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
61846 }
61847
61848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61849         LDKProbabilisticScoringDecayParameters this_obj_conv;
61850         this_obj_conv.inner = untag_ptr(this_obj);
61851         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61853         ProbabilisticScoringDecayParameters_free(this_obj_conv);
61854 }
61855
61856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
61857         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61858         this_ptr_conv.inner = untag_ptr(this_ptr);
61859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61861         this_ptr_conv.is_owned = false;
61862         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
61863         return ret_conv;
61864 }
61865
61866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1set_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61867         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61868         this_ptr_conv.inner = untag_ptr(this_ptr);
61869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61871         this_ptr_conv.is_owned = false;
61872         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
61873 }
61874
61875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
61876         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61877         this_ptr_conv.inner = untag_ptr(this_ptr);
61878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61880         this_ptr_conv.is_owned = false;
61881         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
61882         return ret_conv;
61883 }
61884
61885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1set_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61886         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61887         this_ptr_conv.inner = untag_ptr(this_ptr);
61888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61890         this_ptr_conv.is_owned = false;
61891         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
61892 }
61893
61894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1new(JNIEnv *env, jclass clz, int64_t historical_no_updates_half_life_arg, int64_t liquidity_offset_half_life_arg) {
61895         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
61896         int64_t ret_ref = 0;
61897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61899         return ret_ref;
61900 }
61901
61902 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
61903         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
61904         int64_t ret_ref = 0;
61905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61907         return ret_ref;
61908 }
61909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61910         LDKProbabilisticScoringDecayParameters arg_conv;
61911         arg_conv.inner = untag_ptr(arg);
61912         arg_conv.is_owned = ptr_is_owned(arg);
61913         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61914         arg_conv.is_owned = false;
61915         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
61916         return ret_conv;
61917 }
61918
61919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61920         LDKProbabilisticScoringDecayParameters orig_conv;
61921         orig_conv.inner = untag_ptr(orig);
61922         orig_conv.is_owned = ptr_is_owned(orig);
61923         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61924         orig_conv.is_owned = false;
61925         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
61926         int64_t ret_ref = 0;
61927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61929         return ret_ref;
61930 }
61931
61932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
61933         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
61934         int64_t ret_ref = 0;
61935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61937         return ret_ref;
61938 }
61939
61940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t decay_params, int64_t network_graph, int64_t logger) {
61941         LDKProbabilisticScoringDecayParameters decay_params_conv;
61942         decay_params_conv.inner = untag_ptr(decay_params);
61943         decay_params_conv.is_owned = ptr_is_owned(decay_params);
61944         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
61945         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
61946         LDKNetworkGraph network_graph_conv;
61947         network_graph_conv.inner = untag_ptr(network_graph);
61948         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61949         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61950         network_graph_conv.is_owned = false;
61951         void* logger_ptr = untag_ptr(logger);
61952         CHECK_ACCESS(logger_ptr);
61953         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61954         if (logger_conv.free == LDKLogger_JCalls_free) {
61955                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61956                 LDKLogger_JCalls_cloned(&logger_conv);
61957         }
61958         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
61959         int64_t ret_ref = 0;
61960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61962         return ret_ref;
61963 }
61964
61965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
61966         LDKProbabilisticScorer this_arg_conv;
61967         this_arg_conv.inner = untag_ptr(this_arg);
61968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61970         this_arg_conv.is_owned = false;
61971         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
61972 }
61973
61974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1estimated_1channel_1liquidity_1range(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) {
61975         LDKProbabilisticScorer this_arg_conv;
61976         this_arg_conv.inner = untag_ptr(this_arg);
61977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61979         this_arg_conv.is_owned = false;
61980         LDKNodeId target_conv;
61981         target_conv.inner = untag_ptr(target);
61982         target_conv.is_owned = ptr_is_owned(target);
61983         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
61984         target_conv.is_owned = false;
61985         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
61986         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
61987         int64_t ret_ref = tag_ptr(ret_copy, true);
61988         return ret_ref;
61989 }
61990
61991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1historical_1estimated_1channel_1liquidity_1probabilities(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scid, int64_t target) {
61992         LDKProbabilisticScorer this_arg_conv;
61993         this_arg_conv.inner = untag_ptr(this_arg);
61994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61996         this_arg_conv.is_owned = false;
61997         LDKNodeId target_conv;
61998         target_conv.inner = untag_ptr(target);
61999         target_conv.is_owned = ptr_is_owned(target);
62000         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
62001         target_conv.is_owned = false;
62002         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
62003         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
62004         int64_t ret_ref = tag_ptr(ret_copy, true);
62005         return ret_ref;
62006 }
62007
62008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
62009         LDKProbabilisticScorer this_arg_conv;
62010         this_arg_conv.inner = untag_ptr(this_arg);
62011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62013         this_arg_conv.is_owned = false;
62014         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
62015         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
62016         return tag_ptr(ret_ret, true);
62017 }
62018
62019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
62020         LDKProbabilisticScorer obj_conv;
62021         obj_conv.inner = untag_ptr(obj);
62022         obj_conv.is_owned = ptr_is_owned(obj);
62023         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62024         obj_conv.is_owned = false;
62025         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
62026         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62027         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62028         CVec_u8Z_free(ret_var);
62029         return ret_arr;
62030 }
62031
62032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c) {
62033         LDKu8slice ser_ref;
62034         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62035         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62036         LDKProbabilisticScoringDecayParameters arg_a_conv;
62037         arg_a_conv.inner = untag_ptr(arg_a);
62038         arg_a_conv.is_owned = ptr_is_owned(arg_a);
62039         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
62040         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
62041         LDKNetworkGraph arg_b_conv;
62042         arg_b_conv.inner = untag_ptr(arg_b);
62043         arg_b_conv.is_owned = ptr_is_owned(arg_b);
62044         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
62045         arg_b_conv.is_owned = false;
62046         void* arg_c_ptr = untag_ptr(arg_c);
62047         CHECK_ACCESS(arg_c_ptr);
62048         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
62049         if (arg_c_conv.free == LDKLogger_JCalls_free) {
62050                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62051                 LDKLogger_JCalls_cloned(&arg_c_conv);
62052         }
62053         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
62054         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
62055         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62056         return tag_ptr(ret_conv, true);
62057 }
62058
62059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62060         LDKDelayedPaymentOutputDescriptor this_obj_conv;
62061         this_obj_conv.inner = untag_ptr(this_obj);
62062         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62064         DelayedPaymentOutputDescriptor_free(this_obj_conv);
62065 }
62066
62067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
62068         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62069         this_ptr_conv.inner = untag_ptr(this_ptr);
62070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62072         this_ptr_conv.is_owned = false;
62073         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
62074         int64_t ret_ref = 0;
62075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62077         return ret_ref;
62078 }
62079
62080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62081         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62082         this_ptr_conv.inner = untag_ptr(this_ptr);
62083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62085         this_ptr_conv.is_owned = false;
62086         LDKOutPoint val_conv;
62087         val_conv.inner = untag_ptr(val);
62088         val_conv.is_owned = ptr_is_owned(val);
62089         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62090         val_conv = OutPoint_clone(&val_conv);
62091         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
62092 }
62093
62094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
62095         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62096         this_ptr_conv.inner = untag_ptr(this_ptr);
62097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62099         this_ptr_conv.is_owned = false;
62100         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62101         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
62102         return ret_arr;
62103 }
62104
62105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62106         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62107         this_ptr_conv.inner = untag_ptr(this_ptr);
62108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62110         this_ptr_conv.is_owned = false;
62111         LDKPublicKey val_ref;
62112         CHECK((*env)->GetArrayLength(env, val) == 33);
62113         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62114         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
62115 }
62116
62117 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
62118         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62119         this_ptr_conv.inner = untag_ptr(this_ptr);
62120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62122         this_ptr_conv.is_owned = false;
62123         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
62124         return ret_conv;
62125 }
62126
62127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
62128         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62129         this_ptr_conv.inner = untag_ptr(this_ptr);
62130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62132         this_ptr_conv.is_owned = false;
62133         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
62134 }
62135
62136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
62137         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62138         this_ptr_conv.inner = untag_ptr(this_ptr);
62139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62141         this_ptr_conv.is_owned = false;
62142         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
62143         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
62144         return tag_ptr(ret_ref, true);
62145 }
62146
62147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62148         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62149         this_ptr_conv.inner = untag_ptr(this_ptr);
62150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62152         this_ptr_conv.is_owned = false;
62153         void* val_ptr = untag_ptr(val);
62154         CHECK_ACCESS(val_ptr);
62155         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
62156         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
62157         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
62158 }
62159
62160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
62161         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62162         this_ptr_conv.inner = untag_ptr(this_ptr);
62163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62165         this_ptr_conv.is_owned = false;
62166         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62167         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
62168         return ret_arr;
62169 }
62170
62171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62172         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62173         this_ptr_conv.inner = untag_ptr(this_ptr);
62174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62176         this_ptr_conv.is_owned = false;
62177         LDKPublicKey val_ref;
62178         CHECK((*env)->GetArrayLength(env, val) == 33);
62179         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62180         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
62181 }
62182
62183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
62184         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62185         this_ptr_conv.inner = untag_ptr(this_ptr);
62186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62188         this_ptr_conv.is_owned = false;
62189         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62190         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
62191         return ret_arr;
62192 }
62193
62194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62195         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62196         this_ptr_conv.inner = untag_ptr(this_ptr);
62197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62199         this_ptr_conv.is_owned = false;
62200         LDKThirtyTwoBytes val_ref;
62201         CHECK((*env)->GetArrayLength(env, val) == 32);
62202         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
62203         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
62204 }
62205
62206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
62207         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62208         this_ptr_conv.inner = untag_ptr(this_ptr);
62209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62211         this_ptr_conv.is_owned = false;
62212         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
62213         return ret_conv;
62214 }
62215
62216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62217         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62218         this_ptr_conv.inner = untag_ptr(this_ptr);
62219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62221         this_ptr_conv.is_owned = false;
62222         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
62223 }
62224
62225 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) {
62226         LDKOutPoint outpoint_arg_conv;
62227         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
62228         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
62229         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
62230         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
62231         LDKPublicKey per_commitment_point_arg_ref;
62232         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
62233         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
62234         void* output_arg_ptr = untag_ptr(output_arg);
62235         CHECK_ACCESS(output_arg_ptr);
62236         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
62237         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
62238         LDKPublicKey revocation_pubkey_arg_ref;
62239         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
62240         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
62241         LDKThirtyTwoBytes channel_keys_id_arg_ref;
62242         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
62243         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
62244         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);
62245         int64_t ret_ref = 0;
62246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62248         return ret_ref;
62249 }
62250
62251 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
62252         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
62253         int64_t ret_ref = 0;
62254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62256         return ret_ref;
62257 }
62258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62259         LDKDelayedPaymentOutputDescriptor arg_conv;
62260         arg_conv.inner = untag_ptr(arg);
62261         arg_conv.is_owned = ptr_is_owned(arg);
62262         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62263         arg_conv.is_owned = false;
62264         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
62265         return ret_conv;
62266 }
62267
62268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62269         LDKDelayedPaymentOutputDescriptor orig_conv;
62270         orig_conv.inner = untag_ptr(orig);
62271         orig_conv.is_owned = ptr_is_owned(orig);
62272         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62273         orig_conv.is_owned = false;
62274         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
62275         int64_t ret_ref = 0;
62276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62278         return ret_ref;
62279 }
62280
62281 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62282         LDKDelayedPaymentOutputDescriptor a_conv;
62283         a_conv.inner = untag_ptr(a);
62284         a_conv.is_owned = ptr_is_owned(a);
62285         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62286         a_conv.is_owned = false;
62287         LDKDelayedPaymentOutputDescriptor b_conv;
62288         b_conv.inner = untag_ptr(b);
62289         b_conv.is_owned = ptr_is_owned(b);
62290         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62291         b_conv.is_owned = false;
62292         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
62293         return ret_conv;
62294 }
62295
62296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
62297         LDKDelayedPaymentOutputDescriptor obj_conv;
62298         obj_conv.inner = untag_ptr(obj);
62299         obj_conv.is_owned = ptr_is_owned(obj);
62300         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62301         obj_conv.is_owned = false;
62302         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
62303         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62304         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62305         CVec_u8Z_free(ret_var);
62306         return ret_arr;
62307 }
62308
62309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62310         LDKu8slice ser_ref;
62311         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62312         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62313         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
62314         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
62315         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62316         return tag_ptr(ret_conv, true);
62317 }
62318
62319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62320         LDKStaticPaymentOutputDescriptor this_obj_conv;
62321         this_obj_conv.inner = untag_ptr(this_obj);
62322         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62324         StaticPaymentOutputDescriptor_free(this_obj_conv);
62325 }
62326
62327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
62328         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62329         this_ptr_conv.inner = untag_ptr(this_ptr);
62330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62332         this_ptr_conv.is_owned = false;
62333         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
62334         int64_t ret_ref = 0;
62335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62337         return ret_ref;
62338 }
62339
62340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62341         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62342         this_ptr_conv.inner = untag_ptr(this_ptr);
62343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62345         this_ptr_conv.is_owned = false;
62346         LDKOutPoint val_conv;
62347         val_conv.inner = untag_ptr(val);
62348         val_conv.is_owned = ptr_is_owned(val);
62349         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62350         val_conv = OutPoint_clone(&val_conv);
62351         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
62352 }
62353
62354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
62355         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62356         this_ptr_conv.inner = untag_ptr(this_ptr);
62357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62359         this_ptr_conv.is_owned = false;
62360         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
62361         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
62362         return tag_ptr(ret_ref, true);
62363 }
62364
62365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62366         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62367         this_ptr_conv.inner = untag_ptr(this_ptr);
62368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62370         this_ptr_conv.is_owned = false;
62371         void* val_ptr = untag_ptr(val);
62372         CHECK_ACCESS(val_ptr);
62373         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
62374         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
62375         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
62376 }
62377
62378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
62379         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62380         this_ptr_conv.inner = untag_ptr(this_ptr);
62381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62383         this_ptr_conv.is_owned = false;
62384         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62385         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
62386         return ret_arr;
62387 }
62388
62389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62390         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62391         this_ptr_conv.inner = untag_ptr(this_ptr);
62392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62394         this_ptr_conv.is_owned = false;
62395         LDKThirtyTwoBytes val_ref;
62396         CHECK((*env)->GetArrayLength(env, val) == 32);
62397         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
62398         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
62399 }
62400
62401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
62402         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62403         this_ptr_conv.inner = untag_ptr(this_ptr);
62404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62406         this_ptr_conv.is_owned = false;
62407         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
62408         return ret_conv;
62409 }
62410
62411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62412         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62413         this_ptr_conv.inner = untag_ptr(this_ptr);
62414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62416         this_ptr_conv.is_owned = false;
62417         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
62418 }
62419
62420 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) {
62421         LDKOutPoint outpoint_arg_conv;
62422         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
62423         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
62424         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
62425         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
62426         void* output_arg_ptr = untag_ptr(output_arg);
62427         CHECK_ACCESS(output_arg_ptr);
62428         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
62429         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
62430         LDKThirtyTwoBytes channel_keys_id_arg_ref;
62431         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
62432         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
62433         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
62434         int64_t ret_ref = 0;
62435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62437         return ret_ref;
62438 }
62439
62440 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
62441         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
62442         int64_t ret_ref = 0;
62443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62445         return ret_ref;
62446 }
62447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62448         LDKStaticPaymentOutputDescriptor arg_conv;
62449         arg_conv.inner = untag_ptr(arg);
62450         arg_conv.is_owned = ptr_is_owned(arg);
62451         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62452         arg_conv.is_owned = false;
62453         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
62454         return ret_conv;
62455 }
62456
62457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62458         LDKStaticPaymentOutputDescriptor orig_conv;
62459         orig_conv.inner = untag_ptr(orig);
62460         orig_conv.is_owned = ptr_is_owned(orig);
62461         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62462         orig_conv.is_owned = false;
62463         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
62464         int64_t ret_ref = 0;
62465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62467         return ret_ref;
62468 }
62469
62470 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62471         LDKStaticPaymentOutputDescriptor a_conv;
62472         a_conv.inner = untag_ptr(a);
62473         a_conv.is_owned = ptr_is_owned(a);
62474         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62475         a_conv.is_owned = false;
62476         LDKStaticPaymentOutputDescriptor b_conv;
62477         b_conv.inner = untag_ptr(b);
62478         b_conv.is_owned = ptr_is_owned(b);
62479         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62480         b_conv.is_owned = false;
62481         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
62482         return ret_conv;
62483 }
62484
62485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
62486         LDKStaticPaymentOutputDescriptor obj_conv;
62487         obj_conv.inner = untag_ptr(obj);
62488         obj_conv.is_owned = ptr_is_owned(obj);
62489         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62490         obj_conv.is_owned = false;
62491         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
62492         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62493         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62494         CVec_u8Z_free(ret_var);
62495         return ret_arr;
62496 }
62497
62498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62499         LDKu8slice ser_ref;
62500         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62501         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62502         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
62503         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
62504         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62505         return tag_ptr(ret_conv, true);
62506 }
62507
62508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62509         if (!ptr_is_owned(this_ptr)) return;
62510         void* this_ptr_ptr = untag_ptr(this_ptr);
62511         CHECK_ACCESS(this_ptr_ptr);
62512         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
62513         FREE(untag_ptr(this_ptr));
62514         SpendableOutputDescriptor_free(this_ptr_conv);
62515 }
62516
62517 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
62518         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62519         *ret_copy = SpendableOutputDescriptor_clone(arg);
62520         int64_t ret_ref = tag_ptr(ret_copy, true);
62521         return ret_ref;
62522 }
62523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62524         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
62525         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
62526         return ret_conv;
62527 }
62528
62529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62530         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
62531         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62532         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
62533         int64_t ret_ref = tag_ptr(ret_copy, true);
62534         return ret_ref;
62535 }
62536
62537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
62538         LDKOutPoint outpoint_conv;
62539         outpoint_conv.inner = untag_ptr(outpoint);
62540         outpoint_conv.is_owned = ptr_is_owned(outpoint);
62541         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
62542         outpoint_conv = OutPoint_clone(&outpoint_conv);
62543         void* output_ptr = untag_ptr(output);
62544         CHECK_ACCESS(output_ptr);
62545         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
62546         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
62547         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62548         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
62549         int64_t ret_ref = tag_ptr(ret_copy, true);
62550         return ret_ref;
62551 }
62552
62553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
62554         LDKDelayedPaymentOutputDescriptor a_conv;
62555         a_conv.inner = untag_ptr(a);
62556         a_conv.is_owned = ptr_is_owned(a);
62557         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62558         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
62559         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62560         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
62561         int64_t ret_ref = tag_ptr(ret_copy, true);
62562         return ret_ref;
62563 }
62564
62565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
62566         LDKStaticPaymentOutputDescriptor a_conv;
62567         a_conv.inner = untag_ptr(a);
62568         a_conv.is_owned = ptr_is_owned(a);
62569         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62570         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
62571         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62572         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
62573         int64_t ret_ref = tag_ptr(ret_copy, true);
62574         return ret_ref;
62575 }
62576
62577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62578         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
62579         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
62580         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
62581         return ret_conv;
62582 }
62583
62584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
62585         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
62586         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
62587         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62588         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62589         CVec_u8Z_free(ret_var);
62590         return ret_arr;
62591 }
62592
62593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62594         LDKu8slice ser_ref;
62595         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62596         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62597         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
62598         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
62599         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62600         return tag_ptr(ret_conv, true);
62601 }
62602
62603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1create_1spendable_1outputs_1psbt(JNIEnv *env, jclass clz, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
62604         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62605         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
62606         if (descriptors_constr.datalen > 0)
62607                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62608         else
62609                 descriptors_constr.data = NULL;
62610         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
62611         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62612                 int64_t descriptors_conv_27 = descriptors_vals[b];
62613                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62614                 CHECK_ACCESS(descriptors_conv_27_ptr);
62615                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62616                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62617                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62618         }
62619         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
62620         LDKCVec_TxOutZ outputs_constr;
62621         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
62622         if (outputs_constr.datalen > 0)
62623                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
62624         else
62625                 outputs_constr.data = NULL;
62626         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
62627         for (size_t h = 0; h < outputs_constr.datalen; h++) {
62628                 int64_t outputs_conv_7 = outputs_vals[h];
62629                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
62630                 CHECK_ACCESS(outputs_conv_7_ptr);
62631                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
62632                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
62633                 outputs_constr.data[h] = outputs_conv_7_conv;
62634         }
62635         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
62636         LDKCVec_u8Z change_destination_script_ref;
62637         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
62638         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
62639         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
62640         void* locktime_ptr = untag_ptr(locktime);
62641         CHECK_ACCESS(locktime_ptr);
62642         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
62643         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
62644         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
62645         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
62646         return tag_ptr(ret_conv, true);
62647 }
62648
62649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62650         if (!ptr_is_owned(this_ptr)) return;
62651         void* this_ptr_ptr = untag_ptr(this_ptr);
62652         CHECK_ACCESS(this_ptr_ptr);
62653         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
62654         FREE(untag_ptr(this_ptr));
62655         ChannelSigner_free(this_ptr_conv);
62656 }
62657
62658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62659         if (!ptr_is_owned(this_ptr)) return;
62660         void* this_ptr_ptr = untag_ptr(this_ptr);
62661         CHECK_ACCESS(this_ptr_ptr);
62662         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
62663         FREE(untag_ptr(this_ptr));
62664         EcdsaChannelSigner_free(this_ptr_conv);
62665 }
62666
62667 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
62668         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62669         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
62670         return tag_ptr(ret_ret, true);
62671 }
62672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62673         void* arg_ptr = untag_ptr(arg);
62674         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
62675         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
62676         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
62677         return ret_conv;
62678 }
62679
62680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62681         void* orig_ptr = untag_ptr(orig);
62682         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
62683         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
62684         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62685         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
62686         return tag_ptr(ret_ret, true);
62687 }
62688
62689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62690         if (!ptr_is_owned(this_ptr)) return;
62691         void* this_ptr_ptr = untag_ptr(this_ptr);
62692         CHECK_ACCESS(this_ptr_ptr);
62693         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
62694         FREE(untag_ptr(this_ptr));
62695         WriteableEcdsaChannelSigner_free(this_ptr_conv);
62696 }
62697
62698 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62699         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
62700         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
62701         return ret_conv;
62702 }
62703
62704 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
62705         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
62706         return ret_conv;
62707 }
62708
62709 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
62710         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
62711         return ret_conv;
62712 }
62713
62714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62715         if (!ptr_is_owned(this_ptr)) return;
62716         void* this_ptr_ptr = untag_ptr(this_ptr);
62717         CHECK_ACCESS(this_ptr_ptr);
62718         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
62719         FREE(untag_ptr(this_ptr));
62720         EntropySource_free(this_ptr_conv);
62721 }
62722
62723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62724         if (!ptr_is_owned(this_ptr)) return;
62725         void* this_ptr_ptr = untag_ptr(this_ptr);
62726         CHECK_ACCESS(this_ptr_ptr);
62727         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
62728         FREE(untag_ptr(this_ptr));
62729         NodeSigner_free(this_ptr_conv);
62730 }
62731
62732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62733         if (!ptr_is_owned(this_ptr)) return;
62734         void* this_ptr_ptr = untag_ptr(this_ptr);
62735         CHECK_ACCESS(this_ptr_ptr);
62736         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
62737         FREE(untag_ptr(this_ptr));
62738         SignerProvider_free(this_ptr_conv);
62739 }
62740
62741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62742         LDKInMemorySigner this_obj_conv;
62743         this_obj_conv.inner = untag_ptr(this_obj);
62744         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62746         InMemorySigner_free(this_obj_conv);
62747 }
62748
62749 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62750         LDKInMemorySigner this_ptr_conv;
62751         this_ptr_conv.inner = untag_ptr(this_ptr);
62752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62754         this_ptr_conv.is_owned = false;
62755         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62756         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
62757         return ret_arr;
62758 }
62759
62760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62761         LDKInMemorySigner this_ptr_conv;
62762         this_ptr_conv.inner = untag_ptr(this_ptr);
62763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62765         this_ptr_conv.is_owned = false;
62766         LDKSecretKey val_ref;
62767         CHECK((*env)->GetArrayLength(env, val) == 32);
62768         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62769         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
62770 }
62771
62772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62773         LDKInMemorySigner this_ptr_conv;
62774         this_ptr_conv.inner = untag_ptr(this_ptr);
62775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62777         this_ptr_conv.is_owned = false;
62778         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62779         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
62780         return ret_arr;
62781 }
62782
62783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62784         LDKInMemorySigner this_ptr_conv;
62785         this_ptr_conv.inner = untag_ptr(this_ptr);
62786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62788         this_ptr_conv.is_owned = false;
62789         LDKSecretKey val_ref;
62790         CHECK((*env)->GetArrayLength(env, val) == 32);
62791         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62792         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
62793 }
62794
62795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62796         LDKInMemorySigner this_ptr_conv;
62797         this_ptr_conv.inner = untag_ptr(this_ptr);
62798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62800         this_ptr_conv.is_owned = false;
62801         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62802         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
62803         return ret_arr;
62804 }
62805
62806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62807         LDKInMemorySigner this_ptr_conv;
62808         this_ptr_conv.inner = untag_ptr(this_ptr);
62809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62811         this_ptr_conv.is_owned = false;
62812         LDKSecretKey val_ref;
62813         CHECK((*env)->GetArrayLength(env, val) == 32);
62814         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62815         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
62816 }
62817
62818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62819         LDKInMemorySigner this_ptr_conv;
62820         this_ptr_conv.inner = untag_ptr(this_ptr);
62821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62823         this_ptr_conv.is_owned = false;
62824         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62825         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
62826         return ret_arr;
62827 }
62828
62829 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) {
62830         LDKInMemorySigner this_ptr_conv;
62831         this_ptr_conv.inner = untag_ptr(this_ptr);
62832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62834         this_ptr_conv.is_owned = false;
62835         LDKSecretKey val_ref;
62836         CHECK((*env)->GetArrayLength(env, val) == 32);
62837         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62838         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
62839 }
62840
62841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62842         LDKInMemorySigner this_ptr_conv;
62843         this_ptr_conv.inner = untag_ptr(this_ptr);
62844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62846         this_ptr_conv.is_owned = false;
62847         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62848         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
62849         return ret_arr;
62850 }
62851
62852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62853         LDKInMemorySigner this_ptr_conv;
62854         this_ptr_conv.inner = untag_ptr(this_ptr);
62855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62857         this_ptr_conv.is_owned = false;
62858         LDKSecretKey val_ref;
62859         CHECK((*env)->GetArrayLength(env, val) == 32);
62860         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62861         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
62862 }
62863
62864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
62865         LDKInMemorySigner this_ptr_conv;
62866         this_ptr_conv.inner = untag_ptr(this_ptr);
62867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62869         this_ptr_conv.is_owned = false;
62870         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62871         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
62872         return ret_arr;
62873 }
62874
62875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62876         LDKInMemorySigner this_ptr_conv;
62877         this_ptr_conv.inner = untag_ptr(this_ptr);
62878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62880         this_ptr_conv.is_owned = false;
62881         LDKThirtyTwoBytes val_ref;
62882         CHECK((*env)->GetArrayLength(env, val) == 32);
62883         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
62884         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
62885 }
62886
62887 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
62888         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
62889         int64_t ret_ref = 0;
62890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62892         return ret_ref;
62893 }
62894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62895         LDKInMemorySigner arg_conv;
62896         arg_conv.inner = untag_ptr(arg);
62897         arg_conv.is_owned = ptr_is_owned(arg);
62898         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62899         arg_conv.is_owned = false;
62900         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
62901         return ret_conv;
62902 }
62903
62904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62905         LDKInMemorySigner orig_conv;
62906         orig_conv.inner = untag_ptr(orig);
62907         orig_conv.is_owned = ptr_is_owned(orig);
62908         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62909         orig_conv.is_owned = false;
62910         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
62911         int64_t ret_ref = 0;
62912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62914         return ret_ref;
62915 }
62916
62917 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, int8_tArray rand_bytes_unique_start) {
62918         LDKSecretKey funding_key_ref;
62919         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
62920         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
62921         LDKSecretKey revocation_base_key_ref;
62922         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
62923         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
62924         LDKSecretKey payment_key_ref;
62925         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
62926         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
62927         LDKSecretKey delayed_payment_base_key_ref;
62928         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
62929         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
62930         LDKSecretKey htlc_base_key_ref;
62931         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
62932         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
62933         LDKThirtyTwoBytes commitment_seed_ref;
62934         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
62935         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
62936         LDKThirtyTwoBytes channel_keys_id_ref;
62937         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
62938         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
62939         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
62940         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
62941         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
62942         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, rand_bytes_unique_start_ref);
62943         int64_t ret_ref = 0;
62944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62946         return ret_ref;
62947 }
62948
62949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
62950         LDKInMemorySigner this_arg_conv;
62951         this_arg_conv.inner = untag_ptr(this_arg);
62952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62954         this_arg_conv.is_owned = false;
62955         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
62956         int64_t ret_ref = 0;
62957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62959         return ret_ref;
62960 }
62961
62962 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
62963         LDKInMemorySigner this_arg_conv;
62964         this_arg_conv.inner = untag_ptr(this_arg);
62965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62967         this_arg_conv.is_owned = false;
62968         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
62969         return ret_conv;
62970 }
62971
62972 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
62973         LDKInMemorySigner this_arg_conv;
62974         this_arg_conv.inner = untag_ptr(this_arg);
62975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62977         this_arg_conv.is_owned = false;
62978         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
62979         return ret_conv;
62980 }
62981
62982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
62983         LDKInMemorySigner this_arg_conv;
62984         this_arg_conv.inner = untag_ptr(this_arg);
62985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62987         this_arg_conv.is_owned = false;
62988         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
62989         return ret_conv;
62990 }
62991
62992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
62993         LDKInMemorySigner this_arg_conv;
62994         this_arg_conv.inner = untag_ptr(this_arg);
62995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62997         this_arg_conv.is_owned = false;
62998         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
62999         int64_t ret_ref = 0;
63000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63002         return ret_ref;
63003 }
63004
63005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
63006         LDKInMemorySigner this_arg_conv;
63007         this_arg_conv.inner = untag_ptr(this_arg);
63008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63010         this_arg_conv.is_owned = false;
63011         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
63012         int64_t ret_ref = 0;
63013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63015         return ret_ref;
63016 }
63017
63018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
63019         LDKInMemorySigner this_arg_conv;
63020         this_arg_conv.inner = untag_ptr(this_arg);
63021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63023         this_arg_conv.is_owned = false;
63024         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
63025         int64_t ret_ref = 0;
63026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63028         return ret_ref;
63029 }
63030
63031 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) {
63032         LDKInMemorySigner this_arg_conv;
63033         this_arg_conv.inner = untag_ptr(this_arg);
63034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63036         this_arg_conv.is_owned = false;
63037         LDKTransaction spend_tx_ref;
63038         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
63039         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
63040         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
63041         spend_tx_ref.data_is_owned = true;
63042         LDKStaticPaymentOutputDescriptor descriptor_conv;
63043         descriptor_conv.inner = untag_ptr(descriptor);
63044         descriptor_conv.is_owned = ptr_is_owned(descriptor);
63045         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
63046         descriptor_conv.is_owned = false;
63047         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
63048         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
63049         return tag_ptr(ret_conv, true);
63050 }
63051
63052 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) {
63053         LDKInMemorySigner this_arg_conv;
63054         this_arg_conv.inner = untag_ptr(this_arg);
63055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63057         this_arg_conv.is_owned = false;
63058         LDKTransaction spend_tx_ref;
63059         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
63060         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
63061         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
63062         spend_tx_ref.data_is_owned = true;
63063         LDKDelayedPaymentOutputDescriptor descriptor_conv;
63064         descriptor_conv.inner = untag_ptr(descriptor);
63065         descriptor_conv.is_owned = ptr_is_owned(descriptor);
63066         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
63067         descriptor_conv.is_owned = false;
63068         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
63069         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
63070         return tag_ptr(ret_conv, true);
63071 }
63072
63073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
63074         LDKInMemorySigner this_arg_conv;
63075         this_arg_conv.inner = untag_ptr(this_arg);
63076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63078         this_arg_conv.is_owned = false;
63079         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63080         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
63081         return tag_ptr(ret_ret, true);
63082 }
63083
63084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63085         LDKInMemorySigner this_arg_conv;
63086         this_arg_conv.inner = untag_ptr(this_arg);
63087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63089         this_arg_conv.is_owned = false;
63090         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
63091         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
63092         return tag_ptr(ret_ret, true);
63093 }
63094
63095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63096         LDKInMemorySigner this_arg_conv;
63097         this_arg_conv.inner = untag_ptr(this_arg);
63098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63100         this_arg_conv.is_owned = false;
63101         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
63102         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
63103         return tag_ptr(ret_ret, true);
63104 }
63105
63106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63107         LDKInMemorySigner this_arg_conv;
63108         this_arg_conv.inner = untag_ptr(this_arg);
63109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63111         this_arg_conv.is_owned = false;
63112         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
63113         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
63114         return tag_ptr(ret_ret, true);
63115 }
63116
63117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
63118         LDKInMemorySigner obj_conv;
63119         obj_conv.inner = untag_ptr(obj);
63120         obj_conv.is_owned = ptr_is_owned(obj);
63121         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63122         obj_conv.is_owned = false;
63123         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
63124         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63125         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63126         CVec_u8Z_free(ret_var);
63127         return ret_arr;
63128 }
63129
63130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
63131         LDKu8slice ser_ref;
63132         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63133         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63134         void* arg_ptr = untag_ptr(arg);
63135         CHECK_ACCESS(arg_ptr);
63136         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
63137         if (arg_conv.free == LDKEntropySource_JCalls_free) {
63138                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63139                 LDKEntropySource_JCalls_cloned(&arg_conv);
63140         }
63141         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
63142         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
63143         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63144         return tag_ptr(ret_conv, true);
63145 }
63146
63147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63148         LDKKeysManager this_obj_conv;
63149         this_obj_conv.inner = untag_ptr(this_obj);
63150         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63152         KeysManager_free(this_obj_conv);
63153 }
63154
63155 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) {
63156         uint8_t seed_arr[32];
63157         CHECK((*env)->GetArrayLength(env, seed) == 32);
63158         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
63159         uint8_t (*seed_ref)[32] = &seed_arr;
63160         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
63161         int64_t ret_ref = 0;
63162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63164         return ret_ref;
63165 }
63166
63167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
63168         LDKKeysManager this_arg_conv;
63169         this_arg_conv.inner = untag_ptr(this_arg);
63170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63172         this_arg_conv.is_owned = false;
63173         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63174         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
63175         return ret_arr;
63176 }
63177
63178 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) {
63179         LDKKeysManager this_arg_conv;
63180         this_arg_conv.inner = untag_ptr(this_arg);
63181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63183         this_arg_conv.is_owned = false;
63184         uint8_t params_arr[32];
63185         CHECK((*env)->GetArrayLength(env, params) == 32);
63186         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
63187         uint8_t (*params_ref)[32] = &params_arr;
63188         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
63189         int64_t ret_ref = 0;
63190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63192         return ret_ref;
63193 }
63194
63195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1sign_1spendable_1outputs_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int8_tArray psbt) {
63196         LDKKeysManager this_arg_conv;
63197         this_arg_conv.inner = untag_ptr(this_arg);
63198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63200         this_arg_conv.is_owned = false;
63201         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63202         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
63203         if (descriptors_constr.datalen > 0)
63204                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63205         else
63206                 descriptors_constr.data = NULL;
63207         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
63208         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63209                 int64_t descriptors_conv_27 = descriptors_vals[b];
63210                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63211                 CHECK_ACCESS(descriptors_conv_27_ptr);
63212                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63213                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63214                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63215         }
63216         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
63217         LDKCVec_u8Z psbt_ref;
63218         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
63219         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
63220         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
63221         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
63222         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
63223         return tag_ptr(ret_conv, true);
63224 }
63225
63226 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, int64_t locktime) {
63227         LDKKeysManager this_arg_conv;
63228         this_arg_conv.inner = untag_ptr(this_arg);
63229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63231         this_arg_conv.is_owned = false;
63232         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63233         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
63234         if (descriptors_constr.datalen > 0)
63235                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63236         else
63237                 descriptors_constr.data = NULL;
63238         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
63239         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63240                 int64_t descriptors_conv_27 = descriptors_vals[b];
63241                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63242                 CHECK_ACCESS(descriptors_conv_27_ptr);
63243                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63244                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63245                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63246         }
63247         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
63248         LDKCVec_TxOutZ outputs_constr;
63249         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
63250         if (outputs_constr.datalen > 0)
63251                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
63252         else
63253                 outputs_constr.data = NULL;
63254         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
63255         for (size_t h = 0; h < outputs_constr.datalen; h++) {
63256                 int64_t outputs_conv_7 = outputs_vals[h];
63257                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
63258                 CHECK_ACCESS(outputs_conv_7_ptr);
63259                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
63260                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
63261                 outputs_constr.data[h] = outputs_conv_7_conv;
63262         }
63263         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
63264         LDKCVec_u8Z change_destination_script_ref;
63265         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
63266         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
63267         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
63268         void* locktime_ptr = untag_ptr(locktime);
63269         CHECK_ACCESS(locktime_ptr);
63270         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
63271         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
63272         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
63273         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
63274         return tag_ptr(ret_conv, true);
63275 }
63276
63277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
63278         LDKKeysManager this_arg_conv;
63279         this_arg_conv.inner = untag_ptr(this_arg);
63280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63282         this_arg_conv.is_owned = false;
63283         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63284         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
63285         return tag_ptr(ret_ret, true);
63286 }
63287
63288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63289         LDKKeysManager this_arg_conv;
63290         this_arg_conv.inner = untag_ptr(this_arg);
63291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63293         this_arg_conv.is_owned = false;
63294         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
63295         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
63296         return tag_ptr(ret_ret, true);
63297 }
63298
63299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
63300         LDKKeysManager this_arg_conv;
63301         this_arg_conv.inner = untag_ptr(this_arg);
63302         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63304         this_arg_conv.is_owned = false;
63305         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
63306         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
63307         return tag_ptr(ret_ret, true);
63308 }
63309
63310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63311         LDKPhantomKeysManager this_obj_conv;
63312         this_obj_conv.inner = untag_ptr(this_obj);
63313         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63315         PhantomKeysManager_free(this_obj_conv);
63316 }
63317
63318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
63319         LDKPhantomKeysManager this_arg_conv;
63320         this_arg_conv.inner = untag_ptr(this_arg);
63321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63323         this_arg_conv.is_owned = false;
63324         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63325         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
63326         return tag_ptr(ret_ret, true);
63327 }
63328
63329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63330         LDKPhantomKeysManager this_arg_conv;
63331         this_arg_conv.inner = untag_ptr(this_arg);
63332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63334         this_arg_conv.is_owned = false;
63335         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
63336         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
63337         return tag_ptr(ret_ret, true);
63338 }
63339
63340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
63341         LDKPhantomKeysManager this_arg_conv;
63342         this_arg_conv.inner = untag_ptr(this_arg);
63343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63345         this_arg_conv.is_owned = false;
63346         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
63347         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
63348         return tag_ptr(ret_ret, true);
63349 }
63350
63351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
63352         uint8_t seed_arr[32];
63353         CHECK((*env)->GetArrayLength(env, seed) == 32);
63354         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
63355         uint8_t (*seed_ref)[32] = &seed_arr;
63356         uint8_t cross_node_seed_arr[32];
63357         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
63358         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
63359         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
63360         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
63361         int64_t ret_ref = 0;
63362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63364         return ret_ref;
63365 }
63366
63367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
63368         LDKPhantomKeysManager this_arg_conv;
63369         this_arg_conv.inner = untag_ptr(this_arg);
63370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63372         this_arg_conv.is_owned = false;
63373         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63374         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
63375         if (descriptors_constr.datalen > 0)
63376                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63377         else
63378                 descriptors_constr.data = NULL;
63379         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
63380         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63381                 int64_t descriptors_conv_27 = descriptors_vals[b];
63382                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63383                 CHECK_ACCESS(descriptors_conv_27_ptr);
63384                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63385                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63386                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63387         }
63388         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
63389         LDKCVec_TxOutZ outputs_constr;
63390         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
63391         if (outputs_constr.datalen > 0)
63392                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
63393         else
63394                 outputs_constr.data = NULL;
63395         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
63396         for (size_t h = 0; h < outputs_constr.datalen; h++) {
63397                 int64_t outputs_conv_7 = outputs_vals[h];
63398                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
63399                 CHECK_ACCESS(outputs_conv_7_ptr);
63400                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
63401                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
63402                 outputs_constr.data[h] = outputs_conv_7_conv;
63403         }
63404         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
63405         LDKCVec_u8Z change_destination_script_ref;
63406         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
63407         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
63408         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
63409         void* locktime_ptr = untag_ptr(locktime);
63410         CHECK_ACCESS(locktime_ptr);
63411         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
63412         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
63413         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
63414         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
63415         return tag_ptr(ret_conv, true);
63416 }
63417
63418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
63419         LDKPhantomKeysManager this_arg_conv;
63420         this_arg_conv.inner = untag_ptr(this_arg);
63421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63423         this_arg_conv.is_owned = false;
63424         uint8_t params_arr[32];
63425         CHECK((*env)->GetArrayLength(env, params) == 32);
63426         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
63427         uint8_t (*params_ref)[32] = &params_arr;
63428         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
63429         int64_t ret_ref = 0;
63430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63432         return ret_ref;
63433 }
63434
63435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
63436         LDKPhantomKeysManager this_arg_conv;
63437         this_arg_conv.inner = untag_ptr(this_arg);
63438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63440         this_arg_conv.is_owned = false;
63441         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63442         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
63443         return ret_arr;
63444 }
63445
63446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
63447         LDKPhantomKeysManager this_arg_conv;
63448         this_arg_conv.inner = untag_ptr(this_arg);
63449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63451         this_arg_conv.is_owned = false;
63452         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63453         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
63454         return ret_arr;
63455 }
63456
63457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63458         LDKOnionMessenger this_obj_conv;
63459         this_obj_conv.inner = untag_ptr(this_obj);
63460         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63462         OnionMessenger_free(this_obj_conv);
63463 }
63464
63465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63466         if (!ptr_is_owned(this_ptr)) return;
63467         void* this_ptr_ptr = untag_ptr(this_ptr);
63468         CHECK_ACCESS(this_ptr_ptr);
63469         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
63470         FREE(untag_ptr(this_ptr));
63471         MessageRouter_free(this_ptr_conv);
63472 }
63473
63474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63475         LDKDefaultMessageRouter this_obj_conv;
63476         this_obj_conv.inner = untag_ptr(this_obj);
63477         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63479         DefaultMessageRouter_free(this_obj_conv);
63480 }
63481
63482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz) {
63483         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
63484         int64_t ret_ref = 0;
63485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63487         return ret_ref;
63488 }
63489
63490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
63491         LDKDefaultMessageRouter this_arg_conv;
63492         this_arg_conv.inner = untag_ptr(this_arg);
63493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63495         this_arg_conv.is_owned = false;
63496         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
63497         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
63498         return tag_ptr(ret_ret, true);
63499 }
63500
63501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63502         LDKOnionMessagePath this_obj_conv;
63503         this_obj_conv.inner = untag_ptr(this_obj);
63504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63506         OnionMessagePath_free(this_obj_conv);
63507 }
63508
63509 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
63510         LDKOnionMessagePath this_ptr_conv;
63511         this_ptr_conv.inner = untag_ptr(this_ptr);
63512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63514         this_ptr_conv.is_owned = false;
63515         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
63516         jobjectArray ret_arr = NULL;
63517         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
63518         ;
63519         for (size_t i = 0; i < ret_var.datalen; i++) {
63520                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
63521                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
63522                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
63523         }
63524         
63525         FREE(ret_var.data);
63526         return ret_arr;
63527 }
63528
63529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
63530         LDKOnionMessagePath this_ptr_conv;
63531         this_ptr_conv.inner = untag_ptr(this_ptr);
63532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63534         this_ptr_conv.is_owned = false;
63535         LDKCVec_PublicKeyZ val_constr;
63536         val_constr.datalen = (*env)->GetArrayLength(env, val);
63537         if (val_constr.datalen > 0)
63538                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63539         else
63540                 val_constr.data = NULL;
63541         for (size_t i = 0; i < val_constr.datalen; i++) {
63542                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
63543                 LDKPublicKey val_conv_8_ref;
63544                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
63545                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
63546                 val_constr.data[i] = val_conv_8_ref;
63547         }
63548         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
63549 }
63550
63551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
63552         LDKOnionMessagePath this_ptr_conv;
63553         this_ptr_conv.inner = untag_ptr(this_ptr);
63554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63556         this_ptr_conv.is_owned = false;
63557         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63558         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
63559         int64_t ret_ref = tag_ptr(ret_copy, true);
63560         return ret_ref;
63561 }
63562
63563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63564         LDKOnionMessagePath this_ptr_conv;
63565         this_ptr_conv.inner = untag_ptr(this_ptr);
63566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63568         this_ptr_conv.is_owned = false;
63569         void* val_ptr = untag_ptr(val);
63570         CHECK_ACCESS(val_ptr);
63571         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
63572         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
63573         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
63574 }
63575
63576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1new(JNIEnv *env, jclass clz, jobjectArray intermediate_nodes_arg, int64_t destination_arg) {
63577         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
63578         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
63579         if (intermediate_nodes_arg_constr.datalen > 0)
63580                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63581         else
63582                 intermediate_nodes_arg_constr.data = NULL;
63583         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
63584                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
63585                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
63586                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
63587                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
63588                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
63589         }
63590         void* destination_arg_ptr = untag_ptr(destination_arg);
63591         CHECK_ACCESS(destination_arg_ptr);
63592         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
63593         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
63594         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
63595         int64_t ret_ref = 0;
63596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63598         return ret_ref;
63599 }
63600
63601 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
63602         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
63603         int64_t ret_ref = 0;
63604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63606         return ret_ref;
63607 }
63608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63609         LDKOnionMessagePath arg_conv;
63610         arg_conv.inner = untag_ptr(arg);
63611         arg_conv.is_owned = ptr_is_owned(arg);
63612         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63613         arg_conv.is_owned = false;
63614         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
63615         return ret_conv;
63616 }
63617
63618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63619         LDKOnionMessagePath orig_conv;
63620         orig_conv.inner = untag_ptr(orig);
63621         orig_conv.is_owned = ptr_is_owned(orig);
63622         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63623         orig_conv.is_owned = false;
63624         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
63625         int64_t ret_ref = 0;
63626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63628         return ret_ref;
63629 }
63630
63631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63632         if (!ptr_is_owned(this_ptr)) return;
63633         void* this_ptr_ptr = untag_ptr(this_ptr);
63634         CHECK_ACCESS(this_ptr_ptr);
63635         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
63636         FREE(untag_ptr(this_ptr));
63637         Destination_free(this_ptr_conv);
63638 }
63639
63640 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
63641         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63642         *ret_copy = Destination_clone(arg);
63643         int64_t ret_ref = tag_ptr(ret_copy, true);
63644         return ret_ref;
63645 }
63646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63647         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
63648         int64_t ret_conv = Destination_clone_ptr(arg_conv);
63649         return ret_conv;
63650 }
63651
63652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63653         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
63654         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63655         *ret_copy = Destination_clone(orig_conv);
63656         int64_t ret_ref = tag_ptr(ret_copy, true);
63657         return ret_ref;
63658 }
63659
63660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
63661         LDKPublicKey a_ref;
63662         CHECK((*env)->GetArrayLength(env, a) == 33);
63663         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
63664         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63665         *ret_copy = Destination_node(a_ref);
63666         int64_t ret_ref = tag_ptr(ret_copy, true);
63667         return ret_ref;
63668 }
63669
63670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
63671         LDKBlindedPath a_conv;
63672         a_conv.inner = untag_ptr(a);
63673         a_conv.is_owned = ptr_is_owned(a);
63674         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63675         a_conv = BlindedPath_clone(&a_conv);
63676         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63677         *ret_copy = Destination_blinded_path(a_conv);
63678         int64_t ret_ref = tag_ptr(ret_copy, true);
63679         return ret_ref;
63680 }
63681
63682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63683         if (!ptr_is_owned(this_ptr)) return;
63684         void* this_ptr_ptr = untag_ptr(this_ptr);
63685         CHECK_ACCESS(this_ptr_ptr);
63686         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
63687         FREE(untag_ptr(this_ptr));
63688         SendError_free(this_ptr_conv);
63689 }
63690
63691 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
63692         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63693         *ret_copy = SendError_clone(arg);
63694         int64_t ret_ref = tag_ptr(ret_copy, true);
63695         return ret_ref;
63696 }
63697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63698         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
63699         int64_t ret_conv = SendError_clone_ptr(arg_conv);
63700         return ret_conv;
63701 }
63702
63703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63704         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
63705         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63706         *ret_copy = SendError_clone(orig_conv);
63707         int64_t ret_ref = tag_ptr(ret_copy, true);
63708         return ret_ref;
63709 }
63710
63711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
63712         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
63713         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63714         *ret_copy = SendError_secp256k1(a_conv);
63715         int64_t ret_ref = tag_ptr(ret_copy, true);
63716         return ret_ref;
63717 }
63718
63719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
63720         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63721         *ret_copy = SendError_too_big_packet();
63722         int64_t ret_ref = tag_ptr(ret_copy, true);
63723         return ret_ref;
63724 }
63725
63726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
63727         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63728         *ret_copy = SendError_too_few_blinded_hops();
63729         int64_t ret_ref = tag_ptr(ret_copy, true);
63730         return ret_ref;
63731 }
63732
63733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz) {
63734         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63735         *ret_copy = SendError_invalid_first_hop();
63736         int64_t ret_ref = tag_ptr(ret_copy, true);
63737         return ret_ref;
63738 }
63739
63740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
63741         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63742         *ret_copy = SendError_invalid_message();
63743         int64_t ret_ref = tag_ptr(ret_copy, true);
63744         return ret_ref;
63745 }
63746
63747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
63748         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63749         *ret_copy = SendError_buffer_full();
63750         int64_t ret_ref = tag_ptr(ret_copy, true);
63751         return ret_ref;
63752 }
63753
63754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
63755         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63756         *ret_copy = SendError_get_node_id_failed();
63757         int64_t ret_ref = tag_ptr(ret_copy, true);
63758         return ret_ref;
63759 }
63760
63761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
63762         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63763         *ret_copy = SendError_blinded_path_advance_failed();
63764         int64_t ret_ref = tag_ptr(ret_copy, true);
63765         return ret_ref;
63766 }
63767
63768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63769         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
63770         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
63771         jboolean ret_conv = SendError_eq(a_conv, b_conv);
63772         return ret_conv;
63773 }
63774
63775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63776         if (!ptr_is_owned(this_ptr)) return;
63777         void* this_ptr_ptr = untag_ptr(this_ptr);
63778         CHECK_ACCESS(this_ptr_ptr);
63779         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
63780         FREE(untag_ptr(this_ptr));
63781         CustomOnionMessageHandler_free(this_ptr_conv);
63782 }
63783
63784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
63785         void* entropy_source_ptr = untag_ptr(entropy_source);
63786         CHECK_ACCESS(entropy_source_ptr);
63787         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63788         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63789                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63790                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63791         }
63792         void* node_signer_ptr = untag_ptr(node_signer);
63793         CHECK_ACCESS(node_signer_ptr);
63794         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
63795         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
63796                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63797                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
63798         }
63799         void* logger_ptr = untag_ptr(logger);
63800         CHECK_ACCESS(logger_ptr);
63801         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63802         if (logger_conv.free == LDKLogger_JCalls_free) {
63803                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63804                 LDKLogger_JCalls_cloned(&logger_conv);
63805         }
63806         void* message_router_ptr = untag_ptr(message_router);
63807         CHECK_ACCESS(message_router_ptr);
63808         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
63809         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
63810                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63811                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
63812         }
63813         void* offers_handler_ptr = untag_ptr(offers_handler);
63814         CHECK_ACCESS(offers_handler_ptr);
63815         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
63816         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
63817                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63818                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
63819         }
63820         void* custom_handler_ptr = untag_ptr(custom_handler);
63821         CHECK_ACCESS(custom_handler_ptr);
63822         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
63823         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
63824                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63825                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
63826         }
63827         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
63828         int64_t ret_ref = 0;
63829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63831         return ret_ref;
63832 }
63833
63834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t message, int64_t reply_path) {
63835         LDKOnionMessenger this_arg_conv;
63836         this_arg_conv.inner = untag_ptr(this_arg);
63837         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63839         this_arg_conv.is_owned = false;
63840         LDKOnionMessagePath path_conv;
63841         path_conv.inner = untag_ptr(path);
63842         path_conv.is_owned = ptr_is_owned(path);
63843         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63844         path_conv = OnionMessagePath_clone(&path_conv);
63845         void* message_ptr = untag_ptr(message);
63846         CHECK_ACCESS(message_ptr);
63847         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
63848         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
63849         LDKBlindedPath reply_path_conv;
63850         reply_path_conv.inner = untag_ptr(reply_path);
63851         reply_path_conv.is_owned = ptr_is_owned(reply_path);
63852         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
63853         reply_path_conv = BlindedPath_clone(&reply_path_conv);
63854         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
63855         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, message_conv, reply_path_conv);
63856         return tag_ptr(ret_conv, true);
63857 }
63858
63859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
63860         LDKOnionMessenger this_arg_conv;
63861         this_arg_conv.inner = untag_ptr(this_arg);
63862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63864         this_arg_conv.is_owned = false;
63865         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
63866         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
63867         return tag_ptr(ret_ret, true);
63868 }
63869
63870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
63871         LDKOnionMessenger this_arg_conv;
63872         this_arg_conv.inner = untag_ptr(this_arg);
63873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63875         this_arg_conv.is_owned = false;
63876         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
63877         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
63878         return tag_ptr(ret_ret, true);
63879 }
63880
63881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63882         if (!ptr_is_owned(this_ptr)) return;
63883         void* this_ptr_ptr = untag_ptr(this_ptr);
63884         CHECK_ACCESS(this_ptr_ptr);
63885         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
63886         FREE(untag_ptr(this_ptr));
63887         OffersMessageHandler_free(this_ptr_conv);
63888 }
63889
63890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63891         if (!ptr_is_owned(this_ptr)) return;
63892         void* this_ptr_ptr = untag_ptr(this_ptr);
63893         CHECK_ACCESS(this_ptr_ptr);
63894         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
63895         FREE(untag_ptr(this_ptr));
63896         OffersMessage_free(this_ptr_conv);
63897 }
63898
63899 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
63900         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63901         *ret_copy = OffersMessage_clone(arg);
63902         int64_t ret_ref = tag_ptr(ret_copy, true);
63903         return ret_ref;
63904 }
63905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63906         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
63907         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
63908         return ret_conv;
63909 }
63910
63911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63912         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
63913         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63914         *ret_copy = OffersMessage_clone(orig_conv);
63915         int64_t ret_ref = tag_ptr(ret_copy, true);
63916         return ret_ref;
63917 }
63918
63919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
63920         LDKInvoiceRequest a_conv;
63921         a_conv.inner = untag_ptr(a);
63922         a_conv.is_owned = ptr_is_owned(a);
63923         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63924         a_conv = InvoiceRequest_clone(&a_conv);
63925         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63926         *ret_copy = OffersMessage_invoice_request(a_conv);
63927         int64_t ret_ref = tag_ptr(ret_copy, true);
63928         return ret_ref;
63929 }
63930
63931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
63932         LDKBolt12Invoice a_conv;
63933         a_conv.inner = untag_ptr(a);
63934         a_conv.is_owned = ptr_is_owned(a);
63935         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63936         a_conv = Bolt12Invoice_clone(&a_conv);
63937         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63938         *ret_copy = OffersMessage_invoice(a_conv);
63939         int64_t ret_ref = tag_ptr(ret_copy, true);
63940         return ret_ref;
63941 }
63942
63943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
63944         LDKInvoiceError a_conv;
63945         a_conv.inner = untag_ptr(a);
63946         a_conv.is_owned = ptr_is_owned(a);
63947         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63948         a_conv = InvoiceError_clone(&a_conv);
63949         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63950         *ret_copy = OffersMessage_invoice_error(a_conv);
63951         int64_t ret_ref = tag_ptr(ret_copy, true);
63952         return ret_ref;
63953 }
63954
63955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
63956         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
63957         return ret_conv;
63958 }
63959
63960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63961         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
63962         int64_t ret_conv = OffersMessage_tlv_type(this_arg_conv);
63963         return ret_conv;
63964 }
63965
63966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
63967         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
63968         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
63969         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63970         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63971         CVec_u8Z_free(ret_var);
63972         return ret_arr;
63973 }
63974
63975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) {
63976         LDKu8slice ser_ref;
63977         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63978         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63979         void* arg_b_ptr = untag_ptr(arg_b);
63980         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
63981         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
63982         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
63983         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
63984         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63985         return tag_ptr(ret_conv, true);
63986 }
63987
63988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63989         if (!ptr_is_owned(this_ptr)) return;
63990         void* this_ptr_ptr = untag_ptr(this_ptr);
63991         CHECK_ACCESS(this_ptr_ptr);
63992         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
63993         FREE(untag_ptr(this_ptr));
63994         OnionMessageContents_free(this_ptr_conv);
63995 }
63996
63997 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
63998         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63999         *ret_copy = OnionMessageContents_clone(arg);
64000         int64_t ret_ref = tag_ptr(ret_copy, true);
64001         return ret_ref;
64002 }
64003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64004         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
64005         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
64006         return ret_conv;
64007 }
64008
64009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64010         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
64011         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64012         *ret_copy = OnionMessageContents_clone(orig_conv);
64013         int64_t ret_ref = tag_ptr(ret_copy, true);
64014         return ret_ref;
64015 }
64016
64017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
64018         void* a_ptr = untag_ptr(a);
64019         CHECK_ACCESS(a_ptr);
64020         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
64021         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
64022         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64023         *ret_copy = OnionMessageContents_offers(a_conv);
64024         int64_t ret_ref = tag_ptr(ret_copy, true);
64025         return ret_ref;
64026 }
64027
64028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
64029         void* a_ptr = untag_ptr(a);
64030         CHECK_ACCESS(a_ptr);
64031         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
64032         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
64033                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64034                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
64035         }
64036         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64037         *ret_copy = OnionMessageContents_custom(a_conv);
64038         int64_t ret_ref = tag_ptr(ret_copy, true);
64039         return ret_ref;
64040 }
64041
64042 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
64043         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
64044         *ret_ret = CustomOnionMessageContents_clone(arg);
64045         return tag_ptr(ret_ret, true);
64046 }
64047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64048         void* arg_ptr = untag_ptr(arg);
64049         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
64050         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
64051         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
64052         return ret_conv;
64053 }
64054
64055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64056         void* orig_ptr = untag_ptr(orig);
64057         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
64058         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
64059         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
64060         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
64061         return tag_ptr(ret_ret, true);
64062 }
64063
64064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64065         if (!ptr_is_owned(this_ptr)) return;
64066         void* this_ptr_ptr = untag_ptr(this_ptr);
64067         CHECK_ACCESS(this_ptr_ptr);
64068         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
64069         FREE(untag_ptr(this_ptr));
64070         CustomOnionMessageContents_free(this_ptr_conv);
64071 }
64072
64073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64074         LDKBlindedPath this_obj_conv;
64075         this_obj_conv.inner = untag_ptr(this_obj);
64076         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64078         BlindedPath_free(this_obj_conv);
64079 }
64080
64081 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
64082         LDKBlindedPath ret_var = BlindedPath_clone(arg);
64083         int64_t ret_ref = 0;
64084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64086         return ret_ref;
64087 }
64088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64089         LDKBlindedPath arg_conv;
64090         arg_conv.inner = untag_ptr(arg);
64091         arg_conv.is_owned = ptr_is_owned(arg);
64092         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64093         arg_conv.is_owned = false;
64094         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
64095         return ret_conv;
64096 }
64097
64098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64099         LDKBlindedPath orig_conv;
64100         orig_conv.inner = untag_ptr(orig);
64101         orig_conv.is_owned = ptr_is_owned(orig);
64102         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64103         orig_conv.is_owned = false;
64104         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
64105         int64_t ret_ref = 0;
64106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64108         return ret_ref;
64109 }
64110
64111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
64112         LDKBlindedPath o_conv;
64113         o_conv.inner = untag_ptr(o);
64114         o_conv.is_owned = ptr_is_owned(o);
64115         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64116         o_conv.is_owned = false;
64117         int64_t ret_conv = BlindedPath_hash(&o_conv);
64118         return ret_conv;
64119 }
64120
64121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64122         LDKBlindedPath a_conv;
64123         a_conv.inner = untag_ptr(a);
64124         a_conv.is_owned = ptr_is_owned(a);
64125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64126         a_conv.is_owned = false;
64127         LDKBlindedPath b_conv;
64128         b_conv.inner = untag_ptr(b);
64129         b_conv.is_owned = ptr_is_owned(b);
64130         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64131         b_conv.is_owned = false;
64132         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
64133         return ret_conv;
64134 }
64135
64136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64137         LDKBlindedHop this_obj_conv;
64138         this_obj_conv.inner = untag_ptr(this_obj);
64139         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64141         BlindedHop_free(this_obj_conv);
64142 }
64143
64144 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
64145         LDKBlindedHop ret_var = BlindedHop_clone(arg);
64146         int64_t ret_ref = 0;
64147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64149         return ret_ref;
64150 }
64151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64152         LDKBlindedHop arg_conv;
64153         arg_conv.inner = untag_ptr(arg);
64154         arg_conv.is_owned = ptr_is_owned(arg);
64155         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64156         arg_conv.is_owned = false;
64157         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
64158         return ret_conv;
64159 }
64160
64161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64162         LDKBlindedHop orig_conv;
64163         orig_conv.inner = untag_ptr(orig);
64164         orig_conv.is_owned = ptr_is_owned(orig);
64165         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64166         orig_conv.is_owned = false;
64167         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
64168         int64_t ret_ref = 0;
64169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64171         return ret_ref;
64172 }
64173
64174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
64175         LDKBlindedHop o_conv;
64176         o_conv.inner = untag_ptr(o);
64177         o_conv.is_owned = ptr_is_owned(o);
64178         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64179         o_conv.is_owned = false;
64180         int64_t ret_conv = BlindedHop_hash(&o_conv);
64181         return ret_conv;
64182 }
64183
64184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64185         LDKBlindedHop a_conv;
64186         a_conv.inner = untag_ptr(a);
64187         a_conv.is_owned = ptr_is_owned(a);
64188         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64189         a_conv.is_owned = false;
64190         LDKBlindedHop b_conv;
64191         b_conv.inner = untag_ptr(b);
64192         b_conv.is_owned = ptr_is_owned(b);
64193         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64194         b_conv.is_owned = false;
64195         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
64196         return ret_conv;
64197 }
64198
64199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
64200         LDKCVec_PublicKeyZ node_pks_constr;
64201         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
64202         if (node_pks_constr.datalen > 0)
64203                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
64204         else
64205                 node_pks_constr.data = NULL;
64206         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
64207                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
64208                 LDKPublicKey node_pks_conv_8_ref;
64209                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
64210                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
64211                 node_pks_constr.data[i] = node_pks_conv_8_ref;
64212         }
64213         void* entropy_source_ptr = untag_ptr(entropy_source);
64214         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64215         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64216         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
64217         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
64218         return tag_ptr(ret_conv, true);
64219 }
64220
64221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
64222         LDKBlindedPath obj_conv;
64223         obj_conv.inner = untag_ptr(obj);
64224         obj_conv.is_owned = ptr_is_owned(obj);
64225         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64226         obj_conv.is_owned = false;
64227         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
64228         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64229         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64230         CVec_u8Z_free(ret_var);
64231         return ret_arr;
64232 }
64233
64234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64235         LDKu8slice ser_ref;
64236         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64237         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64238         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
64239         *ret_conv = BlindedPath_read(ser_ref);
64240         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64241         return tag_ptr(ret_conv, true);
64242 }
64243
64244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
64245         LDKBlindedHop obj_conv;
64246         obj_conv.inner = untag_ptr(obj);
64247         obj_conv.is_owned = ptr_is_owned(obj);
64248         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64249         obj_conv.is_owned = false;
64250         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
64251         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64252         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64253         CVec_u8Z_free(ret_var);
64254         return ret_arr;
64255 }
64256
64257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64258         LDKu8slice ser_ref;
64259         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64260         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64261         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
64262         *ret_conv = BlindedHop_read(ser_ref);
64263         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64264         return tag_ptr(ret_conv, true);
64265 }
64266
64267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64268         if (!ptr_is_owned(this_ptr)) return;
64269         void* this_ptr_ptr = untag_ptr(this_ptr);
64270         CHECK_ACCESS(this_ptr_ptr);
64271         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
64272         FREE(untag_ptr(this_ptr));
64273         PaymentPurpose_free(this_ptr_conv);
64274 }
64275
64276 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
64277         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64278         *ret_copy = PaymentPurpose_clone(arg);
64279         int64_t ret_ref = tag_ptr(ret_copy, true);
64280         return ret_ref;
64281 }
64282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64283         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
64284         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
64285         return ret_conv;
64286 }
64287
64288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64289         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
64290         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64291         *ret_copy = PaymentPurpose_clone(orig_conv);
64292         int64_t ret_ref = tag_ptr(ret_copy, true);
64293         return ret_ref;
64294 }
64295
64296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
64297         void* payment_preimage_ptr = untag_ptr(payment_preimage);
64298         CHECK_ACCESS(payment_preimage_ptr);
64299         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
64300         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
64301         LDKThirtyTwoBytes payment_secret_ref;
64302         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
64303         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
64304         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64305         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
64306         int64_t ret_ref = tag_ptr(ret_copy, true);
64307         return ret_ref;
64308 }
64309
64310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
64311         LDKThirtyTwoBytes a_ref;
64312         CHECK((*env)->GetArrayLength(env, a) == 32);
64313         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
64314         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64315         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
64316         int64_t ret_ref = tag_ptr(ret_copy, true);
64317         return ret_ref;
64318 }
64319
64320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64321         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
64322         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
64323         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
64324         return ret_conv;
64325 }
64326
64327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
64328         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
64329         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
64330         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64331         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64332         CVec_u8Z_free(ret_var);
64333         return ret_arr;
64334 }
64335
64336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64337         LDKu8slice ser_ref;
64338         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64339         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64340         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
64341         *ret_conv = PaymentPurpose_read(ser_ref);
64342         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64343         return tag_ptr(ret_conv, true);
64344 }
64345
64346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64347         if (!ptr_is_owned(this_ptr)) return;
64348         void* this_ptr_ptr = untag_ptr(this_ptr);
64349         CHECK_ACCESS(this_ptr_ptr);
64350         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
64351         FREE(untag_ptr(this_ptr));
64352         PathFailure_free(this_ptr_conv);
64353 }
64354
64355 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
64356         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64357         *ret_copy = PathFailure_clone(arg);
64358         int64_t ret_ref = tag_ptr(ret_copy, true);
64359         return ret_ref;
64360 }
64361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64362         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
64363         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
64364         return ret_conv;
64365 }
64366
64367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64368         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
64369         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64370         *ret_copy = PathFailure_clone(orig_conv);
64371         int64_t ret_ref = tag_ptr(ret_copy, true);
64372         return ret_ref;
64373 }
64374
64375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
64376         void* err_ptr = untag_ptr(err);
64377         CHECK_ACCESS(err_ptr);
64378         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
64379         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
64380         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64381         *ret_copy = PathFailure_initial_send(err_conv);
64382         int64_t ret_ref = tag_ptr(ret_copy, true);
64383         return ret_ref;
64384 }
64385
64386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
64387         void* network_update_ptr = untag_ptr(network_update);
64388         CHECK_ACCESS(network_update_ptr);
64389         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
64390         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
64391         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64392         *ret_copy = PathFailure_on_path(network_update_conv);
64393         int64_t ret_ref = tag_ptr(ret_copy, true);
64394         return ret_ref;
64395 }
64396
64397 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64398         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
64399         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
64400         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
64401         return ret_conv;
64402 }
64403
64404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
64405         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
64406         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
64407         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64408         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64409         CVec_u8Z_free(ret_var);
64410         return ret_arr;
64411 }
64412
64413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64414         LDKu8slice ser_ref;
64415         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64416         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64417         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
64418         *ret_conv = PathFailure_read(ser_ref);
64419         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64420         return tag_ptr(ret_conv, true);
64421 }
64422
64423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64424         if (!ptr_is_owned(this_ptr)) return;
64425         void* this_ptr_ptr = untag_ptr(this_ptr);
64426         CHECK_ACCESS(this_ptr_ptr);
64427         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
64428         FREE(untag_ptr(this_ptr));
64429         ClosureReason_free(this_ptr_conv);
64430 }
64431
64432 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
64433         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64434         *ret_copy = ClosureReason_clone(arg);
64435         int64_t ret_ref = tag_ptr(ret_copy, true);
64436         return ret_ref;
64437 }
64438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64439         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
64440         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
64441         return ret_conv;
64442 }
64443
64444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64445         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
64446         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64447         *ret_copy = ClosureReason_clone(orig_conv);
64448         int64_t ret_ref = tag_ptr(ret_copy, true);
64449         return ret_ref;
64450 }
64451
64452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
64453         LDKUntrustedString peer_msg_conv;
64454         peer_msg_conv.inner = untag_ptr(peer_msg);
64455         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
64456         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
64457         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
64458         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64459         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
64460         int64_t ret_ref = tag_ptr(ret_copy, true);
64461         return ret_ref;
64462 }
64463
64464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
64465         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64466         *ret_copy = ClosureReason_holder_force_closed();
64467         int64_t ret_ref = tag_ptr(ret_copy, true);
64468         return ret_ref;
64469 }
64470
64471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
64472         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64473         *ret_copy = ClosureReason_cooperative_closure();
64474         int64_t ret_ref = tag_ptr(ret_copy, true);
64475         return ret_ref;
64476 }
64477
64478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
64479         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64480         *ret_copy = ClosureReason_commitment_tx_confirmed();
64481         int64_t ret_ref = tag_ptr(ret_copy, true);
64482         return ret_ref;
64483 }
64484
64485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
64486         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64487         *ret_copy = ClosureReason_funding_timed_out();
64488         int64_t ret_ref = tag_ptr(ret_copy, true);
64489         return ret_ref;
64490 }
64491
64492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
64493         LDKStr err_conv = java_to_owned_str(env, err);
64494         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64495         *ret_copy = ClosureReason_processing_error(err_conv);
64496         int64_t ret_ref = tag_ptr(ret_copy, true);
64497         return ret_ref;
64498 }
64499
64500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
64501         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64502         *ret_copy = ClosureReason_disconnected_peer();
64503         int64_t ret_ref = tag_ptr(ret_copy, true);
64504         return ret_ref;
64505 }
64506
64507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
64508         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64509         *ret_copy = ClosureReason_outdated_channel_manager();
64510         int64_t ret_ref = tag_ptr(ret_copy, true);
64511         return ret_ref;
64512 }
64513
64514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
64515         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64516         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
64517         int64_t ret_ref = tag_ptr(ret_copy, true);
64518         return ret_ref;
64519 }
64520
64521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64522         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
64523         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
64524         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
64525         return ret_conv;
64526 }
64527
64528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
64529         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
64530         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
64531         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64532         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64533         CVec_u8Z_free(ret_var);
64534         return ret_arr;
64535 }
64536
64537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64538         LDKu8slice ser_ref;
64539         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64540         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64541         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
64542         *ret_conv = ClosureReason_read(ser_ref);
64543         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64544         return tag_ptr(ret_conv, true);
64545 }
64546
64547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64548         if (!ptr_is_owned(this_ptr)) return;
64549         void* this_ptr_ptr = untag_ptr(this_ptr);
64550         CHECK_ACCESS(this_ptr_ptr);
64551         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
64552         FREE(untag_ptr(this_ptr));
64553         HTLCDestination_free(this_ptr_conv);
64554 }
64555
64556 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
64557         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64558         *ret_copy = HTLCDestination_clone(arg);
64559         int64_t ret_ref = tag_ptr(ret_copy, true);
64560         return ret_ref;
64561 }
64562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64563         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
64564         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
64565         return ret_conv;
64566 }
64567
64568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64569         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
64570         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64571         *ret_copy = HTLCDestination_clone(orig_conv);
64572         int64_t ret_ref = tag_ptr(ret_copy, true);
64573         return ret_ref;
64574 }
64575
64576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int8_tArray channel_id) {
64577         LDKPublicKey node_id_ref;
64578         CHECK((*env)->GetArrayLength(env, node_id) == 33);
64579         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
64580         LDKThirtyTwoBytes channel_id_ref;
64581         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
64582         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
64583         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64584         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
64585         int64_t ret_ref = tag_ptr(ret_copy, true);
64586         return ret_ref;
64587 }
64588
64589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
64590         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64591         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
64592         int64_t ret_ref = tag_ptr(ret_copy, true);
64593         return ret_ref;
64594 }
64595
64596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
64597         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64598         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
64599         int64_t ret_ref = tag_ptr(ret_copy, true);
64600         return ret_ref;
64601 }
64602
64603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
64604         LDKThirtyTwoBytes payment_hash_ref;
64605         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64606         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64607         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64608         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
64609         int64_t ret_ref = tag_ptr(ret_copy, true);
64610         return ret_ref;
64611 }
64612
64613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64614         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
64615         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
64616         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
64617         return ret_conv;
64618 }
64619
64620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
64621         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
64622         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
64623         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64624         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64625         CVec_u8Z_free(ret_var);
64626         return ret_arr;
64627 }
64628
64629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64630         LDKu8slice ser_ref;
64631         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64632         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64633         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
64634         *ret_conv = HTLCDestination_read(ser_ref);
64635         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64636         return tag_ptr(ret_conv, true);
64637 }
64638
64639 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64640         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
64641         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
64642         return ret_conv;
64643 }
64644
64645 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
64646         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
64647         return ret_conv;
64648 }
64649
64650 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
64651         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
64652         return ret_conv;
64653 }
64654
64655 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
64656         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
64657         return ret_conv;
64658 }
64659
64660 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
64661         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
64662         return ret_conv;
64663 }
64664
64665 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
64666         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
64667         return ret_conv;
64668 }
64669
64670 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
64671         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
64672         return ret_conv;
64673 }
64674
64675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64676         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
64677         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
64678         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
64679         return ret_conv;
64680 }
64681
64682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
64683         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
64684         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
64685         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64686         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64687         CVec_u8Z_free(ret_var);
64688         return ret_arr;
64689 }
64690
64691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64692         LDKu8slice ser_ref;
64693         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64694         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64695         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
64696         *ret_conv = PaymentFailureReason_read(ser_ref);
64697         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64698         return tag_ptr(ret_conv, true);
64699 }
64700
64701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64702         if (!ptr_is_owned(this_ptr)) return;
64703         void* this_ptr_ptr = untag_ptr(this_ptr);
64704         CHECK_ACCESS(this_ptr_ptr);
64705         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
64706         FREE(untag_ptr(this_ptr));
64707         Event_free(this_ptr_conv);
64708 }
64709
64710 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
64711         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64712         *ret_copy = Event_clone(arg);
64713         int64_t ret_ref = tag_ptr(ret_copy, true);
64714         return ret_ref;
64715 }
64716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64717         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
64718         int64_t ret_conv = Event_clone_ptr(arg_conv);
64719         return ret_conv;
64720 }
64721
64722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64723         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
64724         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64725         *ret_copy = Event_clone(orig_conv);
64726         int64_t ret_ref = tag_ptr(ret_copy, true);
64727         return ret_ref;
64728 }
64729
64730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
64731         LDKThirtyTwoBytes temporary_channel_id_ref;
64732         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
64733         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
64734         LDKPublicKey counterparty_node_id_ref;
64735         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
64736         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
64737         LDKCVec_u8Z output_script_ref;
64738         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
64739         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
64740         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
64741         LDKU128 user_channel_id_ref;
64742         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
64743         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
64744         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64745         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
64746         int64_t ret_ref = tag_ptr(ret_copy, true);
64747         return ret_ref;
64748 }
64749
64750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimable(JNIEnv *env, jclass clz, int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t onion_fields, int64_t amount_msat, int64_t counterparty_skimmed_fee_msat, int64_t purpose, int8_tArray via_channel_id, int64_t via_user_channel_id, int64_t claim_deadline) {
64751         LDKPublicKey receiver_node_id_ref;
64752         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
64753         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
64754         LDKThirtyTwoBytes payment_hash_ref;
64755         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64756         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64757         LDKRecipientOnionFields onion_fields_conv;
64758         onion_fields_conv.inner = untag_ptr(onion_fields);
64759         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
64760         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
64761         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
64762         void* purpose_ptr = untag_ptr(purpose);
64763         CHECK_ACCESS(purpose_ptr);
64764         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
64765         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
64766         LDKThirtyTwoBytes via_channel_id_ref;
64767         CHECK((*env)->GetArrayLength(env, via_channel_id) == 32);
64768         (*env)->GetByteArrayRegion(env, via_channel_id, 0, 32, via_channel_id_ref.data);
64769         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
64770         CHECK_ACCESS(via_user_channel_id_ptr);
64771         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
64772         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
64773         void* claim_deadline_ptr = untag_ptr(claim_deadline);
64774         CHECK_ACCESS(claim_deadline_ptr);
64775         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
64776         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
64777         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64778         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, counterparty_skimmed_fee_msat, purpose_conv, via_channel_id_ref, via_user_channel_id_conv, claim_deadline_conv);
64779         int64_t ret_ref = tag_ptr(ret_copy, true);
64780         return ret_ref;
64781 }
64782
64783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimed(JNIEnv *env, jclass clz, int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, int64_t purpose) {
64784         LDKPublicKey receiver_node_id_ref;
64785         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
64786         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
64787         LDKThirtyTwoBytes payment_hash_ref;
64788         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64789         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64790         void* purpose_ptr = untag_ptr(purpose);
64791         CHECK_ACCESS(purpose_ptr);
64792         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
64793         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
64794         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64795         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
64796         int64_t ret_ref = tag_ptr(ret_copy, true);
64797         return ret_ref;
64798 }
64799
64800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int64_t payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
64801         void* payment_id_ptr = untag_ptr(payment_id);
64802         CHECK_ACCESS(payment_id_ptr);
64803         LDKCOption_PaymentIdZ payment_id_conv = *(LDKCOption_PaymentIdZ*)(payment_id_ptr);
64804         payment_id_conv = COption_PaymentIdZ_clone((LDKCOption_PaymentIdZ*)untag_ptr(payment_id));
64805         LDKThirtyTwoBytes payment_preimage_ref;
64806         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
64807         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
64808         LDKThirtyTwoBytes payment_hash_ref;
64809         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64810         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64811         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
64812         CHECK_ACCESS(fee_paid_msat_ptr);
64813         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
64814         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
64815         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64816         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
64817         int64_t ret_ref = tag_ptr(ret_copy, true);
64818         return ret_ref;
64819 }
64820
64821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t reason) {
64822         LDKThirtyTwoBytes payment_id_ref;
64823         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64824         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64825         LDKThirtyTwoBytes payment_hash_ref;
64826         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64827         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64828         void* reason_ptr = untag_ptr(reason);
64829         CHECK_ACCESS(reason_ptr);
64830         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
64831         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
64832         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64833         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
64834         int64_t ret_ref = tag_ptr(ret_copy, true);
64835         return ret_ref;
64836 }
64837
64838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash, int64_t path) {
64839         LDKThirtyTwoBytes payment_id_ref;
64840         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64841         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64842         void* payment_hash_ptr = untag_ptr(payment_hash);
64843         CHECK_ACCESS(payment_hash_ptr);
64844         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
64845         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
64846         LDKPath path_conv;
64847         path_conv.inner = untag_ptr(path);
64848         path_conv.is_owned = ptr_is_owned(path);
64849         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64850         path_conv = Path_clone(&path_conv);
64851         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64852         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
64853         int64_t ret_ref = tag_ptr(ret_copy, true);
64854         return ret_ref;
64855 }
64856
64857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, int64_t failure, int64_t path, int64_t short_channel_id) {
64858         void* payment_id_ptr = untag_ptr(payment_id);
64859         CHECK_ACCESS(payment_id_ptr);
64860         LDKCOption_PaymentIdZ payment_id_conv = *(LDKCOption_PaymentIdZ*)(payment_id_ptr);
64861         payment_id_conv = COption_PaymentIdZ_clone((LDKCOption_PaymentIdZ*)untag_ptr(payment_id));
64862         LDKThirtyTwoBytes payment_hash_ref;
64863         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64864         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64865         void* failure_ptr = untag_ptr(failure);
64866         CHECK_ACCESS(failure_ptr);
64867         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
64868         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
64869         LDKPath path_conv;
64870         path_conv.inner = untag_ptr(path);
64871         path_conv.is_owned = ptr_is_owned(path);
64872         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64873         path_conv = Path_clone(&path_conv);
64874         void* short_channel_id_ptr = untag_ptr(short_channel_id);
64875         CHECK_ACCESS(short_channel_id_ptr);
64876         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
64877         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
64878         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64879         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
64880         int64_t ret_ref = tag_ptr(ret_copy, true);
64881         return ret_ref;
64882 }
64883
64884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t path) {
64885         LDKThirtyTwoBytes payment_id_ref;
64886         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64887         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64888         LDKThirtyTwoBytes payment_hash_ref;
64889         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64890         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64891         LDKPath path_conv;
64892         path_conv.inner = untag_ptr(path);
64893         path_conv.is_owned = ptr_is_owned(path);
64894         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64895         path_conv = Path_clone(&path_conv);
64896         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64897         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
64898         int64_t ret_ref = tag_ptr(ret_copy, true);
64899         return ret_ref;
64900 }
64901
64902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1probe_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_t path, int64_t short_channel_id) {
64903         LDKThirtyTwoBytes payment_id_ref;
64904         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64905         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64906         LDKThirtyTwoBytes payment_hash_ref;
64907         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64908         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64909         LDKPath path_conv;
64910         path_conv.inner = untag_ptr(path);
64911         path_conv.is_owned = ptr_is_owned(path);
64912         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64913         path_conv = Path_clone(&path_conv);
64914         void* short_channel_id_ptr = untag_ptr(short_channel_id);
64915         CHECK_ACCESS(short_channel_id_ptr);
64916         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
64917         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
64918         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64919         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
64920         int64_t ret_ref = tag_ptr(ret_copy, true);
64921         return ret_ref;
64922 }
64923
64924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
64925         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64926         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
64927         int64_t ret_ref = tag_ptr(ret_copy, true);
64928         return ret_ref;
64929 }
64930
64931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlcintercepted(JNIEnv *env, jclass clz, int8_tArray intercept_id, int64_t requested_next_hop_scid, int8_tArray payment_hash, int64_t inbound_amount_msat, int64_t expected_outbound_amount_msat) {
64932         LDKThirtyTwoBytes intercept_id_ref;
64933         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
64934         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
64935         LDKThirtyTwoBytes payment_hash_ref;
64936         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64937         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64938         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64939         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
64940         int64_t ret_ref = tag_ptr(ret_copy, true);
64941         return ret_ref;
64942 }
64943
64944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
64945         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
64946         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
64947         if (outputs_constr.datalen > 0)
64948                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
64949         else
64950                 outputs_constr.data = NULL;
64951         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
64952         for (size_t b = 0; b < outputs_constr.datalen; b++) {
64953                 int64_t outputs_conv_27 = outputs_vals[b];
64954                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
64955                 CHECK_ACCESS(outputs_conv_27_ptr);
64956                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
64957                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
64958                 outputs_constr.data[b] = outputs_conv_27_conv;
64959         }
64960         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
64961         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64962         *ret_copy = Event_spendable_outputs(outputs_constr);
64963         int64_t ret_ref = tag_ptr(ret_copy, true);
64964         return ret_ref;
64965 }
64966
64967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int8_tArray next_channel_id, int64_t fee_earned_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
64968         LDKThirtyTwoBytes prev_channel_id_ref;
64969         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
64970         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
64971         LDKThirtyTwoBytes next_channel_id_ref;
64972         CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
64973         (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
64974         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
64975         CHECK_ACCESS(fee_earned_msat_ptr);
64976         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
64977         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
64978         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
64979         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
64980         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
64981         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
64982         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64983         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
64984         int64_t ret_ref = tag_ptr(ret_copy, true);
64985         return ret_ref;
64986 }
64987
64988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1pending(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo) {
64989         LDKThirtyTwoBytes channel_id_ref;
64990         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
64991         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
64992         LDKU128 user_channel_id_ref;
64993         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
64994         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
64995         LDKThirtyTwoBytes former_temporary_channel_id_ref;
64996         CHECK((*env)->GetArrayLength(env, former_temporary_channel_id) == 32);
64997         (*env)->GetByteArrayRegion(env, former_temporary_channel_id, 0, 32, former_temporary_channel_id_ref.data);
64998         LDKPublicKey counterparty_node_id_ref;
64999         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
65000         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
65001         LDKOutPoint funding_txo_conv;
65002         funding_txo_conv.inner = untag_ptr(funding_txo);
65003         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
65004         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
65005         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
65006         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65007         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_ref, counterparty_node_id_ref, funding_txo_conv);
65008         int64_t ret_ref = tag_ptr(ret_copy, true);
65009         return ret_ref;
65010 }
65011
65012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
65013         LDKThirtyTwoBytes channel_id_ref;
65014         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
65015         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
65016         LDKU128 user_channel_id_ref;
65017         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
65018         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
65019         LDKPublicKey counterparty_node_id_ref;
65020         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
65021         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
65022         LDKChannelTypeFeatures channel_type_conv;
65023         channel_type_conv.inner = untag_ptr(channel_type);
65024         channel_type_conv.is_owned = ptr_is_owned(channel_type);
65025         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
65026         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
65027         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65028         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
65029         int64_t ret_ref = tag_ptr(ret_copy, true);
65030         return ret_ref;
65031 }
65032
65033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray user_channel_id, int64_t reason) {
65034         LDKThirtyTwoBytes channel_id_ref;
65035         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
65036         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
65037         LDKU128 user_channel_id_ref;
65038         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
65039         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
65040         void* reason_ptr = untag_ptr(reason);
65041         CHECK_ACCESS(reason_ptr);
65042         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
65043         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
65044         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65045         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
65046         int64_t ret_ref = tag_ptr(ret_copy, true);
65047         return ret_ref;
65048 }
65049
65050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
65051         LDKThirtyTwoBytes channel_id_ref;
65052         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
65053         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
65054         LDKTransaction transaction_ref;
65055         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
65056         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
65057         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
65058         transaction_ref.data_is_owned = true;
65059         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65060         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
65061         int64_t ret_ref = tag_ptr(ret_copy, true);
65062         return ret_ref;
65063 }
65064
65065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
65066         LDKThirtyTwoBytes temporary_channel_id_ref;
65067         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
65068         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
65069         LDKPublicKey counterparty_node_id_ref;
65070         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
65071         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
65072         LDKChannelTypeFeatures channel_type_conv;
65073         channel_type_conv.inner = untag_ptr(channel_type);
65074         channel_type_conv.is_owned = ptr_is_owned(channel_type);
65075         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
65076         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
65077         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65078         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
65079         int64_t ret_ref = tag_ptr(ret_copy, true);
65080         return ret_ref;
65081 }
65082
65083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int8_tArray prev_channel_id, int64_t failed_next_destination) {
65084         LDKThirtyTwoBytes prev_channel_id_ref;
65085         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
65086         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
65087         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
65088         CHECK_ACCESS(failed_next_destination_ptr);
65089         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
65090         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
65091         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65092         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
65093         int64_t ret_ref = tag_ptr(ret_copy, true);
65094         return ret_ref;
65095 }
65096
65097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
65098         void* a_ptr = untag_ptr(a);
65099         CHECK_ACCESS(a_ptr);
65100         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
65101         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
65102         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65103         *ret_copy = Event_bump_transaction(a_conv);
65104         int64_t ret_ref = tag_ptr(ret_copy, true);
65105         return ret_ref;
65106 }
65107
65108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65109         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
65110         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
65111         jboolean ret_conv = Event_eq(a_conv, b_conv);
65112         return ret_conv;
65113 }
65114
65115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
65116         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
65117         LDKCVec_u8Z ret_var = Event_write(obj_conv);
65118         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65119         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65120         CVec_u8Z_free(ret_var);
65121         return ret_arr;
65122 }
65123
65124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65125         LDKu8slice ser_ref;
65126         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65127         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65128         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
65129         *ret_conv = Event_read(ser_ref);
65130         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65131         return tag_ptr(ret_conv, true);
65132 }
65133
65134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65135         if (!ptr_is_owned(this_ptr)) return;
65136         void* this_ptr_ptr = untag_ptr(this_ptr);
65137         CHECK_ACCESS(this_ptr_ptr);
65138         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
65139         FREE(untag_ptr(this_ptr));
65140         MessageSendEvent_free(this_ptr_conv);
65141 }
65142
65143 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
65144         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65145         *ret_copy = MessageSendEvent_clone(arg);
65146         int64_t ret_ref = tag_ptr(ret_copy, true);
65147         return ret_ref;
65148 }
65149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65150         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
65151         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
65152         return ret_conv;
65153 }
65154
65155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65156         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
65157         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65158         *ret_copy = MessageSendEvent_clone(orig_conv);
65159         int64_t ret_ref = tag_ptr(ret_copy, true);
65160         return ret_ref;
65161 }
65162
65163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65164         LDKPublicKey node_id_ref;
65165         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65166         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65167         LDKAcceptChannel msg_conv;
65168         msg_conv.inner = untag_ptr(msg);
65169         msg_conv.is_owned = ptr_is_owned(msg);
65170         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65171         msg_conv = AcceptChannel_clone(&msg_conv);
65172         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65173         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
65174         int64_t ret_ref = tag_ptr(ret_copy, true);
65175         return ret_ref;
65176 }
65177
65178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel_1v2(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65179         LDKPublicKey node_id_ref;
65180         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65181         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65182         LDKAcceptChannelV2 msg_conv;
65183         msg_conv.inner = untag_ptr(msg);
65184         msg_conv.is_owned = ptr_is_owned(msg);
65185         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65186         msg_conv = AcceptChannelV2_clone(&msg_conv);
65187         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65188         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
65189         int64_t ret_ref = tag_ptr(ret_copy, true);
65190         return ret_ref;
65191 }
65192
65193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65194         LDKPublicKey node_id_ref;
65195         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65196         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65197         LDKOpenChannel msg_conv;
65198         msg_conv.inner = untag_ptr(msg);
65199         msg_conv.is_owned = ptr_is_owned(msg);
65200         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65201         msg_conv = OpenChannel_clone(&msg_conv);
65202         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65203         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
65204         int64_t ret_ref = tag_ptr(ret_copy, true);
65205         return ret_ref;
65206 }
65207
65208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel_1v2(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65209         LDKPublicKey node_id_ref;
65210         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65211         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65212         LDKOpenChannelV2 msg_conv;
65213         msg_conv.inner = untag_ptr(msg);
65214         msg_conv.is_owned = ptr_is_owned(msg);
65215         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65216         msg_conv = OpenChannelV2_clone(&msg_conv);
65217         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65218         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
65219         int64_t ret_ref = tag_ptr(ret_copy, true);
65220         return ret_ref;
65221 }
65222
65223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65224         LDKPublicKey node_id_ref;
65225         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65226         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65227         LDKFundingCreated msg_conv;
65228         msg_conv.inner = untag_ptr(msg);
65229         msg_conv.is_owned = ptr_is_owned(msg);
65230         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65231         msg_conv = FundingCreated_clone(&msg_conv);
65232         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65233         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
65234         int64_t ret_ref = tag_ptr(ret_copy, true);
65235         return ret_ref;
65236 }
65237
65238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65239         LDKPublicKey node_id_ref;
65240         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65241         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65242         LDKFundingSigned msg_conv;
65243         msg_conv.inner = untag_ptr(msg);
65244         msg_conv.is_owned = ptr_is_owned(msg);
65245         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65246         msg_conv = FundingSigned_clone(&msg_conv);
65247         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65248         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
65249         int64_t ret_ref = tag_ptr(ret_copy, true);
65250         return ret_ref;
65251 }
65252
65253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1add_1input(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65254         LDKPublicKey node_id_ref;
65255         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65256         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65257         LDKTxAddInput msg_conv;
65258         msg_conv.inner = untag_ptr(msg);
65259         msg_conv.is_owned = ptr_is_owned(msg);
65260         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65261         msg_conv = TxAddInput_clone(&msg_conv);
65262         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65263         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
65264         int64_t ret_ref = tag_ptr(ret_copy, true);
65265         return ret_ref;
65266 }
65267
65268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1add_1output(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65269         LDKPublicKey node_id_ref;
65270         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65271         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65272         LDKTxAddOutput msg_conv;
65273         msg_conv.inner = untag_ptr(msg);
65274         msg_conv.is_owned = ptr_is_owned(msg);
65275         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65276         msg_conv = TxAddOutput_clone(&msg_conv);
65277         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65278         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
65279         int64_t ret_ref = tag_ptr(ret_copy, true);
65280         return ret_ref;
65281 }
65282
65283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1remove_1input(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65284         LDKPublicKey node_id_ref;
65285         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65286         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65287         LDKTxRemoveInput msg_conv;
65288         msg_conv.inner = untag_ptr(msg);
65289         msg_conv.is_owned = ptr_is_owned(msg);
65290         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65291         msg_conv = TxRemoveInput_clone(&msg_conv);
65292         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65293         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
65294         int64_t ret_ref = tag_ptr(ret_copy, true);
65295         return ret_ref;
65296 }
65297
65298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1remove_1output(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65299         LDKPublicKey node_id_ref;
65300         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65301         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65302         LDKTxRemoveOutput msg_conv;
65303         msg_conv.inner = untag_ptr(msg);
65304         msg_conv.is_owned = ptr_is_owned(msg);
65305         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65306         msg_conv = TxRemoveOutput_clone(&msg_conv);
65307         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65308         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
65309         int64_t ret_ref = tag_ptr(ret_copy, true);
65310         return ret_ref;
65311 }
65312
65313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65314         LDKPublicKey node_id_ref;
65315         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65316         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65317         LDKTxComplete msg_conv;
65318         msg_conv.inner = untag_ptr(msg);
65319         msg_conv.is_owned = ptr_is_owned(msg);
65320         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65321         msg_conv = TxComplete_clone(&msg_conv);
65322         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65323         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
65324         int64_t ret_ref = tag_ptr(ret_copy, true);
65325         return ret_ref;
65326 }
65327
65328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65329         LDKPublicKey node_id_ref;
65330         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65331         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65332         LDKTxSignatures msg_conv;
65333         msg_conv.inner = untag_ptr(msg);
65334         msg_conv.is_owned = ptr_is_owned(msg);
65335         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65336         msg_conv = TxSignatures_clone(&msg_conv);
65337         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65338         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
65339         int64_t ret_ref = tag_ptr(ret_copy, true);
65340         return ret_ref;
65341 }
65342
65343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1init_1rbf(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65344         LDKPublicKey node_id_ref;
65345         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65346         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65347         LDKTxInitRbf msg_conv;
65348         msg_conv.inner = untag_ptr(msg);
65349         msg_conv.is_owned = ptr_is_owned(msg);
65350         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65351         msg_conv = TxInitRbf_clone(&msg_conv);
65352         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65353         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
65354         int64_t ret_ref = tag_ptr(ret_copy, true);
65355         return ret_ref;
65356 }
65357
65358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1ack_1rbf(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65359         LDKPublicKey node_id_ref;
65360         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65361         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65362         LDKTxAckRbf msg_conv;
65363         msg_conv.inner = untag_ptr(msg);
65364         msg_conv.is_owned = ptr_is_owned(msg);
65365         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65366         msg_conv = TxAckRbf_clone(&msg_conv);
65367         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65368         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
65369         int64_t ret_ref = tag_ptr(ret_copy, true);
65370         return ret_ref;
65371 }
65372
65373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65374         LDKPublicKey node_id_ref;
65375         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65376         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65377         LDKTxAddInput msg_conv;
65378         msg_conv.inner = untag_ptr(msg);
65379         msg_conv.is_owned = ptr_is_owned(msg);
65380         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65381         msg_conv = TxAddInput_clone(&msg_conv);
65382         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65383         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
65384         int64_t ret_ref = tag_ptr(ret_copy, true);
65385         return ret_ref;
65386 }
65387
65388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65389         LDKPublicKey node_id_ref;
65390         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65391         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65392         LDKChannelReady msg_conv;
65393         msg_conv.inner = untag_ptr(msg);
65394         msg_conv.is_owned = ptr_is_owned(msg);
65395         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65396         msg_conv = ChannelReady_clone(&msg_conv);
65397         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65398         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
65399         int64_t ret_ref = tag_ptr(ret_copy, true);
65400         return ret_ref;
65401 }
65402
65403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65404         LDKPublicKey node_id_ref;
65405         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65406         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65407         LDKAnnouncementSignatures msg_conv;
65408         msg_conv.inner = untag_ptr(msg);
65409         msg_conv.is_owned = ptr_is_owned(msg);
65410         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65411         msg_conv = AnnouncementSignatures_clone(&msg_conv);
65412         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65413         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
65414         int64_t ret_ref = tag_ptr(ret_copy, true);
65415         return ret_ref;
65416 }
65417
65418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
65419         LDKPublicKey node_id_ref;
65420         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65421         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65422         LDKCommitmentUpdate updates_conv;
65423         updates_conv.inner = untag_ptr(updates);
65424         updates_conv.is_owned = ptr_is_owned(updates);
65425         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
65426         updates_conv = CommitmentUpdate_clone(&updates_conv);
65427         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65428         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
65429         int64_t ret_ref = tag_ptr(ret_copy, true);
65430         return ret_ref;
65431 }
65432
65433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1revoke_1and_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65434         LDKPublicKey node_id_ref;
65435         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65436         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65437         LDKRevokeAndACK msg_conv;
65438         msg_conv.inner = untag_ptr(msg);
65439         msg_conv.is_owned = ptr_is_owned(msg);
65440         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65441         msg_conv = RevokeAndACK_clone(&msg_conv);
65442         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65443         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
65444         int64_t ret_ref = tag_ptr(ret_copy, true);
65445         return ret_ref;
65446 }
65447
65448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65449         LDKPublicKey node_id_ref;
65450         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65451         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65452         LDKClosingSigned msg_conv;
65453         msg_conv.inner = untag_ptr(msg);
65454         msg_conv.is_owned = ptr_is_owned(msg);
65455         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65456         msg_conv = ClosingSigned_clone(&msg_conv);
65457         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65458         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
65459         int64_t ret_ref = tag_ptr(ret_copy, true);
65460         return ret_ref;
65461 }
65462
65463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65464         LDKPublicKey node_id_ref;
65465         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65466         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65467         LDKShutdown msg_conv;
65468         msg_conv.inner = untag_ptr(msg);
65469         msg_conv.is_owned = ptr_is_owned(msg);
65470         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65471         msg_conv = Shutdown_clone(&msg_conv);
65472         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65473         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
65474         int64_t ret_ref = tag_ptr(ret_copy, true);
65475         return ret_ref;
65476 }
65477
65478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65479         LDKPublicKey node_id_ref;
65480         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65481         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65482         LDKChannelReestablish msg_conv;
65483         msg_conv.inner = untag_ptr(msg);
65484         msg_conv.is_owned = ptr_is_owned(msg);
65485         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65486         msg_conv = ChannelReestablish_clone(&msg_conv);
65487         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65488         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
65489         int64_t ret_ref = tag_ptr(ret_copy, true);
65490         return ret_ref;
65491 }
65492
65493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1announcement(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg, int64_t update_msg) {
65494         LDKPublicKey node_id_ref;
65495         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65496         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65497         LDKChannelAnnouncement msg_conv;
65498         msg_conv.inner = untag_ptr(msg);
65499         msg_conv.is_owned = ptr_is_owned(msg);
65500         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65501         msg_conv = ChannelAnnouncement_clone(&msg_conv);
65502         LDKChannelUpdate update_msg_conv;
65503         update_msg_conv.inner = untag_ptr(update_msg);
65504         update_msg_conv.is_owned = ptr_is_owned(update_msg);
65505         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
65506         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
65507         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65508         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
65509         int64_t ret_ref = tag_ptr(ret_copy, true);
65510         return ret_ref;
65511 }
65512
65513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
65514         LDKChannelAnnouncement msg_conv;
65515         msg_conv.inner = untag_ptr(msg);
65516         msg_conv.is_owned = ptr_is_owned(msg);
65517         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65518         msg_conv = ChannelAnnouncement_clone(&msg_conv);
65519         LDKChannelUpdate update_msg_conv;
65520         update_msg_conv.inner = untag_ptr(update_msg);
65521         update_msg_conv.is_owned = ptr_is_owned(update_msg);
65522         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
65523         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
65524         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65525         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
65526         int64_t ret_ref = tag_ptr(ret_copy, true);
65527         return ret_ref;
65528 }
65529
65530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
65531         LDKChannelUpdate msg_conv;
65532         msg_conv.inner = untag_ptr(msg);
65533         msg_conv.is_owned = ptr_is_owned(msg);
65534         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65535         msg_conv = ChannelUpdate_clone(&msg_conv);
65536         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65537         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
65538         int64_t ret_ref = tag_ptr(ret_copy, true);
65539         return ret_ref;
65540 }
65541
65542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
65543         LDKNodeAnnouncement msg_conv;
65544         msg_conv.inner = untag_ptr(msg);
65545         msg_conv.is_owned = ptr_is_owned(msg);
65546         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65547         msg_conv = NodeAnnouncement_clone(&msg_conv);
65548         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65549         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
65550         int64_t ret_ref = tag_ptr(ret_copy, true);
65551         return ret_ref;
65552 }
65553
65554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65555         LDKPublicKey node_id_ref;
65556         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65557         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65558         LDKChannelUpdate msg_conv;
65559         msg_conv.inner = untag_ptr(msg);
65560         msg_conv.is_owned = ptr_is_owned(msg);
65561         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65562         msg_conv = ChannelUpdate_clone(&msg_conv);
65563         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65564         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
65565         int64_t ret_ref = tag_ptr(ret_copy, true);
65566         return ret_ref;
65567 }
65568
65569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
65570         LDKPublicKey node_id_ref;
65571         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65572         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65573         void* action_ptr = untag_ptr(action);
65574         CHECK_ACCESS(action_ptr);
65575         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
65576         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
65577         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65578         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
65579         int64_t ret_ref = tag_ptr(ret_copy, true);
65580         return ret_ref;
65581 }
65582
65583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65584         LDKPublicKey node_id_ref;
65585         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65586         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65587         LDKQueryChannelRange msg_conv;
65588         msg_conv.inner = untag_ptr(msg);
65589         msg_conv.is_owned = ptr_is_owned(msg);
65590         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65591         msg_conv = QueryChannelRange_clone(&msg_conv);
65592         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65593         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
65594         int64_t ret_ref = tag_ptr(ret_copy, true);
65595         return ret_ref;
65596 }
65597
65598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short_1ids_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65599         LDKPublicKey node_id_ref;
65600         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65601         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65602         LDKQueryShortChannelIds msg_conv;
65603         msg_conv.inner = untag_ptr(msg);
65604         msg_conv.is_owned = ptr_is_owned(msg);
65605         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65606         msg_conv = QueryShortChannelIds_clone(&msg_conv);
65607         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65608         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
65609         int64_t ret_ref = tag_ptr(ret_copy, true);
65610         return ret_ref;
65611 }
65612
65613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65614         LDKPublicKey node_id_ref;
65615         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65616         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65617         LDKReplyChannelRange msg_conv;
65618         msg_conv.inner = untag_ptr(msg);
65619         msg_conv.is_owned = ptr_is_owned(msg);
65620         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65621         msg_conv = ReplyChannelRange_clone(&msg_conv);
65622         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65623         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
65624         int64_t ret_ref = tag_ptr(ret_copy, true);
65625         return ret_ref;
65626 }
65627
65628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1gossip_1timestamp_1filter(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65629         LDKPublicKey node_id_ref;
65630         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65631         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65632         LDKGossipTimestampFilter msg_conv;
65633         msg_conv.inner = untag_ptr(msg);
65634         msg_conv.is_owned = ptr_is_owned(msg);
65635         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65636         msg_conv = GossipTimestampFilter_clone(&msg_conv);
65637         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65638         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
65639         int64_t ret_ref = tag_ptr(ret_copy, true);
65640         return ret_ref;
65641 }
65642
65643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65644         if (!ptr_is_owned(this_ptr)) return;
65645         void* this_ptr_ptr = untag_ptr(this_ptr);
65646         CHECK_ACCESS(this_ptr_ptr);
65647         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
65648         FREE(untag_ptr(this_ptr));
65649         MessageSendEventsProvider_free(this_ptr_conv);
65650 }
65651
65652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65653         if (!ptr_is_owned(this_ptr)) return;
65654         void* this_ptr_ptr = untag_ptr(this_ptr);
65655         CHECK_ACCESS(this_ptr_ptr);
65656         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
65657         FREE(untag_ptr(this_ptr));
65658         OnionMessageProvider_free(this_ptr_conv);
65659 }
65660
65661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65662         if (!ptr_is_owned(this_ptr)) return;
65663         void* this_ptr_ptr = untag_ptr(this_ptr);
65664         CHECK_ACCESS(this_ptr_ptr);
65665         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
65666         FREE(untag_ptr(this_ptr));
65667         EventsProvider_free(this_ptr_conv);
65668 }
65669
65670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65671         if (!ptr_is_owned(this_ptr)) return;
65672         void* this_ptr_ptr = untag_ptr(this_ptr);
65673         CHECK_ACCESS(this_ptr_ptr);
65674         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
65675         FREE(untag_ptr(this_ptr));
65676         EventHandler_free(this_ptr_conv);
65677 }
65678
65679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65680         LDKChannelDerivationParameters this_obj_conv;
65681         this_obj_conv.inner = untag_ptr(this_obj);
65682         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65684         ChannelDerivationParameters_free(this_obj_conv);
65685 }
65686
65687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
65688         LDKChannelDerivationParameters this_ptr_conv;
65689         this_ptr_conv.inner = untag_ptr(this_ptr);
65690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65692         this_ptr_conv.is_owned = false;
65693         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
65694         return ret_conv;
65695 }
65696
65697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65698         LDKChannelDerivationParameters this_ptr_conv;
65699         this_ptr_conv.inner = untag_ptr(this_ptr);
65700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65702         this_ptr_conv.is_owned = false;
65703         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
65704 }
65705
65706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
65707         LDKChannelDerivationParameters this_ptr_conv;
65708         this_ptr_conv.inner = untag_ptr(this_ptr);
65709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65711         this_ptr_conv.is_owned = false;
65712         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65713         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
65714         return ret_arr;
65715 }
65716
65717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
65718         LDKChannelDerivationParameters this_ptr_conv;
65719         this_ptr_conv.inner = untag_ptr(this_ptr);
65720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65722         this_ptr_conv.is_owned = false;
65723         LDKThirtyTwoBytes val_ref;
65724         CHECK((*env)->GetArrayLength(env, val) == 32);
65725         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
65726         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
65727 }
65728
65729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
65730         LDKChannelDerivationParameters this_ptr_conv;
65731         this_ptr_conv.inner = untag_ptr(this_ptr);
65732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65734         this_ptr_conv.is_owned = false;
65735         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
65736         int64_t ret_ref = 0;
65737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65739         return ret_ref;
65740 }
65741
65742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65743         LDKChannelDerivationParameters this_ptr_conv;
65744         this_ptr_conv.inner = untag_ptr(this_ptr);
65745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65747         this_ptr_conv.is_owned = false;
65748         LDKChannelTransactionParameters val_conv;
65749         val_conv.inner = untag_ptr(val);
65750         val_conv.is_owned = ptr_is_owned(val);
65751         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65752         val_conv = ChannelTransactionParameters_clone(&val_conv);
65753         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
65754 }
65755
65756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1new(JNIEnv *env, jclass clz, int64_t value_satoshis_arg, int8_tArray keys_id_arg, int64_t transaction_parameters_arg) {
65757         LDKThirtyTwoBytes keys_id_arg_ref;
65758         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
65759         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
65760         LDKChannelTransactionParameters transaction_parameters_arg_conv;
65761         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
65762         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
65763         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
65764         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
65765         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
65766         int64_t ret_ref = 0;
65767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65769         return ret_ref;
65770 }
65771
65772 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
65773         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
65774         int64_t ret_ref = 0;
65775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65777         return ret_ref;
65778 }
65779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65780         LDKChannelDerivationParameters arg_conv;
65781         arg_conv.inner = untag_ptr(arg);
65782         arg_conv.is_owned = ptr_is_owned(arg);
65783         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65784         arg_conv.is_owned = false;
65785         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
65786         return ret_conv;
65787 }
65788
65789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65790         LDKChannelDerivationParameters orig_conv;
65791         orig_conv.inner = untag_ptr(orig);
65792         orig_conv.is_owned = ptr_is_owned(orig);
65793         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65794         orig_conv.is_owned = false;
65795         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
65796         int64_t ret_ref = 0;
65797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65799         return ret_ref;
65800 }
65801
65802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65803         LDKChannelDerivationParameters a_conv;
65804         a_conv.inner = untag_ptr(a);
65805         a_conv.is_owned = ptr_is_owned(a);
65806         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65807         a_conv.is_owned = false;
65808         LDKChannelDerivationParameters b_conv;
65809         b_conv.inner = untag_ptr(b);
65810         b_conv.is_owned = ptr_is_owned(b);
65811         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65812         b_conv.is_owned = false;
65813         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
65814         return ret_conv;
65815 }
65816
65817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65818         LDKAnchorDescriptor this_obj_conv;
65819         this_obj_conv.inner = untag_ptr(this_obj);
65820         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65822         AnchorDescriptor_free(this_obj_conv);
65823 }
65824
65825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
65826         LDKAnchorDescriptor this_ptr_conv;
65827         this_ptr_conv.inner = untag_ptr(this_ptr);
65828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65830         this_ptr_conv.is_owned = false;
65831         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
65832         int64_t ret_ref = 0;
65833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65835         return ret_ref;
65836 }
65837
65838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65839         LDKAnchorDescriptor this_ptr_conv;
65840         this_ptr_conv.inner = untag_ptr(this_ptr);
65841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65843         this_ptr_conv.is_owned = false;
65844         LDKChannelDerivationParameters val_conv;
65845         val_conv.inner = untag_ptr(val);
65846         val_conv.is_owned = ptr_is_owned(val);
65847         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65848         val_conv = ChannelDerivationParameters_clone(&val_conv);
65849         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
65850 }
65851
65852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
65853         LDKAnchorDescriptor this_ptr_conv;
65854         this_ptr_conv.inner = untag_ptr(this_ptr);
65855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65857         this_ptr_conv.is_owned = false;
65858         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
65859         int64_t ret_ref = 0;
65860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65862         return ret_ref;
65863 }
65864
65865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65866         LDKAnchorDescriptor this_ptr_conv;
65867         this_ptr_conv.inner = untag_ptr(this_ptr);
65868         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65870         this_ptr_conv.is_owned = false;
65871         LDKOutPoint val_conv;
65872         val_conv.inner = untag_ptr(val);
65873         val_conv.is_owned = ptr_is_owned(val);
65874         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65875         val_conv = OutPoint_clone(&val_conv);
65876         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
65877 }
65878
65879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1new(JNIEnv *env, jclass clz, int64_t channel_derivation_parameters_arg, int64_t outpoint_arg) {
65880         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
65881         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
65882         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
65883         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
65884         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
65885         LDKOutPoint outpoint_arg_conv;
65886         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
65887         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
65888         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
65889         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
65890         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
65891         int64_t ret_ref = 0;
65892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65894         return ret_ref;
65895 }
65896
65897 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
65898         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
65899         int64_t ret_ref = 0;
65900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65902         return ret_ref;
65903 }
65904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65905         LDKAnchorDescriptor arg_conv;
65906         arg_conv.inner = untag_ptr(arg);
65907         arg_conv.is_owned = ptr_is_owned(arg);
65908         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65909         arg_conv.is_owned = false;
65910         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
65911         return ret_conv;
65912 }
65913
65914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65915         LDKAnchorDescriptor orig_conv;
65916         orig_conv.inner = untag_ptr(orig);
65917         orig_conv.is_owned = ptr_is_owned(orig);
65918         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65919         orig_conv.is_owned = false;
65920         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
65921         int64_t ret_ref = 0;
65922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65924         return ret_ref;
65925 }
65926
65927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65928         LDKAnchorDescriptor a_conv;
65929         a_conv.inner = untag_ptr(a);
65930         a_conv.is_owned = ptr_is_owned(a);
65931         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65932         a_conv.is_owned = false;
65933         LDKAnchorDescriptor b_conv;
65934         b_conv.inner = untag_ptr(b);
65935         b_conv.is_owned = ptr_is_owned(b);
65936         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65937         b_conv.is_owned = false;
65938         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
65939         return ret_conv;
65940 }
65941
65942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
65943         LDKAnchorDescriptor this_arg_conv;
65944         this_arg_conv.inner = untag_ptr(this_arg);
65945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65947         this_arg_conv.is_owned = false;
65948         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
65949         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
65950         return tag_ptr(ret_ref, true);
65951 }
65952
65953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
65954         LDKAnchorDescriptor this_arg_conv;
65955         this_arg_conv.inner = untag_ptr(this_arg);
65956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65958         this_arg_conv.is_owned = false;
65959         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
65960         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
65961         return tag_ptr(ret_ref, true);
65962 }
65963
65964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
65965         LDKAnchorDescriptor this_arg_conv;
65966         this_arg_conv.inner = untag_ptr(this_arg);
65967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65969         this_arg_conv.is_owned = false;
65970         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
65971         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65972         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65973         CVec_u8Z_free(ret_var);
65974         return ret_arr;
65975 }
65976
65977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
65978         LDKAnchorDescriptor this_arg_conv;
65979         this_arg_conv.inner = untag_ptr(this_arg);
65980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65982         this_arg_conv.is_owned = false;
65983         LDKSignature signature_ref;
65984         CHECK((*env)->GetArrayLength(env, signature) == 64);
65985         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
65986         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
65987         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65988         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65989         Witness_free(ret_var);
65990         return ret_arr;
65991 }
65992
65993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t signer_provider) {
65994         LDKAnchorDescriptor this_arg_conv;
65995         this_arg_conv.inner = untag_ptr(this_arg);
65996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65998         this_arg_conv.is_owned = false;
65999         void* signer_provider_ptr = untag_ptr(signer_provider);
66000         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
66001         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
66002         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66003         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
66004         return tag_ptr(ret_ret, true);
66005 }
66006
66007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66008         LDKHTLCDescriptor this_obj_conv;
66009         this_obj_conv.inner = untag_ptr(this_obj);
66010         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66012         HTLCDescriptor_free(this_obj_conv);
66013 }
66014
66015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
66016         LDKHTLCDescriptor this_ptr_conv;
66017         this_ptr_conv.inner = untag_ptr(this_ptr);
66018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66020         this_ptr_conv.is_owned = false;
66021         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
66022         int64_t ret_ref = 0;
66023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66025         return ret_ref;
66026 }
66027
66028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66029         LDKHTLCDescriptor this_ptr_conv;
66030         this_ptr_conv.inner = untag_ptr(this_ptr);
66031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66033         this_ptr_conv.is_owned = false;
66034         LDKChannelDerivationParameters val_conv;
66035         val_conv.inner = untag_ptr(val);
66036         val_conv.is_owned = ptr_is_owned(val);
66037         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66038         val_conv = ChannelDerivationParameters_clone(&val_conv);
66039         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
66040 }
66041
66042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
66043         LDKHTLCDescriptor this_ptr_conv;
66044         this_ptr_conv.inner = untag_ptr(this_ptr);
66045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66047         this_ptr_conv.is_owned = false;
66048         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
66049         return ret_conv;
66050 }
66051
66052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66053         LDKHTLCDescriptor this_ptr_conv;
66054         this_ptr_conv.inner = untag_ptr(this_ptr);
66055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66057         this_ptr_conv.is_owned = false;
66058         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
66059 }
66060
66061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
66062         LDKHTLCDescriptor this_ptr_conv;
66063         this_ptr_conv.inner = untag_ptr(this_ptr);
66064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66066         this_ptr_conv.is_owned = false;
66067         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66068         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
66069         return ret_arr;
66070 }
66071
66072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66073         LDKHTLCDescriptor this_ptr_conv;
66074         this_ptr_conv.inner = untag_ptr(this_ptr);
66075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66077         this_ptr_conv.is_owned = false;
66078         LDKPublicKey val_ref;
66079         CHECK((*env)->GetArrayLength(env, val) == 33);
66080         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
66081         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
66082 }
66083
66084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
66085         LDKHTLCDescriptor this_ptr_conv;
66086         this_ptr_conv.inner = untag_ptr(this_ptr);
66087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66089         this_ptr_conv.is_owned = false;
66090         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
66091         int64_t ret_ref = 0;
66092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66094         return ret_ref;
66095 }
66096
66097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66098         LDKHTLCDescriptor this_ptr_conv;
66099         this_ptr_conv.inner = untag_ptr(this_ptr);
66100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66102         this_ptr_conv.is_owned = false;
66103         LDKHTLCOutputInCommitment val_conv;
66104         val_conv.inner = untag_ptr(val);
66105         val_conv.is_owned = ptr_is_owned(val);
66106         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66107         val_conv = HTLCOutputInCommitment_clone(&val_conv);
66108         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
66109 }
66110
66111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
66112         LDKHTLCDescriptor this_ptr_conv;
66113         this_ptr_conv.inner = untag_ptr(this_ptr);
66114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66116         this_ptr_conv.is_owned = false;
66117         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
66118         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
66119         int64_t ret_ref = tag_ptr(ret_copy, true);
66120         return ret_ref;
66121 }
66122
66123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66124         LDKHTLCDescriptor this_ptr_conv;
66125         this_ptr_conv.inner = untag_ptr(this_ptr);
66126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66128         this_ptr_conv.is_owned = false;
66129         void* val_ptr = untag_ptr(val);
66130         CHECK_ACCESS(val_ptr);
66131         LDKCOption_PaymentPreimageZ val_conv = *(LDKCOption_PaymentPreimageZ*)(val_ptr);
66132         val_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(val));
66133         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
66134 }
66135
66136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
66137         LDKHTLCDescriptor this_ptr_conv;
66138         this_ptr_conv.inner = untag_ptr(this_ptr);
66139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66141         this_ptr_conv.is_owned = false;
66142         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
66143         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
66144         return ret_arr;
66145 }
66146
66147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66148         LDKHTLCDescriptor this_ptr_conv;
66149         this_ptr_conv.inner = untag_ptr(this_ptr);
66150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66152         this_ptr_conv.is_owned = false;
66153         LDKSignature val_ref;
66154         CHECK((*env)->GetArrayLength(env, val) == 64);
66155         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
66156         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
66157 }
66158
66159 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
66160         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
66161         int64_t ret_ref = 0;
66162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66164         return ret_ref;
66165 }
66166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66167         LDKHTLCDescriptor arg_conv;
66168         arg_conv.inner = untag_ptr(arg);
66169         arg_conv.is_owned = ptr_is_owned(arg);
66170         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66171         arg_conv.is_owned = false;
66172         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
66173         return ret_conv;
66174 }
66175
66176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66177         LDKHTLCDescriptor orig_conv;
66178         orig_conv.inner = untag_ptr(orig);
66179         orig_conv.is_owned = ptr_is_owned(orig);
66180         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66181         orig_conv.is_owned = false;
66182         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
66183         int64_t ret_ref = 0;
66184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66186         return ret_ref;
66187 }
66188
66189 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66190         LDKHTLCDescriptor a_conv;
66191         a_conv.inner = untag_ptr(a);
66192         a_conv.is_owned = ptr_is_owned(a);
66193         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66194         a_conv.is_owned = false;
66195         LDKHTLCDescriptor b_conv;
66196         b_conv.inner = untag_ptr(b);
66197         b_conv.is_owned = ptr_is_owned(b);
66198         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66199         b_conv.is_owned = false;
66200         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
66201         return ret_conv;
66202 }
66203
66204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
66205         LDKHTLCDescriptor this_arg_conv;
66206         this_arg_conv.inner = untag_ptr(this_arg);
66207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66209         this_arg_conv.is_owned = false;
66210         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
66211         int64_t ret_ref = 0;
66212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66214         return ret_ref;
66215 }
66216
66217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
66218         LDKHTLCDescriptor this_arg_conv;
66219         this_arg_conv.inner = untag_ptr(this_arg);
66220         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66222         this_arg_conv.is_owned = false;
66223         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66224         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
66225         return tag_ptr(ret_ref, true);
66226 }
66227
66228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
66229         LDKHTLCDescriptor this_arg_conv;
66230         this_arg_conv.inner = untag_ptr(this_arg);
66231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66233         this_arg_conv.is_owned = false;
66234         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
66235         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
66236         return tag_ptr(ret_ref, true);
66237 }
66238
66239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
66240         LDKHTLCDescriptor this_arg_conv;
66241         this_arg_conv.inner = untag_ptr(this_arg);
66242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66244         this_arg_conv.is_owned = false;
66245         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66246         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
66247         return tag_ptr(ret_ref, true);
66248 }
66249
66250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66251         LDKHTLCDescriptor this_arg_conv;
66252         this_arg_conv.inner = untag_ptr(this_arg);
66253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66255         this_arg_conv.is_owned = false;
66256         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
66257         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66258         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66259         CVec_u8Z_free(ret_var);
66260         return ret_arr;
66261 }
66262
66263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature, int8_tArray witness_script) {
66264         LDKHTLCDescriptor this_arg_conv;
66265         this_arg_conv.inner = untag_ptr(this_arg);
66266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66268         this_arg_conv.is_owned = false;
66269         LDKSignature signature_ref;
66270         CHECK((*env)->GetArrayLength(env, signature) == 64);
66271         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
66272         LDKu8slice witness_script_ref;
66273         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
66274         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
66275         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
66276         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66277         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66278         Witness_free(ret_var);
66279         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
66280         return ret_arr;
66281 }
66282
66283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t signer_provider) {
66284         LDKHTLCDescriptor this_arg_conv;
66285         this_arg_conv.inner = untag_ptr(this_arg);
66286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66288         this_arg_conv.is_owned = false;
66289         void* signer_provider_ptr = untag_ptr(signer_provider);
66290         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
66291         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
66292         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66293         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
66294         return tag_ptr(ret_ret, true);
66295 }
66296
66297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66298         if (!ptr_is_owned(this_ptr)) return;
66299         void* this_ptr_ptr = untag_ptr(this_ptr);
66300         CHECK_ACCESS(this_ptr_ptr);
66301         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
66302         FREE(untag_ptr(this_ptr));
66303         BumpTransactionEvent_free(this_ptr_conv);
66304 }
66305
66306 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
66307         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66308         *ret_copy = BumpTransactionEvent_clone(arg);
66309         int64_t ret_ref = tag_ptr(ret_copy, true);
66310         return ret_ref;
66311 }
66312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66313         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
66314         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
66315         return ret_conv;
66316 }
66317
66318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66319         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
66320         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66321         *ret_copy = BumpTransactionEvent_clone(orig_conv);
66322         int64_t ret_ref = tag_ptr(ret_copy, true);
66323         return ret_ref;
66324 }
66325
66326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1channel_1close(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t package_target_feerate_sat_per_1000_weight, int8_tArray commitment_tx, int64_t commitment_tx_fee_satoshis, int64_t anchor_descriptor, int64_tArray pending_htlcs) {
66327         LDKThirtyTwoBytes claim_id_ref;
66328         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
66329         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
66330         LDKTransaction commitment_tx_ref;
66331         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
66332         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
66333         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
66334         commitment_tx_ref.data_is_owned = true;
66335         LDKAnchorDescriptor anchor_descriptor_conv;
66336         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
66337         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
66338         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
66339         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
66340         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
66341         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
66342         if (pending_htlcs_constr.datalen > 0)
66343                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
66344         else
66345                 pending_htlcs_constr.data = NULL;
66346         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
66347         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
66348                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
66349                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
66350                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
66351                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
66352                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
66353                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
66354                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
66355         }
66356         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
66357         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66358         *ret_copy = BumpTransactionEvent_channel_close(claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
66359         int64_t ret_ref = tag_ptr(ret_copy, true);
66360         return ret_ref;
66361 }
66362
66363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1htlcresolution(JNIEnv *env, jclass clz, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
66364         LDKThirtyTwoBytes claim_id_ref;
66365         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
66366         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
66367         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
66368         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
66369         if (htlc_descriptors_constr.datalen > 0)
66370                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
66371         else
66372                 htlc_descriptors_constr.data = NULL;
66373         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
66374         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
66375                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
66376                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
66377                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
66378                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
66379                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
66380                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
66381                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
66382         }
66383         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
66384         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66385         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
66386         int64_t ret_ref = tag_ptr(ret_copy, true);
66387         return ret_ref;
66388 }
66389
66390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66391         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
66392         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
66393         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
66394         return ret_conv;
66395 }
66396
66397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66398         LDKInput this_obj_conv;
66399         this_obj_conv.inner = untag_ptr(this_obj);
66400         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66402         Input_free(this_obj_conv);
66403 }
66404
66405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66406         LDKInput this_ptr_conv;
66407         this_ptr_conv.inner = untag_ptr(this_ptr);
66408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66410         this_ptr_conv.is_owned = false;
66411         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
66412         int64_t ret_ref = 0;
66413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66415         return ret_ref;
66416 }
66417
66418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66419         LDKInput this_ptr_conv;
66420         this_ptr_conv.inner = untag_ptr(this_ptr);
66421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66423         this_ptr_conv.is_owned = false;
66424         LDKOutPoint val_conv;
66425         val_conv.inner = untag_ptr(val);
66426         val_conv.is_owned = ptr_is_owned(val);
66427         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66428         val_conv = OutPoint_clone(&val_conv);
66429         Input_set_outpoint(&this_ptr_conv, val_conv);
66430 }
66431
66432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
66433         LDKInput this_ptr_conv;
66434         this_ptr_conv.inner = untag_ptr(this_ptr);
66435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66437         this_ptr_conv.is_owned = false;
66438         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66439         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
66440         return tag_ptr(ret_ref, true);
66441 }
66442
66443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66444         LDKInput this_ptr_conv;
66445         this_ptr_conv.inner = untag_ptr(this_ptr);
66446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66448         this_ptr_conv.is_owned = false;
66449         void* val_ptr = untag_ptr(val);
66450         CHECK_ACCESS(val_ptr);
66451         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66452         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66453         Input_set_previous_utxo(&this_ptr_conv, val_conv);
66454 }
66455
66456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
66457         LDKInput this_ptr_conv;
66458         this_ptr_conv.inner = untag_ptr(this_ptr);
66459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66461         this_ptr_conv.is_owned = false;
66462         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
66463         return ret_conv;
66464 }
66465
66466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66467         LDKInput this_ptr_conv;
66468         this_ptr_conv.inner = untag_ptr(this_ptr);
66469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66471         this_ptr_conv.is_owned = false;
66472         Input_set_satisfaction_weight(&this_ptr_conv, val);
66473 }
66474
66475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t previous_utxo_arg, int64_t satisfaction_weight_arg) {
66476         LDKOutPoint outpoint_arg_conv;
66477         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66478         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66479         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66480         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66481         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
66482         CHECK_ACCESS(previous_utxo_arg_ptr);
66483         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
66484         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
66485         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
66486         int64_t ret_ref = 0;
66487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66489         return ret_ref;
66490 }
66491
66492 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
66493         LDKInput ret_var = Input_clone(arg);
66494         int64_t ret_ref = 0;
66495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66497         return ret_ref;
66498 }
66499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66500         LDKInput arg_conv;
66501         arg_conv.inner = untag_ptr(arg);
66502         arg_conv.is_owned = ptr_is_owned(arg);
66503         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66504         arg_conv.is_owned = false;
66505         int64_t ret_conv = Input_clone_ptr(&arg_conv);
66506         return ret_conv;
66507 }
66508
66509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66510         LDKInput orig_conv;
66511         orig_conv.inner = untag_ptr(orig);
66512         orig_conv.is_owned = ptr_is_owned(orig);
66513         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66514         orig_conv.is_owned = false;
66515         LDKInput ret_var = Input_clone(&orig_conv);
66516         int64_t ret_ref = 0;
66517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66519         return ret_ref;
66520 }
66521
66522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
66523         LDKInput o_conv;
66524         o_conv.inner = untag_ptr(o);
66525         o_conv.is_owned = ptr_is_owned(o);
66526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66527         o_conv.is_owned = false;
66528         int64_t ret_conv = Input_hash(&o_conv);
66529         return ret_conv;
66530 }
66531
66532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66533         LDKInput a_conv;
66534         a_conv.inner = untag_ptr(a);
66535         a_conv.is_owned = ptr_is_owned(a);
66536         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66537         a_conv.is_owned = false;
66538         LDKInput b_conv;
66539         b_conv.inner = untag_ptr(b);
66540         b_conv.is_owned = ptr_is_owned(b);
66541         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66542         b_conv.is_owned = false;
66543         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
66544         return ret_conv;
66545 }
66546
66547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66548         LDKUtxo this_obj_conv;
66549         this_obj_conv.inner = untag_ptr(this_obj);
66550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66552         Utxo_free(this_obj_conv);
66553 }
66554
66555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66556         LDKUtxo this_ptr_conv;
66557         this_ptr_conv.inner = untag_ptr(this_ptr);
66558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66560         this_ptr_conv.is_owned = false;
66561         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
66562         int64_t ret_ref = 0;
66563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66565         return ret_ref;
66566 }
66567
66568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66569         LDKUtxo this_ptr_conv;
66570         this_ptr_conv.inner = untag_ptr(this_ptr);
66571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66573         this_ptr_conv.is_owned = false;
66574         LDKOutPoint val_conv;
66575         val_conv.inner = untag_ptr(val);
66576         val_conv.is_owned = ptr_is_owned(val);
66577         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66578         val_conv = OutPoint_clone(&val_conv);
66579         Utxo_set_outpoint(&this_ptr_conv, val_conv);
66580 }
66581
66582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
66583         LDKUtxo this_ptr_conv;
66584         this_ptr_conv.inner = untag_ptr(this_ptr);
66585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66587         this_ptr_conv.is_owned = false;
66588         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66589         *ret_ref = Utxo_get_output(&this_ptr_conv);
66590         return tag_ptr(ret_ref, true);
66591 }
66592
66593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66594         LDKUtxo this_ptr_conv;
66595         this_ptr_conv.inner = untag_ptr(this_ptr);
66596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66598         this_ptr_conv.is_owned = false;
66599         void* val_ptr = untag_ptr(val);
66600         CHECK_ACCESS(val_ptr);
66601         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66602         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66603         Utxo_set_output(&this_ptr_conv, val_conv);
66604 }
66605
66606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
66607         LDKUtxo this_ptr_conv;
66608         this_ptr_conv.inner = untag_ptr(this_ptr);
66609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66611         this_ptr_conv.is_owned = false;
66612         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
66613         return ret_conv;
66614 }
66615
66616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66617         LDKUtxo this_ptr_conv;
66618         this_ptr_conv.inner = untag_ptr(this_ptr);
66619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66621         this_ptr_conv.is_owned = false;
66622         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
66623 }
66624
66625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int64_t satisfaction_weight_arg) {
66626         LDKOutPoint outpoint_arg_conv;
66627         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66628         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66629         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66630         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66631         void* output_arg_ptr = untag_ptr(output_arg);
66632         CHECK_ACCESS(output_arg_ptr);
66633         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
66634         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
66635         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
66636         int64_t ret_ref = 0;
66637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66639         return ret_ref;
66640 }
66641
66642 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
66643         LDKUtxo ret_var = Utxo_clone(arg);
66644         int64_t ret_ref = 0;
66645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66647         return ret_ref;
66648 }
66649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66650         LDKUtxo arg_conv;
66651         arg_conv.inner = untag_ptr(arg);
66652         arg_conv.is_owned = ptr_is_owned(arg);
66653         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66654         arg_conv.is_owned = false;
66655         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
66656         return ret_conv;
66657 }
66658
66659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66660         LDKUtxo orig_conv;
66661         orig_conv.inner = untag_ptr(orig);
66662         orig_conv.is_owned = ptr_is_owned(orig);
66663         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66664         orig_conv.is_owned = false;
66665         LDKUtxo ret_var = Utxo_clone(&orig_conv);
66666         int64_t ret_ref = 0;
66667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66669         return ret_ref;
66670 }
66671
66672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
66673         LDKUtxo o_conv;
66674         o_conv.inner = untag_ptr(o);
66675         o_conv.is_owned = ptr_is_owned(o);
66676         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66677         o_conv.is_owned = false;
66678         int64_t ret_conv = Utxo_hash(&o_conv);
66679         return ret_conv;
66680 }
66681
66682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66683         LDKUtxo a_conv;
66684         a_conv.inner = untag_ptr(a);
66685         a_conv.is_owned = ptr_is_owned(a);
66686         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66687         a_conv.is_owned = false;
66688         LDKUtxo b_conv;
66689         b_conv.inner = untag_ptr(b);
66690         b_conv.is_owned = ptr_is_owned(b);
66691         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66692         b_conv.is_owned = false;
66693         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
66694         return ret_conv;
66695 }
66696
66697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1new_1p2pkh(JNIEnv *env, jclass clz, int64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
66698         LDKOutPoint outpoint_conv;
66699         outpoint_conv.inner = untag_ptr(outpoint);
66700         outpoint_conv.is_owned = ptr_is_owned(outpoint);
66701         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
66702         outpoint_conv = OutPoint_clone(&outpoint_conv);
66703         uint8_t pubkey_hash_arr[20];
66704         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
66705         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
66706         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
66707         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
66708         int64_t ret_ref = 0;
66709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66711         return ret_ref;
66712 }
66713
66714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66715         LDKCoinSelection this_obj_conv;
66716         this_obj_conv.inner = untag_ptr(this_obj);
66717         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66719         CoinSelection_free(this_obj_conv);
66720 }
66721
66722 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
66723         LDKCoinSelection this_ptr_conv;
66724         this_ptr_conv.inner = untag_ptr(this_ptr);
66725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66727         this_ptr_conv.is_owned = false;
66728         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
66729         int64_tArray ret_arr = NULL;
66730         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
66731         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
66732         for (size_t g = 0; g < ret_var.datalen; g++) {
66733                 LDKUtxo ret_conv_6_var = ret_var.data[g];
66734                 int64_t ret_conv_6_ref = 0;
66735                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
66736                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
66737                 ret_arr_ptr[g] = ret_conv_6_ref;
66738         }
66739         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
66740         FREE(ret_var.data);
66741         return ret_arr;
66742 }
66743
66744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
66745         LDKCoinSelection this_ptr_conv;
66746         this_ptr_conv.inner = untag_ptr(this_ptr);
66747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66749         this_ptr_conv.is_owned = false;
66750         LDKCVec_UtxoZ val_constr;
66751         val_constr.datalen = (*env)->GetArrayLength(env, val);
66752         if (val_constr.datalen > 0)
66753                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
66754         else
66755                 val_constr.data = NULL;
66756         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
66757         for (size_t g = 0; g < val_constr.datalen; g++) {
66758                 int64_t val_conv_6 = val_vals[g];
66759                 LDKUtxo val_conv_6_conv;
66760                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
66761                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
66762                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
66763                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
66764                 val_constr.data[g] = val_conv_6_conv;
66765         }
66766         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
66767         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
66768 }
66769
66770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
66771         LDKCoinSelection this_ptr_conv;
66772         this_ptr_conv.inner = untag_ptr(this_ptr);
66773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66775         this_ptr_conv.is_owned = false;
66776         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
66777         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
66778         int64_t ret_ref = tag_ptr(ret_copy, true);
66779         return ret_ref;
66780 }
66781
66782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66783         LDKCoinSelection this_ptr_conv;
66784         this_ptr_conv.inner = untag_ptr(this_ptr);
66785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66787         this_ptr_conv.is_owned = false;
66788         void* val_ptr = untag_ptr(val);
66789         CHECK_ACCESS(val_ptr);
66790         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
66791         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
66792         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
66793 }
66794
66795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1new(JNIEnv *env, jclass clz, int64_tArray confirmed_utxos_arg, int64_t change_output_arg) {
66796         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
66797         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
66798         if (confirmed_utxos_arg_constr.datalen > 0)
66799                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
66800         else
66801                 confirmed_utxos_arg_constr.data = NULL;
66802         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
66803         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
66804                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
66805                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
66806                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
66807                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
66808                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
66809                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
66810                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
66811         }
66812         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
66813         void* change_output_arg_ptr = untag_ptr(change_output_arg);
66814         CHECK_ACCESS(change_output_arg_ptr);
66815         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
66816         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
66817         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
66818         int64_t ret_ref = 0;
66819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66821         return ret_ref;
66822 }
66823
66824 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
66825         LDKCoinSelection ret_var = CoinSelection_clone(arg);
66826         int64_t ret_ref = 0;
66827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66829         return ret_ref;
66830 }
66831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66832         LDKCoinSelection arg_conv;
66833         arg_conv.inner = untag_ptr(arg);
66834         arg_conv.is_owned = ptr_is_owned(arg);
66835         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66836         arg_conv.is_owned = false;
66837         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
66838         return ret_conv;
66839 }
66840
66841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66842         LDKCoinSelection orig_conv;
66843         orig_conv.inner = untag_ptr(orig);
66844         orig_conv.is_owned = ptr_is_owned(orig);
66845         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66846         orig_conv.is_owned = false;
66847         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
66848         int64_t ret_ref = 0;
66849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66851         return ret_ref;
66852 }
66853
66854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66855         if (!ptr_is_owned(this_ptr)) return;
66856         void* this_ptr_ptr = untag_ptr(this_ptr);
66857         CHECK_ACCESS(this_ptr_ptr);
66858         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
66859         FREE(untag_ptr(this_ptr));
66860         CoinSelectionSource_free(this_ptr_conv);
66861 }
66862
66863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66864         if (!ptr_is_owned(this_ptr)) return;
66865         void* this_ptr_ptr = untag_ptr(this_ptr);
66866         CHECK_ACCESS(this_ptr_ptr);
66867         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
66868         FREE(untag_ptr(this_ptr));
66869         WalletSource_free(this_ptr_conv);
66870 }
66871
66872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66873         LDKWallet this_obj_conv;
66874         this_obj_conv.inner = untag_ptr(this_obj);
66875         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66877         Wallet_free(this_obj_conv);
66878 }
66879
66880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
66881         void* source_ptr = untag_ptr(source);
66882         CHECK_ACCESS(source_ptr);
66883         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
66884         if (source_conv.free == LDKWalletSource_JCalls_free) {
66885                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66886                 LDKWalletSource_JCalls_cloned(&source_conv);
66887         }
66888         void* logger_ptr = untag_ptr(logger);
66889         CHECK_ACCESS(logger_ptr);
66890         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66891         if (logger_conv.free == LDKLogger_JCalls_free) {
66892                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66893                 LDKLogger_JCalls_cloned(&logger_conv);
66894         }
66895         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
66896         int64_t ret_ref = 0;
66897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66899         return ret_ref;
66900 }
66901
66902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
66903         LDKWallet this_arg_conv;
66904         this_arg_conv.inner = untag_ptr(this_arg);
66905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66907         this_arg_conv.is_owned = false;
66908         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
66909         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
66910         return tag_ptr(ret_ret, true);
66911 }
66912
66913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66914         LDKBumpTransactionEventHandler this_obj_conv;
66915         this_obj_conv.inner = untag_ptr(this_obj);
66916         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66918         BumpTransactionEventHandler_free(this_obj_conv);
66919 }
66920
66921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1new(JNIEnv *env, jclass clz, int64_t broadcaster, int64_t utxo_source, int64_t signer_provider, int64_t logger) {
66922         void* broadcaster_ptr = untag_ptr(broadcaster);
66923         CHECK_ACCESS(broadcaster_ptr);
66924         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
66925         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
66926                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66927                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
66928         }
66929         void* utxo_source_ptr = untag_ptr(utxo_source);
66930         CHECK_ACCESS(utxo_source_ptr);
66931         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
66932         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
66933                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66934                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
66935         }
66936         void* signer_provider_ptr = untag_ptr(signer_provider);
66937         CHECK_ACCESS(signer_provider_ptr);
66938         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
66939         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
66940                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66941                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
66942         }
66943         void* logger_ptr = untag_ptr(logger);
66944         CHECK_ACCESS(logger_ptr);
66945         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66946         if (logger_conv.free == LDKLogger_JCalls_free) {
66947                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66948                 LDKLogger_JCalls_cloned(&logger_conv);
66949         }
66950         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
66951         int64_t ret_ref = 0;
66952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66954         return ret_ref;
66955 }
66956
66957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
66958         LDKBumpTransactionEventHandler this_arg_conv;
66959         this_arg_conv.inner = untag_ptr(this_arg);
66960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66962         this_arg_conv.is_owned = false;
66963         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
66964         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
66965 }
66966
66967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66968         LDKFilesystemPersister this_obj_conv;
66969         this_obj_conv.inner = untag_ptr(this_obj);
66970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66972         FilesystemPersister_free(this_obj_conv);
66973 }
66974
66975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
66976         LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
66977         LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
66978         int64_t ret_ref = 0;
66979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66981         return ret_ref;
66982 }
66983
66984 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
66985         LDKFilesystemPersister this_arg_conv;
66986         this_arg_conv.inner = untag_ptr(this_arg);
66987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66989         this_arg_conv.is_owned = false;
66990         LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
66991         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
66992         Str_free(ret_str);
66993         return ret_conv;
66994 }
66995
66996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t entropy_source, int64_t signer_provider) {
66997         LDKFilesystemPersister this_arg_conv;
66998         this_arg_conv.inner = untag_ptr(this_arg);
66999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67001         this_arg_conv.is_owned = false;
67002         void* entropy_source_ptr = untag_ptr(entropy_source);
67003         CHECK_ACCESS(entropy_source_ptr);
67004         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
67005         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
67006                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67007                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
67008         }
67009         void* signer_provider_ptr = untag_ptr(signer_provider);
67010         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
67011         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
67012         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
67013         *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, entropy_source_conv, signer_provider_conv);
67014         return tag_ptr(ret_conv, true);
67015 }
67016
67017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67018         LDKBackgroundProcessor this_obj_conv;
67019         this_obj_conv.inner = untag_ptr(this_obj);
67020         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67022         BackgroundProcessor_free(this_obj_conv);
67023 }
67024
67025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67026         if (!ptr_is_owned(this_ptr)) return;
67027         void* this_ptr_ptr = untag_ptr(this_ptr);
67028         CHECK_ACCESS(this_ptr_ptr);
67029         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
67030         FREE(untag_ptr(this_ptr));
67031         GossipSync_free(this_ptr_conv);
67032 }
67033
67034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
67035         LDKP2PGossipSync a_conv;
67036         a_conv.inner = untag_ptr(a);
67037         a_conv.is_owned = ptr_is_owned(a);
67038         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67039         a_conv.is_owned = false;
67040         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67041         *ret_copy = GossipSync_p2_p(&a_conv);
67042         int64_t ret_ref = tag_ptr(ret_copy, true);
67043         return ret_ref;
67044 }
67045
67046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
67047         LDKRapidGossipSync a_conv;
67048         a_conv.inner = untag_ptr(a);
67049         a_conv.is_owned = ptr_is_owned(a);
67050         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67051         a_conv.is_owned = false;
67052         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67053         *ret_copy = GossipSync_rapid(&a_conv);
67054         int64_t ret_ref = tag_ptr(ret_copy, true);
67055         return ret_ref;
67056 }
67057
67058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
67059         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67060         *ret_copy = GossipSync_none();
67061         int64_t ret_ref = tag_ptr(ret_copy, true);
67062         return ret_ref;
67063 }
67064
67065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t gossip_sync, int64_t peer_manager, int64_t logger, int64_t scorer) {
67066         void* persister_ptr = untag_ptr(persister);
67067         CHECK_ACCESS(persister_ptr);
67068         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
67069         if (persister_conv.free == LDKPersister_JCalls_free) {
67070                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67071                 LDKPersister_JCalls_cloned(&persister_conv);
67072         }
67073         void* event_handler_ptr = untag_ptr(event_handler);
67074         CHECK_ACCESS(event_handler_ptr);
67075         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
67076         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
67077                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67078                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
67079         }
67080         LDKChainMonitor chain_monitor_conv;
67081         chain_monitor_conv.inner = untag_ptr(chain_monitor);
67082         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
67083         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
67084         chain_monitor_conv.is_owned = false;
67085         LDKChannelManager channel_manager_conv;
67086         channel_manager_conv.inner = untag_ptr(channel_manager);
67087         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
67088         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
67089         channel_manager_conv.is_owned = false;
67090         void* gossip_sync_ptr = untag_ptr(gossip_sync);
67091         CHECK_ACCESS(gossip_sync_ptr);
67092         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
67093         // WARNING: we may need a move here but no clone is available for LDKGossipSync
67094         LDKPeerManager peer_manager_conv;
67095         peer_manager_conv.inner = untag_ptr(peer_manager);
67096         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
67097         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
67098         peer_manager_conv.is_owned = false;
67099         void* logger_ptr = untag_ptr(logger);
67100         CHECK_ACCESS(logger_ptr);
67101         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67102         if (logger_conv.free == LDKLogger_JCalls_free) {
67103                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67104                 LDKLogger_JCalls_cloned(&logger_conv);
67105         }
67106         void* scorer_ptr = untag_ptr(scorer);
67107         CHECK_ACCESS(scorer_ptr);
67108         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
67109         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
67110         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
67111                 // Manually implement clone for Java trait instances
67112                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
67113                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67114                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
67115                 }
67116         }
67117         LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, gossip_sync_conv, &peer_manager_conv, logger_conv, scorer_conv);
67118         int64_t ret_ref = 0;
67119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67121         return ret_ref;
67122 }
67123
67124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
67125         LDKBackgroundProcessor this_arg_conv;
67126         this_arg_conv.inner = untag_ptr(this_arg);
67127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67129         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
67130         
67131         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
67132         *ret_conv = BackgroundProcessor_join(this_arg_conv);
67133         return tag_ptr(ret_conv, true);
67134 }
67135
67136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
67137         LDKBackgroundProcessor this_arg_conv;
67138         this_arg_conv.inner = untag_ptr(this_arg);
67139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67141         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
67142         
67143         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
67144         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
67145         return tag_ptr(ret_conv, true);
67146 }
67147
67148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67149         if (!ptr_is_owned(this_ptr)) return;
67150         void* this_ptr_ptr = untag_ptr(this_ptr);
67151         CHECK_ACCESS(this_ptr_ptr);
67152         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
67153         FREE(untag_ptr(this_ptr));
67154         Bolt11ParseError_free(this_ptr_conv);
67155 }
67156
67157 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
67158         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67159         *ret_copy = Bolt11ParseError_clone(arg);
67160         int64_t ret_ref = tag_ptr(ret_copy, true);
67161         return ret_ref;
67162 }
67163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67164         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
67165         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
67166         return ret_conv;
67167 }
67168
67169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67170         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
67171         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67172         *ret_copy = Bolt11ParseError_clone(orig_conv);
67173         int64_t ret_ref = tag_ptr(ret_copy, true);
67174         return ret_ref;
67175 }
67176
67177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
67178         void* a_ptr = untag_ptr(a);
67179         CHECK_ACCESS(a_ptr);
67180         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
67181         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
67182         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67183         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
67184         int64_t ret_ref = tag_ptr(ret_copy, true);
67185         return ret_ref;
67186 }
67187
67188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
67189         
67190         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67191         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
67192         int64_t ret_ref = tag_ptr(ret_copy, true);
67193         return ret_ref;
67194 }
67195
67196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
67197         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
67198         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67199         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
67200         int64_t ret_ref = tag_ptr(ret_copy, true);
67201         return ret_ref;
67202 }
67203
67204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
67205         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67206         *ret_copy = Bolt11ParseError_bad_prefix();
67207         int64_t ret_ref = tag_ptr(ret_copy, true);
67208         return ret_ref;
67209 }
67210
67211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
67212         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67213         *ret_copy = Bolt11ParseError_unknown_currency();
67214         int64_t ret_ref = tag_ptr(ret_copy, true);
67215         return ret_ref;
67216 }
67217
67218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
67219         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67220         *ret_copy = Bolt11ParseError_unknown_si_prefix();
67221         int64_t ret_ref = tag_ptr(ret_copy, true);
67222         return ret_ref;
67223 }
67224
67225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
67226         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67227         *ret_copy = Bolt11ParseError_malformed_hrp();
67228         int64_t ret_ref = tag_ptr(ret_copy, true);
67229         return ret_ref;
67230 }
67231
67232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
67233         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67234         *ret_copy = Bolt11ParseError_too_short_data_part();
67235         int64_t ret_ref = tag_ptr(ret_copy, true);
67236         return ret_ref;
67237 }
67238
67239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
67240         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67241         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
67242         int64_t ret_ref = tag_ptr(ret_copy, true);
67243         return ret_ref;
67244 }
67245
67246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
67247         
67248         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67249         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
67250         int64_t ret_ref = tag_ptr(ret_copy, true);
67251         return ret_ref;
67252 }
67253
67254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
67255         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67256         *ret_copy = Bolt11ParseError_padding_error();
67257         int64_t ret_ref = tag_ptr(ret_copy, true);
67258         return ret_ref;
67259 }
67260
67261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
67262         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67263         *ret_copy = Bolt11ParseError_integer_overflow_error();
67264         int64_t ret_ref = tag_ptr(ret_copy, true);
67265         return ret_ref;
67266 }
67267
67268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
67269         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67270         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
67271         int64_t ret_ref = tag_ptr(ret_copy, true);
67272         return ret_ref;
67273 }
67274
67275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
67276         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67277         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
67278         int64_t ret_ref = tag_ptr(ret_copy, true);
67279         return ret_ref;
67280 }
67281
67282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
67283         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67284         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
67285         int64_t ret_ref = tag_ptr(ret_copy, true);
67286         return ret_ref;
67287 }
67288
67289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
67290         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67291         *ret_copy = Bolt11ParseError_invalid_recovery_id();
67292         int64_t ret_ref = tag_ptr(ret_copy, true);
67293         return ret_ref;
67294 }
67295
67296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
67297         LDKStr a_conv = java_to_owned_str(env, a);
67298         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67299         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
67300         int64_t ret_ref = tag_ptr(ret_copy, true);
67301         return ret_ref;
67302 }
67303
67304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
67305         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67306         *ret_copy = Bolt11ParseError_skip();
67307         int64_t ret_ref = tag_ptr(ret_copy, true);
67308         return ret_ref;
67309 }
67310
67311 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67312         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
67313         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
67314         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
67315         return ret_conv;
67316 }
67317
67318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67319         if (!ptr_is_owned(this_ptr)) return;
67320         void* this_ptr_ptr = untag_ptr(this_ptr);
67321         CHECK_ACCESS(this_ptr_ptr);
67322         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
67323         FREE(untag_ptr(this_ptr));
67324         ParseOrSemanticError_free(this_ptr_conv);
67325 }
67326
67327 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
67328         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67329         *ret_copy = ParseOrSemanticError_clone(arg);
67330         int64_t ret_ref = tag_ptr(ret_copy, true);
67331         return ret_ref;
67332 }
67333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67334         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
67335         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
67336         return ret_conv;
67337 }
67338
67339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67340         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
67341         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67342         *ret_copy = ParseOrSemanticError_clone(orig_conv);
67343         int64_t ret_ref = tag_ptr(ret_copy, true);
67344         return ret_ref;
67345 }
67346
67347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
67348         void* a_ptr = untag_ptr(a);
67349         CHECK_ACCESS(a_ptr);
67350         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
67351         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
67352         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67353         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
67354         int64_t ret_ref = tag_ptr(ret_copy, true);
67355         return ret_ref;
67356 }
67357
67358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
67359         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
67360         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67361         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
67362         int64_t ret_ref = tag_ptr(ret_copy, true);
67363         return ret_ref;
67364 }
67365
67366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67367         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
67368         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
67369         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
67370         return ret_conv;
67371 }
67372
67373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67374         LDKBolt11Invoice this_obj_conv;
67375         this_obj_conv.inner = untag_ptr(this_obj);
67376         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67378         Bolt11Invoice_free(this_obj_conv);
67379 }
67380
67381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67382         LDKBolt11Invoice a_conv;
67383         a_conv.inner = untag_ptr(a);
67384         a_conv.is_owned = ptr_is_owned(a);
67385         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67386         a_conv.is_owned = false;
67387         LDKBolt11Invoice b_conv;
67388         b_conv.inner = untag_ptr(b);
67389         b_conv.is_owned = ptr_is_owned(b);
67390         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67391         b_conv.is_owned = false;
67392         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
67393         return ret_conv;
67394 }
67395
67396 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
67397         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
67398         int64_t ret_ref = 0;
67399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67401         return ret_ref;
67402 }
67403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67404         LDKBolt11Invoice arg_conv;
67405         arg_conv.inner = untag_ptr(arg);
67406         arg_conv.is_owned = ptr_is_owned(arg);
67407         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67408         arg_conv.is_owned = false;
67409         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
67410         return ret_conv;
67411 }
67412
67413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67414         LDKBolt11Invoice orig_conv;
67415         orig_conv.inner = untag_ptr(orig);
67416         orig_conv.is_owned = ptr_is_owned(orig);
67417         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67418         orig_conv.is_owned = false;
67419         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
67420         int64_t ret_ref = 0;
67421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67423         return ret_ref;
67424 }
67425
67426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
67427         LDKBolt11Invoice o_conv;
67428         o_conv.inner = untag_ptr(o);
67429         o_conv.is_owned = ptr_is_owned(o);
67430         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67431         o_conv.is_owned = false;
67432         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
67433         return ret_conv;
67434 }
67435
67436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67437         LDKSignedRawBolt11Invoice this_obj_conv;
67438         this_obj_conv.inner = untag_ptr(this_obj);
67439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67441         SignedRawBolt11Invoice_free(this_obj_conv);
67442 }
67443
67444 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67445         LDKSignedRawBolt11Invoice a_conv;
67446         a_conv.inner = untag_ptr(a);
67447         a_conv.is_owned = ptr_is_owned(a);
67448         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67449         a_conv.is_owned = false;
67450         LDKSignedRawBolt11Invoice b_conv;
67451         b_conv.inner = untag_ptr(b);
67452         b_conv.is_owned = ptr_is_owned(b);
67453         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67454         b_conv.is_owned = false;
67455         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
67456         return ret_conv;
67457 }
67458
67459 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
67460         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
67461         int64_t ret_ref = 0;
67462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67464         return ret_ref;
67465 }
67466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67467         LDKSignedRawBolt11Invoice arg_conv;
67468         arg_conv.inner = untag_ptr(arg);
67469         arg_conv.is_owned = ptr_is_owned(arg);
67470         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67471         arg_conv.is_owned = false;
67472         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
67473         return ret_conv;
67474 }
67475
67476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67477         LDKSignedRawBolt11Invoice orig_conv;
67478         orig_conv.inner = untag_ptr(orig);
67479         orig_conv.is_owned = ptr_is_owned(orig);
67480         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67481         orig_conv.is_owned = false;
67482         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
67483         int64_t ret_ref = 0;
67484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67486         return ret_ref;
67487 }
67488
67489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
67490         LDKSignedRawBolt11Invoice o_conv;
67491         o_conv.inner = untag_ptr(o);
67492         o_conv.is_owned = ptr_is_owned(o);
67493         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67494         o_conv.is_owned = false;
67495         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
67496         return ret_conv;
67497 }
67498
67499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67500         LDKRawBolt11Invoice this_obj_conv;
67501         this_obj_conv.inner = untag_ptr(this_obj);
67502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67504         RawBolt11Invoice_free(this_obj_conv);
67505 }
67506
67507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
67508         LDKRawBolt11Invoice this_ptr_conv;
67509         this_ptr_conv.inner = untag_ptr(this_ptr);
67510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67512         this_ptr_conv.is_owned = false;
67513         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
67514         int64_t ret_ref = 0;
67515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67517         return ret_ref;
67518 }
67519
67520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67521         LDKRawBolt11Invoice this_ptr_conv;
67522         this_ptr_conv.inner = untag_ptr(this_ptr);
67523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67525         this_ptr_conv.is_owned = false;
67526         LDKRawDataPart val_conv;
67527         val_conv.inner = untag_ptr(val);
67528         val_conv.is_owned = ptr_is_owned(val);
67529         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67530         val_conv = RawDataPart_clone(&val_conv);
67531         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
67532 }
67533
67534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67535         LDKRawBolt11Invoice a_conv;
67536         a_conv.inner = untag_ptr(a);
67537         a_conv.is_owned = ptr_is_owned(a);
67538         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67539         a_conv.is_owned = false;
67540         LDKRawBolt11Invoice b_conv;
67541         b_conv.inner = untag_ptr(b);
67542         b_conv.is_owned = ptr_is_owned(b);
67543         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67544         b_conv.is_owned = false;
67545         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
67546         return ret_conv;
67547 }
67548
67549 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
67550         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
67551         int64_t ret_ref = 0;
67552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67554         return ret_ref;
67555 }
67556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67557         LDKRawBolt11Invoice arg_conv;
67558         arg_conv.inner = untag_ptr(arg);
67559         arg_conv.is_owned = ptr_is_owned(arg);
67560         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67561         arg_conv.is_owned = false;
67562         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
67563         return ret_conv;
67564 }
67565
67566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67567         LDKRawBolt11Invoice orig_conv;
67568         orig_conv.inner = untag_ptr(orig);
67569         orig_conv.is_owned = ptr_is_owned(orig);
67570         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67571         orig_conv.is_owned = false;
67572         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
67573         int64_t ret_ref = 0;
67574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67576         return ret_ref;
67577 }
67578
67579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
67580         LDKRawBolt11Invoice o_conv;
67581         o_conv.inner = untag_ptr(o);
67582         o_conv.is_owned = ptr_is_owned(o);
67583         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67584         o_conv.is_owned = false;
67585         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
67586         return ret_conv;
67587 }
67588
67589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67590         LDKRawDataPart this_obj_conv;
67591         this_obj_conv.inner = untag_ptr(this_obj);
67592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67594         RawDataPart_free(this_obj_conv);
67595 }
67596
67597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
67598         LDKRawDataPart this_ptr_conv;
67599         this_ptr_conv.inner = untag_ptr(this_ptr);
67600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67602         this_ptr_conv.is_owned = false;
67603         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
67604         int64_t ret_ref = 0;
67605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67607         return ret_ref;
67608 }
67609
67610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67611         LDKRawDataPart this_ptr_conv;
67612         this_ptr_conv.inner = untag_ptr(this_ptr);
67613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67615         this_ptr_conv.is_owned = false;
67616         LDKPositiveTimestamp val_conv;
67617         val_conv.inner = untag_ptr(val);
67618         val_conv.is_owned = ptr_is_owned(val);
67619         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67620         val_conv = PositiveTimestamp_clone(&val_conv);
67621         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
67622 }
67623
67624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67625         LDKRawDataPart a_conv;
67626         a_conv.inner = untag_ptr(a);
67627         a_conv.is_owned = ptr_is_owned(a);
67628         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67629         a_conv.is_owned = false;
67630         LDKRawDataPart b_conv;
67631         b_conv.inner = untag_ptr(b);
67632         b_conv.is_owned = ptr_is_owned(b);
67633         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67634         b_conv.is_owned = false;
67635         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
67636         return ret_conv;
67637 }
67638
67639 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
67640         LDKRawDataPart ret_var = RawDataPart_clone(arg);
67641         int64_t ret_ref = 0;
67642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67644         return ret_ref;
67645 }
67646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67647         LDKRawDataPart arg_conv;
67648         arg_conv.inner = untag_ptr(arg);
67649         arg_conv.is_owned = ptr_is_owned(arg);
67650         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67651         arg_conv.is_owned = false;
67652         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
67653         return ret_conv;
67654 }
67655
67656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67657         LDKRawDataPart orig_conv;
67658         orig_conv.inner = untag_ptr(orig);
67659         orig_conv.is_owned = ptr_is_owned(orig);
67660         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67661         orig_conv.is_owned = false;
67662         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
67663         int64_t ret_ref = 0;
67664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67666         return ret_ref;
67667 }
67668
67669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
67670         LDKRawDataPart o_conv;
67671         o_conv.inner = untag_ptr(o);
67672         o_conv.is_owned = ptr_is_owned(o);
67673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67674         o_conv.is_owned = false;
67675         int64_t ret_conv = RawDataPart_hash(&o_conv);
67676         return ret_conv;
67677 }
67678
67679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67680         LDKPositiveTimestamp this_obj_conv;
67681         this_obj_conv.inner = untag_ptr(this_obj);
67682         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67684         PositiveTimestamp_free(this_obj_conv);
67685 }
67686
67687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67688         LDKPositiveTimestamp a_conv;
67689         a_conv.inner = untag_ptr(a);
67690         a_conv.is_owned = ptr_is_owned(a);
67691         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67692         a_conv.is_owned = false;
67693         LDKPositiveTimestamp b_conv;
67694         b_conv.inner = untag_ptr(b);
67695         b_conv.is_owned = ptr_is_owned(b);
67696         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67697         b_conv.is_owned = false;
67698         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
67699         return ret_conv;
67700 }
67701
67702 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
67703         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
67704         int64_t ret_ref = 0;
67705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67707         return ret_ref;
67708 }
67709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67710         LDKPositiveTimestamp arg_conv;
67711         arg_conv.inner = untag_ptr(arg);
67712         arg_conv.is_owned = ptr_is_owned(arg);
67713         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67714         arg_conv.is_owned = false;
67715         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
67716         return ret_conv;
67717 }
67718
67719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67720         LDKPositiveTimestamp orig_conv;
67721         orig_conv.inner = untag_ptr(orig);
67722         orig_conv.is_owned = ptr_is_owned(orig);
67723         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67724         orig_conv.is_owned = false;
67725         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
67726         int64_t ret_ref = 0;
67727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67729         return ret_ref;
67730 }
67731
67732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
67733         LDKPositiveTimestamp o_conv;
67734         o_conv.inner = untag_ptr(o);
67735         o_conv.is_owned = ptr_is_owned(o);
67736         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67737         o_conv.is_owned = false;
67738         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
67739         return ret_conv;
67740 }
67741
67742 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67743         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
67744         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
67745         return ret_conv;
67746 }
67747
67748 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
67749         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
67750         return ret_conv;
67751 }
67752
67753 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
67754         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
67755         return ret_conv;
67756 }
67757
67758 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
67759         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
67760         return ret_conv;
67761 }
67762
67763 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
67764         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
67765         return ret_conv;
67766 }
67767
67768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67769         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
67770         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
67771         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
67772         return ret_conv;
67773 }
67774
67775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
67776         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
67777         int64_t ret_conv = SiPrefix_hash(o_conv);
67778         return ret_conv;
67779 }
67780
67781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
67782         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
67783         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
67784         return ret_conv;
67785 }
67786
67787 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67788         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
67789         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
67790         return ret_conv;
67791 }
67792
67793 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
67794         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
67795         return ret_conv;
67796 }
67797
67798 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
67799         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
67800         return ret_conv;
67801 }
67802
67803 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
67804         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
67805         return ret_conv;
67806 }
67807
67808 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
67809         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
67810         return ret_conv;
67811 }
67812
67813 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
67814         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
67815         return ret_conv;
67816 }
67817
67818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
67819         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
67820         int64_t ret_conv = Currency_hash(o_conv);
67821         return ret_conv;
67822 }
67823
67824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67825         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
67826         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
67827         jboolean ret_conv = Currency_eq(a_conv, b_conv);
67828         return ret_conv;
67829 }
67830
67831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67832         LDKSha256 this_obj_conv;
67833         this_obj_conv.inner = untag_ptr(this_obj);
67834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67836         Sha256_free(this_obj_conv);
67837 }
67838
67839 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
67840         LDKSha256 ret_var = Sha256_clone(arg);
67841         int64_t ret_ref = 0;
67842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67844         return ret_ref;
67845 }
67846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67847         LDKSha256 arg_conv;
67848         arg_conv.inner = untag_ptr(arg);
67849         arg_conv.is_owned = ptr_is_owned(arg);
67850         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67851         arg_conv.is_owned = false;
67852         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
67853         return ret_conv;
67854 }
67855
67856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67857         LDKSha256 orig_conv;
67858         orig_conv.inner = untag_ptr(orig);
67859         orig_conv.is_owned = ptr_is_owned(orig);
67860         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67861         orig_conv.is_owned = false;
67862         LDKSha256 ret_var = Sha256_clone(&orig_conv);
67863         int64_t ret_ref = 0;
67864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67866         return ret_ref;
67867 }
67868
67869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
67870         LDKSha256 o_conv;
67871         o_conv.inner = untag_ptr(o);
67872         o_conv.is_owned = ptr_is_owned(o);
67873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67874         o_conv.is_owned = false;
67875         int64_t ret_conv = Sha256_hash(&o_conv);
67876         return ret_conv;
67877 }
67878
67879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67880         LDKSha256 a_conv;
67881         a_conv.inner = untag_ptr(a);
67882         a_conv.is_owned = ptr_is_owned(a);
67883         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67884         a_conv.is_owned = false;
67885         LDKSha256 b_conv;
67886         b_conv.inner = untag_ptr(b);
67887         b_conv.is_owned = ptr_is_owned(b);
67888         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67889         b_conv.is_owned = false;
67890         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
67891         return ret_conv;
67892 }
67893
67894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
67895         uint8_t bytes_arr[32];
67896         CHECK((*env)->GetArrayLength(env, bytes) == 32);
67897         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
67898         uint8_t (*bytes_ref)[32] = &bytes_arr;
67899         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
67900         int64_t ret_ref = 0;
67901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67903         return ret_ref;
67904 }
67905
67906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67907         LDKDescription this_obj_conv;
67908         this_obj_conv.inner = untag_ptr(this_obj);
67909         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67911         Description_free(this_obj_conv);
67912 }
67913
67914 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
67915         LDKDescription ret_var = Description_clone(arg);
67916         int64_t ret_ref = 0;
67917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67919         return ret_ref;
67920 }
67921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67922         LDKDescription arg_conv;
67923         arg_conv.inner = untag_ptr(arg);
67924         arg_conv.is_owned = ptr_is_owned(arg);
67925         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67926         arg_conv.is_owned = false;
67927         int64_t ret_conv = Description_clone_ptr(&arg_conv);
67928         return ret_conv;
67929 }
67930
67931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67932         LDKDescription orig_conv;
67933         orig_conv.inner = untag_ptr(orig);
67934         orig_conv.is_owned = ptr_is_owned(orig);
67935         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67936         orig_conv.is_owned = false;
67937         LDKDescription ret_var = Description_clone(&orig_conv);
67938         int64_t ret_ref = 0;
67939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67941         return ret_ref;
67942 }
67943
67944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
67945         LDKDescription o_conv;
67946         o_conv.inner = untag_ptr(o);
67947         o_conv.is_owned = ptr_is_owned(o);
67948         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67949         o_conv.is_owned = false;
67950         int64_t ret_conv = Description_hash(&o_conv);
67951         return ret_conv;
67952 }
67953
67954 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67955         LDKDescription a_conv;
67956         a_conv.inner = untag_ptr(a);
67957         a_conv.is_owned = ptr_is_owned(a);
67958         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67959         a_conv.is_owned = false;
67960         LDKDescription b_conv;
67961         b_conv.inner = untag_ptr(b);
67962         b_conv.is_owned = ptr_is_owned(b);
67963         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67964         b_conv.is_owned = false;
67965         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
67966         return ret_conv;
67967 }
67968
67969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67970         LDKPayeePubKey this_obj_conv;
67971         this_obj_conv.inner = untag_ptr(this_obj);
67972         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67974         PayeePubKey_free(this_obj_conv);
67975 }
67976
67977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
67978         LDKPayeePubKey this_ptr_conv;
67979         this_ptr_conv.inner = untag_ptr(this_ptr);
67980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67982         this_ptr_conv.is_owned = false;
67983         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67984         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
67985         return ret_arr;
67986 }
67987
67988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67989         LDKPayeePubKey this_ptr_conv;
67990         this_ptr_conv.inner = untag_ptr(this_ptr);
67991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67993         this_ptr_conv.is_owned = false;
67994         LDKPublicKey val_ref;
67995         CHECK((*env)->GetArrayLength(env, val) == 33);
67996         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
67997         PayeePubKey_set_a(&this_ptr_conv, val_ref);
67998 }
67999
68000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
68001         LDKPublicKey a_arg_ref;
68002         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
68003         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
68004         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
68005         int64_t ret_ref = 0;
68006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68008         return ret_ref;
68009 }
68010
68011 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
68012         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
68013         int64_t ret_ref = 0;
68014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68016         return ret_ref;
68017 }
68018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68019         LDKPayeePubKey arg_conv;
68020         arg_conv.inner = untag_ptr(arg);
68021         arg_conv.is_owned = ptr_is_owned(arg);
68022         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68023         arg_conv.is_owned = false;
68024         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
68025         return ret_conv;
68026 }
68027
68028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68029         LDKPayeePubKey orig_conv;
68030         orig_conv.inner = untag_ptr(orig);
68031         orig_conv.is_owned = ptr_is_owned(orig);
68032         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68033         orig_conv.is_owned = false;
68034         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
68035         int64_t ret_ref = 0;
68036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68038         return ret_ref;
68039 }
68040
68041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
68042         LDKPayeePubKey o_conv;
68043         o_conv.inner = untag_ptr(o);
68044         o_conv.is_owned = ptr_is_owned(o);
68045         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68046         o_conv.is_owned = false;
68047         int64_t ret_conv = PayeePubKey_hash(&o_conv);
68048         return ret_conv;
68049 }
68050
68051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68052         LDKPayeePubKey a_conv;
68053         a_conv.inner = untag_ptr(a);
68054         a_conv.is_owned = ptr_is_owned(a);
68055         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68056         a_conv.is_owned = false;
68057         LDKPayeePubKey b_conv;
68058         b_conv.inner = untag_ptr(b);
68059         b_conv.is_owned = ptr_is_owned(b);
68060         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68061         b_conv.is_owned = false;
68062         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
68063         return ret_conv;
68064 }
68065
68066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68067         LDKExpiryTime this_obj_conv;
68068         this_obj_conv.inner = untag_ptr(this_obj);
68069         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68071         ExpiryTime_free(this_obj_conv);
68072 }
68073
68074 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
68075         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
68076         int64_t ret_ref = 0;
68077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68079         return ret_ref;
68080 }
68081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68082         LDKExpiryTime arg_conv;
68083         arg_conv.inner = untag_ptr(arg);
68084         arg_conv.is_owned = ptr_is_owned(arg);
68085         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68086         arg_conv.is_owned = false;
68087         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
68088         return ret_conv;
68089 }
68090
68091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68092         LDKExpiryTime orig_conv;
68093         orig_conv.inner = untag_ptr(orig);
68094         orig_conv.is_owned = ptr_is_owned(orig);
68095         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68096         orig_conv.is_owned = false;
68097         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
68098         int64_t ret_ref = 0;
68099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68101         return ret_ref;
68102 }
68103
68104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
68105         LDKExpiryTime o_conv;
68106         o_conv.inner = untag_ptr(o);
68107         o_conv.is_owned = ptr_is_owned(o);
68108         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68109         o_conv.is_owned = false;
68110         int64_t ret_conv = ExpiryTime_hash(&o_conv);
68111         return ret_conv;
68112 }
68113
68114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68115         LDKExpiryTime a_conv;
68116         a_conv.inner = untag_ptr(a);
68117         a_conv.is_owned = ptr_is_owned(a);
68118         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68119         a_conv.is_owned = false;
68120         LDKExpiryTime b_conv;
68121         b_conv.inner = untag_ptr(b);
68122         b_conv.is_owned = ptr_is_owned(b);
68123         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68124         b_conv.is_owned = false;
68125         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
68126         return ret_conv;
68127 }
68128
68129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68130         LDKMinFinalCltvExpiryDelta this_obj_conv;
68131         this_obj_conv.inner = untag_ptr(this_obj);
68132         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68134         MinFinalCltvExpiryDelta_free(this_obj_conv);
68135 }
68136
68137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
68138         LDKMinFinalCltvExpiryDelta this_ptr_conv;
68139         this_ptr_conv.inner = untag_ptr(this_ptr);
68140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68142         this_ptr_conv.is_owned = false;
68143         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
68144         return ret_conv;
68145 }
68146
68147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68148         LDKMinFinalCltvExpiryDelta this_ptr_conv;
68149         this_ptr_conv.inner = untag_ptr(this_ptr);
68150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68152         this_ptr_conv.is_owned = false;
68153         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
68154 }
68155
68156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
68157         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
68158         int64_t ret_ref = 0;
68159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68161         return ret_ref;
68162 }
68163
68164 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
68165         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
68166         int64_t ret_ref = 0;
68167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68169         return ret_ref;
68170 }
68171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68172         LDKMinFinalCltvExpiryDelta arg_conv;
68173         arg_conv.inner = untag_ptr(arg);
68174         arg_conv.is_owned = ptr_is_owned(arg);
68175         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68176         arg_conv.is_owned = false;
68177         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
68178         return ret_conv;
68179 }
68180
68181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68182         LDKMinFinalCltvExpiryDelta orig_conv;
68183         orig_conv.inner = untag_ptr(orig);
68184         orig_conv.is_owned = ptr_is_owned(orig);
68185         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68186         orig_conv.is_owned = false;
68187         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
68188         int64_t ret_ref = 0;
68189         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68190         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68191         return ret_ref;
68192 }
68193
68194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
68195         LDKMinFinalCltvExpiryDelta o_conv;
68196         o_conv.inner = untag_ptr(o);
68197         o_conv.is_owned = ptr_is_owned(o);
68198         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68199         o_conv.is_owned = false;
68200         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
68201         return ret_conv;
68202 }
68203
68204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68205         LDKMinFinalCltvExpiryDelta a_conv;
68206         a_conv.inner = untag_ptr(a);
68207         a_conv.is_owned = ptr_is_owned(a);
68208         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68209         a_conv.is_owned = false;
68210         LDKMinFinalCltvExpiryDelta b_conv;
68211         b_conv.inner = untag_ptr(b);
68212         b_conv.is_owned = ptr_is_owned(b);
68213         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68214         b_conv.is_owned = false;
68215         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
68216         return ret_conv;
68217 }
68218
68219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68220         if (!ptr_is_owned(this_ptr)) return;
68221         void* this_ptr_ptr = untag_ptr(this_ptr);
68222         CHECK_ACCESS(this_ptr_ptr);
68223         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
68224         FREE(untag_ptr(this_ptr));
68225         Fallback_free(this_ptr_conv);
68226 }
68227
68228 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
68229         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68230         *ret_copy = Fallback_clone(arg);
68231         int64_t ret_ref = tag_ptr(ret_copy, true);
68232         return ret_ref;
68233 }
68234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68235         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
68236         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
68237         return ret_conv;
68238 }
68239
68240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68241         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
68242         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68243         *ret_copy = Fallback_clone(orig_conv);
68244         int64_t ret_ref = tag_ptr(ret_copy, true);
68245         return ret_ref;
68246 }
68247
68248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
68249         
68250         LDKCVec_u8Z program_ref;
68251         program_ref.datalen = (*env)->GetArrayLength(env, program);
68252         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
68253         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
68254         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68255         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
68256         int64_t ret_ref = tag_ptr(ret_copy, true);
68257         return ret_ref;
68258 }
68259
68260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
68261         LDKTwentyBytes a_ref;
68262         CHECK((*env)->GetArrayLength(env, a) == 20);
68263         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
68264         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68265         *ret_copy = Fallback_pub_key_hash(a_ref);
68266         int64_t ret_ref = tag_ptr(ret_copy, true);
68267         return ret_ref;
68268 }
68269
68270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
68271         LDKTwentyBytes a_ref;
68272         CHECK((*env)->GetArrayLength(env, a) == 20);
68273         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
68274         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68275         *ret_copy = Fallback_script_hash(a_ref);
68276         int64_t ret_ref = tag_ptr(ret_copy, true);
68277         return ret_ref;
68278 }
68279
68280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
68281         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
68282         int64_t ret_conv = Fallback_hash(o_conv);
68283         return ret_conv;
68284 }
68285
68286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68287         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
68288         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
68289         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
68290         return ret_conv;
68291 }
68292
68293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68294         LDKBolt11InvoiceSignature this_obj_conv;
68295         this_obj_conv.inner = untag_ptr(this_obj);
68296         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68298         Bolt11InvoiceSignature_free(this_obj_conv);
68299 }
68300
68301 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
68302         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
68303         int64_t ret_ref = 0;
68304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68306         return ret_ref;
68307 }
68308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68309         LDKBolt11InvoiceSignature arg_conv;
68310         arg_conv.inner = untag_ptr(arg);
68311         arg_conv.is_owned = ptr_is_owned(arg);
68312         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68313         arg_conv.is_owned = false;
68314         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
68315         return ret_conv;
68316 }
68317
68318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68319         LDKBolt11InvoiceSignature orig_conv;
68320         orig_conv.inner = untag_ptr(orig);
68321         orig_conv.is_owned = ptr_is_owned(orig);
68322         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68323         orig_conv.is_owned = false;
68324         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
68325         int64_t ret_ref = 0;
68326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68328         return ret_ref;
68329 }
68330
68331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
68332         LDKBolt11InvoiceSignature o_conv;
68333         o_conv.inner = untag_ptr(o);
68334         o_conv.is_owned = ptr_is_owned(o);
68335         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68336         o_conv.is_owned = false;
68337         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
68338         return ret_conv;
68339 }
68340
68341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68342         LDKBolt11InvoiceSignature a_conv;
68343         a_conv.inner = untag_ptr(a);
68344         a_conv.is_owned = ptr_is_owned(a);
68345         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68346         a_conv.is_owned = false;
68347         LDKBolt11InvoiceSignature b_conv;
68348         b_conv.inner = untag_ptr(b);
68349         b_conv.is_owned = ptr_is_owned(b);
68350         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68351         b_conv.is_owned = false;
68352         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
68353         return ret_conv;
68354 }
68355
68356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68357         LDKPrivateRoute this_obj_conv;
68358         this_obj_conv.inner = untag_ptr(this_obj);
68359         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68361         PrivateRoute_free(this_obj_conv);
68362 }
68363
68364 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
68365         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
68366         int64_t ret_ref = 0;
68367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68369         return ret_ref;
68370 }
68371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68372         LDKPrivateRoute arg_conv;
68373         arg_conv.inner = untag_ptr(arg);
68374         arg_conv.is_owned = ptr_is_owned(arg);
68375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68376         arg_conv.is_owned = false;
68377         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
68378         return ret_conv;
68379 }
68380
68381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68382         LDKPrivateRoute orig_conv;
68383         orig_conv.inner = untag_ptr(orig);
68384         orig_conv.is_owned = ptr_is_owned(orig);
68385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68386         orig_conv.is_owned = false;
68387         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
68388         int64_t ret_ref = 0;
68389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68391         return ret_ref;
68392 }
68393
68394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
68395         LDKPrivateRoute o_conv;
68396         o_conv.inner = untag_ptr(o);
68397         o_conv.is_owned = ptr_is_owned(o);
68398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68399         o_conv.is_owned = false;
68400         int64_t ret_conv = PrivateRoute_hash(&o_conv);
68401         return ret_conv;
68402 }
68403
68404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68405         LDKPrivateRoute a_conv;
68406         a_conv.inner = untag_ptr(a);
68407         a_conv.is_owned = ptr_is_owned(a);
68408         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68409         a_conv.is_owned = false;
68410         LDKPrivateRoute b_conv;
68411         b_conv.inner = untag_ptr(b);
68412         b_conv.is_owned = ptr_is_owned(b);
68413         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68414         b_conv.is_owned = false;
68415         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
68416         return ret_conv;
68417 }
68418
68419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
68420         LDKSignedRawBolt11Invoice this_arg_conv;
68421         this_arg_conv.inner = untag_ptr(this_arg);
68422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68424         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
68425         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
68426         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
68427         return tag_ptr(ret_conv, true);
68428 }
68429
68430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
68431         LDKSignedRawBolt11Invoice this_arg_conv;
68432         this_arg_conv.inner = untag_ptr(this_arg);
68433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68435         this_arg_conv.is_owned = false;
68436         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
68437         int64_t ret_ref = 0;
68438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68440         return ret_ref;
68441 }
68442
68443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68444         LDKSignedRawBolt11Invoice this_arg_conv;
68445         this_arg_conv.inner = untag_ptr(this_arg);
68446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68448         this_arg_conv.is_owned = false;
68449         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68450         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
68451         return ret_arr;
68452 }
68453
68454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
68455         LDKSignedRawBolt11Invoice this_arg_conv;
68456         this_arg_conv.inner = untag_ptr(this_arg);
68457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68459         this_arg_conv.is_owned = false;
68460         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
68461         int64_t ret_ref = 0;
68462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68464         return ret_ref;
68465 }
68466
68467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68468         LDKSignedRawBolt11Invoice this_arg_conv;
68469         this_arg_conv.inner = untag_ptr(this_arg);
68470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68472         this_arg_conv.is_owned = false;
68473         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
68474         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
68475         return tag_ptr(ret_conv, true);
68476 }
68477
68478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
68479         LDKSignedRawBolt11Invoice this_arg_conv;
68480         this_arg_conv.inner = untag_ptr(this_arg);
68481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68483         this_arg_conv.is_owned = false;
68484         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
68485         return ret_conv;
68486 }
68487
68488 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68489         LDKRawBolt11Invoice this_arg_conv;
68490         this_arg_conv.inner = untag_ptr(this_arg);
68491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68493         this_arg_conv.is_owned = false;
68494         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68495         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
68496         return ret_arr;
68497 }
68498
68499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68500         LDKRawBolt11Invoice this_arg_conv;
68501         this_arg_conv.inner = untag_ptr(this_arg);
68502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68504         this_arg_conv.is_owned = false;
68505         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
68506         int64_t ret_ref = 0;
68507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68509         return ret_ref;
68510 }
68511
68512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
68513         LDKRawBolt11Invoice this_arg_conv;
68514         this_arg_conv.inner = untag_ptr(this_arg);
68515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68517         this_arg_conv.is_owned = false;
68518         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
68519         int64_t ret_ref = 0;
68520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68522         return ret_ref;
68523 }
68524
68525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68526         LDKRawBolt11Invoice this_arg_conv;
68527         this_arg_conv.inner = untag_ptr(this_arg);
68528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68530         this_arg_conv.is_owned = false;
68531         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
68532         int64_t ret_ref = 0;
68533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68535         return ret_ref;
68536 }
68537
68538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68539         LDKRawBolt11Invoice this_arg_conv;
68540         this_arg_conv.inner = untag_ptr(this_arg);
68541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68543         this_arg_conv.is_owned = false;
68544         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
68545         int64_t ret_ref = 0;
68546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68548         return ret_ref;
68549 }
68550
68551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
68552         LDKRawBolt11Invoice this_arg_conv;
68553         this_arg_conv.inner = untag_ptr(this_arg);
68554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68556         this_arg_conv.is_owned = false;
68557         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
68558         int64_t ret_ref = 0;
68559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68561         return ret_ref;
68562 }
68563
68564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
68565         LDKRawBolt11Invoice this_arg_conv;
68566         this_arg_conv.inner = untag_ptr(this_arg);
68567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68569         this_arg_conv.is_owned = false;
68570         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
68571         int64_t ret_ref = 0;
68572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68574         return ret_ref;
68575 }
68576
68577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68578         LDKRawBolt11Invoice this_arg_conv;
68579         this_arg_conv.inner = untag_ptr(this_arg);
68580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68582         this_arg_conv.is_owned = false;
68583         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
68584         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
68585         int64_t ret_ref = tag_ptr(ret_copy, true);
68586         return ret_ref;
68587 }
68588
68589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
68590         LDKRawBolt11Invoice this_arg_conv;
68591         this_arg_conv.inner = untag_ptr(this_arg);
68592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68594         this_arg_conv.is_owned = false;
68595         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68596         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
68597         int64_t ret_ref = tag_ptr(ret_copy, true);
68598         return ret_ref;
68599 }
68600
68601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
68602         LDKRawBolt11Invoice this_arg_conv;
68603         this_arg_conv.inner = untag_ptr(this_arg);
68604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68606         this_arg_conv.is_owned = false;
68607         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
68608         int64_t ret_ref = 0;
68609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68611         return ret_ref;
68612 }
68613
68614 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
68615         LDKRawBolt11Invoice this_arg_conv;
68616         this_arg_conv.inner = untag_ptr(this_arg);
68617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68619         this_arg_conv.is_owned = false;
68620         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
68621         int64_tArray ret_arr = NULL;
68622         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68623         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68624         for (size_t o = 0; o < ret_var.datalen; o++) {
68625                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
68626                 int64_t ret_conv_14_ref = 0;
68627                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
68628                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
68629                 ret_arr_ptr[o] = ret_conv_14_ref;
68630         }
68631         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68632         FREE(ret_var.data);
68633         return ret_arr;
68634 }
68635
68636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
68637         LDKRawBolt11Invoice this_arg_conv;
68638         this_arg_conv.inner = untag_ptr(this_arg);
68639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68641         this_arg_conv.is_owned = false;
68642         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68643         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
68644         int64_t ret_ref = tag_ptr(ret_copy, true);
68645         return ret_ref;
68646 }
68647
68648 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
68649         LDKRawBolt11Invoice this_arg_conv;
68650         this_arg_conv.inner = untag_ptr(this_arg);
68651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68653         this_arg_conv.is_owned = false;
68654         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
68655         return ret_conv;
68656 }
68657
68658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
68659         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68660         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
68661         return tag_ptr(ret_conv, true);
68662 }
68663
68664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
68665         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68666         *ret_conv = PositiveTimestamp_from_system_time(time);
68667         return tag_ptr(ret_conv, true);
68668 }
68669
68670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
68671         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68672         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
68673         return tag_ptr(ret_conv, true);
68674 }
68675
68676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
68677         LDKPositiveTimestamp this_arg_conv;
68678         this_arg_conv.inner = untag_ptr(this_arg);
68679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68681         this_arg_conv.is_owned = false;
68682         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
68683         return ret_conv;
68684 }
68685
68686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
68687         LDKPositiveTimestamp this_arg_conv;
68688         this_arg_conv.inner = untag_ptr(this_arg);
68689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68691         this_arg_conv.is_owned = false;
68692         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
68693         return ret_conv;
68694 }
68695
68696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
68697         LDKPositiveTimestamp this_arg_conv;
68698         this_arg_conv.inner = untag_ptr(this_arg);
68699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68701         this_arg_conv.is_owned = false;
68702         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
68703         return ret_conv;
68704 }
68705
68706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68707         LDKBolt11Invoice this_arg_conv;
68708         this_arg_conv.inner = untag_ptr(this_arg);
68709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68711         this_arg_conv.is_owned = false;
68712         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68713         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
68714         return ret_arr;
68715 }
68716
68717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
68718         LDKBolt11Invoice this_arg_conv;
68719         this_arg_conv.inner = untag_ptr(this_arg);
68720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68722         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
68723         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
68724         int64_t ret_ref = 0;
68725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68727         return ret_ref;
68728 }
68729
68730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
68731         LDKBolt11Invoice this_arg_conv;
68732         this_arg_conv.inner = untag_ptr(this_arg);
68733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68735         this_arg_conv.is_owned = false;
68736         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
68737         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
68738         return tag_ptr(ret_conv, true);
68739 }
68740
68741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
68742         LDKSignedRawBolt11Invoice signed_invoice_conv;
68743         signed_invoice_conv.inner = untag_ptr(signed_invoice);
68744         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
68745         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
68746         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
68747         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
68748         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
68749         return tag_ptr(ret_conv, true);
68750 }
68751
68752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
68753         LDKBolt11Invoice this_arg_conv;
68754         this_arg_conv.inner = untag_ptr(this_arg);
68755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68757         this_arg_conv.is_owned = false;
68758         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
68759         return ret_conv;
68760 }
68761
68762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
68763         LDKBolt11Invoice this_arg_conv;
68764         this_arg_conv.inner = untag_ptr(this_arg);
68765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68767         this_arg_conv.is_owned = false;
68768         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
68769         return ret_conv;
68770 }
68771
68772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68773         LDKBolt11Invoice this_arg_conv;
68774         this_arg_conv.inner = untag_ptr(this_arg);
68775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68777         this_arg_conv.is_owned = false;
68778         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68779         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
68780         return ret_arr;
68781 }
68782
68783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68784         LDKBolt11Invoice this_arg_conv;
68785         this_arg_conv.inner = untag_ptr(this_arg);
68786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68788         this_arg_conv.is_owned = false;
68789         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68790         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
68791         return ret_arr;
68792 }
68793
68794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68795         LDKBolt11Invoice this_arg_conv;
68796         this_arg_conv.inner = untag_ptr(this_arg);
68797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68799         this_arg_conv.is_owned = false;
68800         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68801         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
68802         return ret_arr;
68803 }
68804
68805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
68806         LDKBolt11Invoice this_arg_conv;
68807         this_arg_conv.inner = untag_ptr(this_arg);
68808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68810         this_arg_conv.is_owned = false;
68811         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68812         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
68813         int64_t ret_ref = tag_ptr(ret_copy, true);
68814         return ret_ref;
68815 }
68816
68817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
68818         LDKBolt11Invoice this_arg_conv;
68819         this_arg_conv.inner = untag_ptr(this_arg);
68820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68822         this_arg_conv.is_owned = false;
68823         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
68824         int64_t ret_ref = 0;
68825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68827         return ret_ref;
68828 }
68829
68830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68831         LDKBolt11Invoice this_arg_conv;
68832         this_arg_conv.inner = untag_ptr(this_arg);
68833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68835         this_arg_conv.is_owned = false;
68836         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68837         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
68838         return ret_arr;
68839 }
68840
68841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
68842         LDKBolt11Invoice this_arg_conv;
68843         this_arg_conv.inner = untag_ptr(this_arg);
68844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68846         this_arg_conv.is_owned = false;
68847         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
68848         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
68849         int64_t ret_ref = tag_ptr(ret_copy, true);
68850         return ret_ref;
68851 }
68852
68853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
68854         LDKBolt11Invoice this_arg_conv;
68855         this_arg_conv.inner = untag_ptr(this_arg);
68856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68858         this_arg_conv.is_owned = false;
68859         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
68860         return ret_conv;
68861 }
68862
68863 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
68864         LDKBolt11Invoice this_arg_conv;
68865         this_arg_conv.inner = untag_ptr(this_arg);
68866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68868         this_arg_conv.is_owned = false;
68869         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
68870         return ret_conv;
68871 }
68872
68873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
68874         LDKBolt11Invoice this_arg_conv;
68875         this_arg_conv.inner = untag_ptr(this_arg);
68876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68878         this_arg_conv.is_owned = false;
68879         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
68880         return ret_conv;
68881 }
68882
68883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiration_1remaining_1from_1epoch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t time) {
68884         LDKBolt11Invoice this_arg_conv;
68885         this_arg_conv.inner = untag_ptr(this_arg);
68886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68888         this_arg_conv.is_owned = false;
68889         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
68890         return ret_conv;
68891 }
68892
68893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
68894         LDKBolt11Invoice this_arg_conv;
68895         this_arg_conv.inner = untag_ptr(this_arg);
68896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68898         this_arg_conv.is_owned = false;
68899         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
68900         return ret_conv;
68901 }
68902
68903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
68904         LDKBolt11Invoice this_arg_conv;
68905         this_arg_conv.inner = untag_ptr(this_arg);
68906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68908         this_arg_conv.is_owned = false;
68909         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
68910         return ret_conv;
68911 }
68912
68913 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
68914         LDKBolt11Invoice this_arg_conv;
68915         this_arg_conv.inner = untag_ptr(this_arg);
68916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68918         this_arg_conv.is_owned = false;
68919         LDKCVec_AddressZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
68920         jobjectArray ret_arr = NULL;
68921         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
68922         ;
68923         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68924         for (size_t i = 0; i < ret_var.datalen; i++) {
68925                 LDKStr ret_conv_8_str = ret_var.data[i];
68926                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
68927                 Str_free(ret_conv_8_str);
68928                 ret_arr_ptr[i] = ret_conv_8_conv;
68929         }
68930         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68931         FREE(ret_var.data);
68932         return ret_arr;
68933 }
68934
68935 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
68936         LDKBolt11Invoice this_arg_conv;
68937         this_arg_conv.inner = untag_ptr(this_arg);
68938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68940         this_arg_conv.is_owned = false;
68941         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
68942         int64_tArray ret_arr = NULL;
68943         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68944         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68945         for (size_t o = 0; o < ret_var.datalen; o++) {
68946                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
68947                 int64_t ret_conv_14_ref = 0;
68948                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
68949                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
68950                 ret_arr_ptr[o] = ret_conv_14_ref;
68951         }
68952         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68953         FREE(ret_var.data);
68954         return ret_arr;
68955 }
68956
68957 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
68958         LDKBolt11Invoice this_arg_conv;
68959         this_arg_conv.inner = untag_ptr(this_arg);
68960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68962         this_arg_conv.is_owned = false;
68963         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
68964         int64_tArray ret_arr = NULL;
68965         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68966         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68967         for (size_t l = 0; l < ret_var.datalen; l++) {
68968                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
68969                 int64_t ret_conv_11_ref = 0;
68970                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
68971                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
68972                 ret_arr_ptr[l] = ret_conv_11_ref;
68973         }
68974         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68975         FREE(ret_var.data);
68976         return ret_arr;
68977 }
68978
68979 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
68980         LDKBolt11Invoice this_arg_conv;
68981         this_arg_conv.inner = untag_ptr(this_arg);
68982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68984         this_arg_conv.is_owned = false;
68985         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
68986         return ret_conv;
68987 }
68988
68989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
68990         LDKBolt11Invoice this_arg_conv;
68991         this_arg_conv.inner = untag_ptr(this_arg);
68992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68994         this_arg_conv.is_owned = false;
68995         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68996         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
68997         int64_t ret_ref = tag_ptr(ret_copy, true);
68998         return ret_ref;
68999 }
69000
69001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
69002         LDKStr description_conv = java_to_owned_str(env, description);
69003         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
69004         *ret_conv = Description_new(description_conv);
69005         return tag_ptr(ret_conv, true);
69006 }
69007
69008 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
69009         LDKDescription this_arg_conv;
69010         this_arg_conv.inner = untag_ptr(this_arg);
69011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69013         this_arg_conv = Description_clone(&this_arg_conv);
69014         LDKStr ret_str = Description_into_inner(this_arg_conv);
69015         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69016         Str_free(ret_str);
69017         return ret_conv;
69018 }
69019
69020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
69021         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
69022         int64_t ret_ref = 0;
69023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69025         return ret_ref;
69026 }
69027
69028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
69029         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
69030         int64_t ret_ref = 0;
69031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69033         return ret_ref;
69034 }
69035
69036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
69037         LDKExpiryTime this_arg_conv;
69038         this_arg_conv.inner = untag_ptr(this_arg);
69039         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69041         this_arg_conv.is_owned = false;
69042         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
69043         return ret_conv;
69044 }
69045
69046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
69047         LDKExpiryTime this_arg_conv;
69048         this_arg_conv.inner = untag_ptr(this_arg);
69049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69051         this_arg_conv.is_owned = false;
69052         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
69053         return ret_conv;
69054 }
69055
69056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
69057         LDKRouteHint hops_conv;
69058         hops_conv.inner = untag_ptr(hops);
69059         hops_conv.is_owned = ptr_is_owned(hops);
69060         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
69061         hops_conv = RouteHint_clone(&hops_conv);
69062         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
69063         *ret_conv = PrivateRoute_new(hops_conv);
69064         return tag_ptr(ret_conv, true);
69065 }
69066
69067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
69068         LDKPrivateRoute this_arg_conv;
69069         this_arg_conv.inner = untag_ptr(this_arg);
69070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69072         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
69073         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
69074         int64_t ret_ref = 0;
69075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69077         return ret_ref;
69078 }
69079
69080 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69081         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
69082         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
69083         return ret_conv;
69084 }
69085
69086 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
69087         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
69088         return ret_conv;
69089 }
69090
69091 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
69092         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
69093         return ret_conv;
69094 }
69095
69096 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
69097         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
69098         return ret_conv;
69099 }
69100
69101 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
69102         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
69103         return ret_conv;
69104 }
69105
69106 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
69107         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
69108         return ret_conv;
69109 }
69110
69111 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
69112         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
69113         return ret_conv;
69114 }
69115
69116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69117         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
69118         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
69119         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
69120         return ret_conv;
69121 }
69122
69123 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69124         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
69125         LDKStr ret_str = CreationError_to_str(o_conv);
69126         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69127         Str_free(ret_str);
69128         return ret_conv;
69129 }
69130
69131 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69132         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
69133         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
69134         return ret_conv;
69135 }
69136
69137 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
69138         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
69139         return ret_conv;
69140 }
69141
69142 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
69143         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
69144         return ret_conv;
69145 }
69146
69147 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
69148         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
69149         return ret_conv;
69150 }
69151
69152 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
69153         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
69154         return ret_conv;
69155 }
69156
69157 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
69158         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
69159         return ret_conv;
69160 }
69161
69162 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
69163         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
69164         return ret_conv;
69165 }
69166
69167 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
69168         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
69169         return ret_conv;
69170 }
69171
69172 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
69173         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
69174         return ret_conv;
69175 }
69176
69177 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
69178         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
69179         return ret_conv;
69180 }
69181
69182 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
69183         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
69184         return ret_conv;
69185 }
69186
69187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69188         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
69189         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
69190         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
69191         return ret_conv;
69192 }
69193
69194 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69195         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
69196         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
69197         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69198         Str_free(ret_str);
69199         return ret_conv;
69200 }
69201
69202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69203         if (!ptr_is_owned(this_ptr)) return;
69204         void* this_ptr_ptr = untag_ptr(this_ptr);
69205         CHECK_ACCESS(this_ptr_ptr);
69206         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
69207         FREE(untag_ptr(this_ptr));
69208         SignOrCreationError_free(this_ptr_conv);
69209 }
69210
69211 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
69212         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69213         *ret_copy = SignOrCreationError_clone(arg);
69214         int64_t ret_ref = tag_ptr(ret_copy, true);
69215         return ret_ref;
69216 }
69217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69218         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
69219         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
69220         return ret_conv;
69221 }
69222
69223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69224         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
69225         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69226         *ret_copy = SignOrCreationError_clone(orig_conv);
69227         int64_t ret_ref = tag_ptr(ret_copy, true);
69228         return ret_ref;
69229 }
69230
69231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
69232         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69233         *ret_copy = SignOrCreationError_sign_error();
69234         int64_t ret_ref = tag_ptr(ret_copy, true);
69235         return ret_ref;
69236 }
69237
69238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
69239         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
69240         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69241         *ret_copy = SignOrCreationError_creation_error(a_conv);
69242         int64_t ret_ref = tag_ptr(ret_copy, true);
69243         return ret_ref;
69244 }
69245
69246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69247         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
69248         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
69249         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
69250         return ret_conv;
69251 }
69252
69253 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69254         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
69255         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
69256         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69257         Str_free(ret_str);
69258         return ret_conv;
69259 }
69260
69261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t retry_strategy, int64_t channelmanager) {
69262         LDKBolt11Invoice invoice_conv;
69263         invoice_conv.inner = untag_ptr(invoice);
69264         invoice_conv.is_owned = ptr_is_owned(invoice);
69265         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69266         invoice_conv.is_owned = false;
69267         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69268         CHECK_ACCESS(retry_strategy_ptr);
69269         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69270         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69271         LDKChannelManager channelmanager_conv;
69272         channelmanager_conv.inner = untag_ptr(channelmanager);
69273         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69274         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69275         channelmanager_conv.is_owned = false;
69276         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
69277         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
69278         return tag_ptr(ret_conv, true);
69279 }
69280
69281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) {
69282         LDKBolt11Invoice invoice_conv;
69283         invoice_conv.inner = untag_ptr(invoice);
69284         invoice_conv.is_owned = ptr_is_owned(invoice);
69285         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69286         invoice_conv.is_owned = false;
69287         LDKThirtyTwoBytes payment_id_ref;
69288         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
69289         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
69290         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69291         CHECK_ACCESS(retry_strategy_ptr);
69292         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69293         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69294         LDKChannelManager channelmanager_conv;
69295         channelmanager_conv.inner = untag_ptr(channelmanager);
69296         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69297         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69298         channelmanager_conv.is_owned = false;
69299         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
69300         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
69301         return tag_ptr(ret_conv, true);
69302 }
69303
69304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int64_t retry_strategy, int64_t channelmanager) {
69305         LDKBolt11Invoice invoice_conv;
69306         invoice_conv.inner = untag_ptr(invoice);
69307         invoice_conv.is_owned = ptr_is_owned(invoice);
69308         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69309         invoice_conv.is_owned = false;
69310         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69311         CHECK_ACCESS(retry_strategy_ptr);
69312         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69313         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69314         LDKChannelManager channelmanager_conv;
69315         channelmanager_conv.inner = untag_ptr(channelmanager);
69316         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69317         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69318         channelmanager_conv.is_owned = false;
69319         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
69320         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
69321         return tag_ptr(ret_conv, true);
69322 }
69323
69324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_pay_1zero_1value_1invoice_1with_1id(JNIEnv *env, jclass clz, int64_t invoice, int64_t amount_msats, int8_tArray payment_id, int64_t retry_strategy, int64_t channelmanager) {
69325         LDKBolt11Invoice invoice_conv;
69326         invoice_conv.inner = untag_ptr(invoice);
69327         invoice_conv.is_owned = ptr_is_owned(invoice);
69328         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69329         invoice_conv.is_owned = false;
69330         LDKThirtyTwoBytes payment_id_ref;
69331         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
69332         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
69333         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69334         CHECK_ACCESS(retry_strategy_ptr);
69335         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69336         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69337         LDKChannelManager channelmanager_conv;
69338         channelmanager_conv.inner = untag_ptr(channelmanager);
69339         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69340         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69341         channelmanager_conv.is_owned = false;
69342         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
69343         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
69344         return tag_ptr(ret_conv, true);
69345 }
69346
69347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69348         if (!ptr_is_owned(this_ptr)) return;
69349         void* this_ptr_ptr = untag_ptr(this_ptr);
69350         CHECK_ACCESS(this_ptr_ptr);
69351         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
69352         FREE(untag_ptr(this_ptr));
69353         PaymentError_free(this_ptr_conv);
69354 }
69355
69356 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
69357         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69358         *ret_copy = PaymentError_clone(arg);
69359         int64_t ret_ref = tag_ptr(ret_copy, true);
69360         return ret_ref;
69361 }
69362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69363         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
69364         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
69365         return ret_conv;
69366 }
69367
69368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69369         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
69370         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69371         *ret_copy = PaymentError_clone(orig_conv);
69372         int64_t ret_ref = tag_ptr(ret_copy, true);
69373         return ret_ref;
69374 }
69375
69376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
69377         LDKStr a_conv = java_to_owned_str(env, a);
69378         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69379         *ret_copy = PaymentError_invoice(a_conv);
69380         int64_t ret_ref = tag_ptr(ret_copy, true);
69381         return ret_ref;
69382 }
69383
69384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, jclass a) {
69385         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_java(env, a);
69386         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69387         *ret_copy = PaymentError_sending(a_conv);
69388         int64_t ret_ref = tag_ptr(ret_copy, true);
69389         return ret_ref;
69390 }
69391
69392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69393         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
69394         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
69395         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
69396         return ret_conv;
69397 }
69398
69399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t payment_hash, jstring description, int32_t invoice_expiry_delta_secs, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
69400         void* amt_msat_ptr = untag_ptr(amt_msat);
69401         CHECK_ACCESS(amt_msat_ptr);
69402         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69403         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69404         void* payment_hash_ptr = untag_ptr(payment_hash);
69405         CHECK_ACCESS(payment_hash_ptr);
69406         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
69407         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
69408         LDKStr description_conv = java_to_owned_str(env, description);
69409         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
69410         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
69411         if (phantom_route_hints_constr.datalen > 0)
69412                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
69413         else
69414                 phantom_route_hints_constr.data = NULL;
69415         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
69416         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
69417                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
69418                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
69419                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
69420                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
69421                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
69422                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
69423                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
69424         }
69425         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
69426         void* entropy_source_ptr = untag_ptr(entropy_source);
69427         CHECK_ACCESS(entropy_source_ptr);
69428         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69429         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69430                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69431                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69432         }
69433         void* node_signer_ptr = untag_ptr(node_signer);
69434         CHECK_ACCESS(node_signer_ptr);
69435         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69436         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69437                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69438                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69439         }
69440         void* logger_ptr = untag_ptr(logger);
69441         CHECK_ACCESS(logger_ptr);
69442         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69443         if (logger_conv.free == LDKLogger_JCalls_free) {
69444                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69445                 LDKLogger_JCalls_cloned(&logger_conv);
69446         }
69447         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69448         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69449         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69450         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69451         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69452         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69453         *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_conv, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
69454         return tag_ptr(ret_conv, true);
69455 }
69456
69457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t payment_hash, int32_t invoice_expiry_delta_secs, int64_t description_hash, int64_tArray phantom_route_hints, int64_t entropy_source, int64_t node_signer, int64_t logger, jclass network, int64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) {
69458         void* amt_msat_ptr = untag_ptr(amt_msat);
69459         CHECK_ACCESS(amt_msat_ptr);
69460         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69461         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69462         void* payment_hash_ptr = untag_ptr(payment_hash);
69463         CHECK_ACCESS(payment_hash_ptr);
69464         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
69465         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
69466         LDKSha256 description_hash_conv;
69467         description_hash_conv.inner = untag_ptr(description_hash);
69468         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69469         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69470         description_hash_conv = Sha256_clone(&description_hash_conv);
69471         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
69472         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
69473         if (phantom_route_hints_constr.datalen > 0)
69474                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
69475         else
69476                 phantom_route_hints_constr.data = NULL;
69477         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
69478         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
69479                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
69480                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
69481                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
69482                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
69483                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
69484                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
69485                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
69486         }
69487         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
69488         void* entropy_source_ptr = untag_ptr(entropy_source);
69489         CHECK_ACCESS(entropy_source_ptr);
69490         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69491         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69492                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69493                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69494         }
69495         void* node_signer_ptr = untag_ptr(node_signer);
69496         CHECK_ACCESS(node_signer_ptr);
69497         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69498         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69499                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69500                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69501         }
69502         void* logger_ptr = untag_ptr(logger);
69503         CHECK_ACCESS(logger_ptr);
69504         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69505         if (logger_conv.free == LDKLogger_JCalls_free) {
69506                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69507                 LDKLogger_JCalls_cloned(&logger_conv);
69508         }
69509         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69510         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69511         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69512         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69513         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69514         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69515         *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_conv, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch);
69516         return tag_ptr(ret_conv, true);
69517 }
69518
69519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
69520         LDKChannelManager channelmanager_conv;
69521         channelmanager_conv.inner = untag_ptr(channelmanager);
69522         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69523         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69524         channelmanager_conv.is_owned = false;
69525         void* node_signer_ptr = untag_ptr(node_signer);
69526         CHECK_ACCESS(node_signer_ptr);
69527         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69528         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69529                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69530                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69531         }
69532         void* logger_ptr = untag_ptr(logger);
69533         CHECK_ACCESS(logger_ptr);
69534         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69535         if (logger_conv.free == LDKLogger_JCalls_free) {
69536                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69537                 LDKLogger_JCalls_cloned(&logger_conv);
69538         }
69539         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69540         void* amt_msat_ptr = untag_ptr(amt_msat);
69541         CHECK_ACCESS(amt_msat_ptr);
69542         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69543         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69544         LDKStr description_conv = java_to_owned_str(env, description);
69545         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69546         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69547         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69548         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69549         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69550         *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
69551         return tag_ptr(ret_conv, true);
69552 }
69553
69554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
69555         LDKChannelManager channelmanager_conv;
69556         channelmanager_conv.inner = untag_ptr(channelmanager);
69557         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69558         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69559         channelmanager_conv.is_owned = false;
69560         void* node_signer_ptr = untag_ptr(node_signer);
69561         CHECK_ACCESS(node_signer_ptr);
69562         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69563         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69564                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69565                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69566         }
69567         void* logger_ptr = untag_ptr(logger);
69568         CHECK_ACCESS(logger_ptr);
69569         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69570         if (logger_conv.free == LDKLogger_JCalls_free) {
69571                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69572                 LDKLogger_JCalls_cloned(&logger_conv);
69573         }
69574         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69575         void* amt_msat_ptr = untag_ptr(amt_msat);
69576         CHECK_ACCESS(amt_msat_ptr);
69577         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69578         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69579         LDKSha256 description_hash_conv;
69580         description_hash_conv.inner = untag_ptr(description_hash);
69581         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69582         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69583         description_hash_conv = Sha256_clone(&description_hash_conv);
69584         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69585         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69586         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69587         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69588         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69589         *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
69590         return tag_ptr(ret_conv, true);
69591 }
69592
69593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
69594         LDKChannelManager channelmanager_conv;
69595         channelmanager_conv.inner = untag_ptr(channelmanager);
69596         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69597         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69598         channelmanager_conv.is_owned = false;
69599         void* node_signer_ptr = untag_ptr(node_signer);
69600         CHECK_ACCESS(node_signer_ptr);
69601         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69602         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69603                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69604                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69605         }
69606         void* logger_ptr = untag_ptr(logger);
69607         CHECK_ACCESS(logger_ptr);
69608         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69609         if (logger_conv.free == LDKLogger_JCalls_free) {
69610                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69611                 LDKLogger_JCalls_cloned(&logger_conv);
69612         }
69613         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69614         void* amt_msat_ptr = untag_ptr(amt_msat);
69615         CHECK_ACCESS(amt_msat_ptr);
69616         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69617         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69618         LDKSha256 description_hash_conv;
69619         description_hash_conv.inner = untag_ptr(description_hash);
69620         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69621         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69622         description_hash_conv = Sha256_clone(&description_hash_conv);
69623         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69624         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69625         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69626         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69627         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69628         *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
69629         return tag_ptr(ret_conv, true);
69630 }
69631
69632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) {
69633         LDKChannelManager channelmanager_conv;
69634         channelmanager_conv.inner = untag_ptr(channelmanager);
69635         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69636         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69637         channelmanager_conv.is_owned = false;
69638         void* node_signer_ptr = untag_ptr(node_signer);
69639         CHECK_ACCESS(node_signer_ptr);
69640         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69641         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69642                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69643                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69644         }
69645         void* logger_ptr = untag_ptr(logger);
69646         CHECK_ACCESS(logger_ptr);
69647         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69648         if (logger_conv.free == LDKLogger_JCalls_free) {
69649                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69650                 LDKLogger_JCalls_cloned(&logger_conv);
69651         }
69652         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69653         void* amt_msat_ptr = untag_ptr(amt_msat);
69654         CHECK_ACCESS(amt_msat_ptr);
69655         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69656         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69657         LDKStr description_conv = java_to_owned_str(env, description);
69658         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69659         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69660         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69661         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69662         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69663         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
69664         return tag_ptr(ret_conv, true);
69665 }
69666
69667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch_1with_1payment_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t node_signer, int64_t logger, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int8_tArray payment_hash, int64_t min_final_cltv_expiry_delta) {
69668         LDKChannelManager channelmanager_conv;
69669         channelmanager_conv.inner = untag_ptr(channelmanager);
69670         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69671         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69672         channelmanager_conv.is_owned = false;
69673         void* node_signer_ptr = untag_ptr(node_signer);
69674         CHECK_ACCESS(node_signer_ptr);
69675         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69676         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69677                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69678                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69679         }
69680         void* logger_ptr = untag_ptr(logger);
69681         CHECK_ACCESS(logger_ptr);
69682         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69683         if (logger_conv.free == LDKLogger_JCalls_free) {
69684                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69685                 LDKLogger_JCalls_cloned(&logger_conv);
69686         }
69687         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69688         void* amt_msat_ptr = untag_ptr(amt_msat);
69689         CHECK_ACCESS(amt_msat_ptr);
69690         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69691         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69692         LDKStr description_conv = java_to_owned_str(env, description);
69693         LDKThirtyTwoBytes payment_hash_ref;
69694         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
69695         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
69696         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69697         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69698         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69699         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69700         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69701         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref, min_final_cltv_expiry_delta_conv);
69702         return tag_ptr(ret_conv, true);
69703 }
69704
69705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
69706         LDKStr s_conv = java_to_owned_str(env, s);
69707         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
69708         *ret_conv = SiPrefix_from_str(s_conv);
69709         return tag_ptr(ret_conv, true);
69710 }
69711
69712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
69713         LDKStr s_conv = java_to_owned_str(env, s);
69714         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
69715         *ret_conv = Bolt11Invoice_from_str(s_conv);
69716         return tag_ptr(ret_conv, true);
69717 }
69718
69719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
69720         LDKStr s_conv = java_to_owned_str(env, s);
69721         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
69722         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
69723         return tag_ptr(ret_conv, true);
69724 }
69725
69726 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69727         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
69728         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
69729         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69730         Str_free(ret_str);
69731         return ret_conv;
69732 }
69733
69734 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69735         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
69736         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
69737         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69738         Str_free(ret_str);
69739         return ret_conv;
69740 }
69741
69742 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69743         LDKBolt11Invoice o_conv;
69744         o_conv.inner = untag_ptr(o);
69745         o_conv.is_owned = ptr_is_owned(o);
69746         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69747         o_conv.is_owned = false;
69748         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
69749         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69750         Str_free(ret_str);
69751         return ret_conv;
69752 }
69753
69754 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69755         LDKSignedRawBolt11Invoice o_conv;
69756         o_conv.inner = untag_ptr(o);
69757         o_conv.is_owned = ptr_is_owned(o);
69758         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69759         o_conv.is_owned = false;
69760         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
69761         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69762         Str_free(ret_str);
69763         return ret_conv;
69764 }
69765
69766 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69767         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
69768         LDKStr ret_str = Currency_to_str(o_conv);
69769         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69770         Str_free(ret_str);
69771         return ret_conv;
69772 }
69773
69774 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69775         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
69776         LDKStr ret_str = SiPrefix_to_str(o_conv);
69777         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69778         Str_free(ret_str);
69779         return ret_conv;
69780 }
69781
69782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69783         LDKRapidGossipSync this_obj_conv;
69784         this_obj_conv.inner = untag_ptr(this_obj);
69785         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69787         RapidGossipSync_free(this_obj_conv);
69788 }
69789
69790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
69791         LDKNetworkGraph network_graph_conv;
69792         network_graph_conv.inner = untag_ptr(network_graph);
69793         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69794         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69795         network_graph_conv.is_owned = false;
69796         void* logger_ptr = untag_ptr(logger);
69797         CHECK_ACCESS(logger_ptr);
69798         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69799         if (logger_conv.free == LDKLogger_JCalls_free) {
69800                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69801                 LDKLogger_JCalls_cloned(&logger_conv);
69802         }
69803         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
69804         int64_t ret_ref = 0;
69805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69807         return ret_ref;
69808 }
69809
69810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1sync_1network_1graph_1with_1file_1path(JNIEnv *env, jclass clz, int64_t this_arg, jstring sync_path) {
69811         LDKRapidGossipSync this_arg_conv;
69812         this_arg_conv.inner = untag_ptr(this_arg);
69813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69815         this_arg_conv.is_owned = false;
69816         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
69817         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
69818         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
69819         return tag_ptr(ret_conv, true);
69820 }
69821
69822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data) {
69823         LDKRapidGossipSync this_arg_conv;
69824         this_arg_conv.inner = untag_ptr(this_arg);
69825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69827         this_arg_conv.is_owned = false;
69828         LDKu8slice update_data_ref;
69829         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
69830         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
69831         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
69832         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
69833         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
69834         return tag_ptr(ret_conv, true);
69835 }
69836
69837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1update_1network_1graph_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray update_data, int64_t current_time_unix) {
69838         LDKRapidGossipSync this_arg_conv;
69839         this_arg_conv.inner = untag_ptr(this_arg);
69840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69842         this_arg_conv.is_owned = false;
69843         LDKu8slice update_data_ref;
69844         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
69845         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
69846         void* current_time_unix_ptr = untag_ptr(current_time_unix);
69847         CHECK_ACCESS(current_time_unix_ptr);
69848         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
69849         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
69850         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
69851         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
69852         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
69853         return tag_ptr(ret_conv, true);
69854 }
69855
69856 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
69857         LDKRapidGossipSync this_arg_conv;
69858         this_arg_conv.inner = untag_ptr(this_arg);
69859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69861         this_arg_conv.is_owned = false;
69862         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
69863         return ret_conv;
69864 }
69865
69866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69867         if (!ptr_is_owned(this_ptr)) return;
69868         void* this_ptr_ptr = untag_ptr(this_ptr);
69869         CHECK_ACCESS(this_ptr_ptr);
69870         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
69871         FREE(untag_ptr(this_ptr));
69872         GraphSyncError_free(this_ptr_conv);
69873 }
69874
69875 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
69876         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
69877         *ret_copy = GraphSyncError_clone(arg);
69878         int64_t ret_ref = tag_ptr(ret_copy, true);
69879         return ret_ref;
69880 }
69881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69882         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
69883         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
69884         return ret_conv;
69885 }
69886
69887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69888         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
69889         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
69890         *ret_copy = GraphSyncError_clone(orig_conv);
69891         int64_t ret_ref = tag_ptr(ret_copy, true);
69892         return ret_ref;
69893 }
69894
69895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
69896         void* a_ptr = untag_ptr(a);
69897         CHECK_ACCESS(a_ptr);
69898         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
69899         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
69900         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
69901         *ret_copy = GraphSyncError_decode_error(a_conv);
69902         int64_t ret_ref = tag_ptr(ret_copy, true);
69903         return ret_ref;
69904 }
69905
69906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
69907         LDKLightningError a_conv;
69908         a_conv.inner = untag_ptr(a);
69909         a_conv.is_owned = ptr_is_owned(a);
69910         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69911         a_conv = LightningError_clone(&a_conv);
69912         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
69913         *ret_copy = GraphSyncError_lightning_error(a_conv);
69914         int64_t ret_ref = tag_ptr(ret_copy, true);
69915         return ret_ref;
69916 }
69917