3febdce251effe1108ea341eca23d8e2ca5d6114
[ldk-java] / src / main / jni / bindings.c.body
1 #include <jni.h>
2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
3 #define int64_t jlong
4 #include "org_ldk_impl_bindings.h"
5 #include <lightning.h>
6 #include <string.h>
7 #include <stdatomic.h>
8 #include <stdlib.h>
9
10 #define LIKELY(v) __builtin_expect(!!(v), 1)
11 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
12
13 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
14 #define MALLOC(a, _) malloc(a)
15 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
16 #define CHECK_ACCESS(p)
17 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
18 #define DO_ASSERT(a) (void)(a)
19 #define CHECK(a)
20
21 static jmethodID ordinal_meth = NULL;
22 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) {
23         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
24         CHECK(ordinal_meth != NULL);
25 }
26
27 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
28 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
29 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
30 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
31
32 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
33 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
34 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
35
36 typedef jlongArray int64_tArray;
37 typedef jbyteArray int8_tArray;
38 typedef jshortArray int16_tArray;
39
40 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
41         // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
42         char* conv_buf = MALLOC(len + 1, "str conv buf");
43         memcpy(conv_buf, chars, len);
44         conv_buf[len] = 0;
45         jstring ret = (*env)->NewStringUTF(env, conv_buf);
46         FREE(conv_buf);
47         return ret;
48 }
49 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
50         uint64_t str_len = (*env)->GetStringUTFLength(env, str);
51         char* newchars = MALLOC(str_len + 1, "String chars");
52         const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
53         memcpy(newchars, jchars, str_len);
54         newchars[str_len] = 0;
55         (*env)->ReleaseStringUTFChars(env, str, jchars);
56         LDKStr res = {
57                 .chars = newchars,
58                 .len = str_len,
59                 .chars_is_owned = true
60         };
61         return res;
62 }
63
64 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
65         return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
66 }
67 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
68         return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
69 }
70 #include "version.c"
71 static jclass arr_of_B_clz = NULL;
72 static jclass String_clz = NULL;
73 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
74         arr_of_B_clz = (*env)->FindClass(env, "[B");
75         CHECK(arr_of_B_clz != NULL);
76         arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
77         String_clz = (*env)->FindClass(env, "java/lang/String");
78         CHECK(String_clz != NULL);
79         String_clz = (*env)->NewGlobalRef(env, String_clz);
80 }
81 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
82
83 static inline void* untag_ptr(uint64_t ptr) {
84         if (ptr < 4096) return (void*)ptr;
85         if (sizeof(void*) == 4) {
86                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
87                 return (void*)(uintptr_t)ptr;
88         } else {
89                 // For 64-bit systems, assume the top byte is used for tagging, then
90                 // use bit 9 ^ bit 10.
91                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
92                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
93 #ifdef LDK_DEBUG_BUILD
94                 // On debug builds we also use the 11th bit as a debug flag
95                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
96                 CHECK(tenth_bit != eleventh_bit);
97                 p ^= 1ULL << 53;
98 #endif
99                 return (void*)p;
100         }
101 }
102 static inline bool ptr_is_owned(uint64_t ptr) {
103         if(ptr < 4096) return true;
104         if (sizeof(void*) == 4) {
105                 return ptr & (1ULL << 32);
106         } else {
107                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
108                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
109 #ifdef LDK_DEBUG_BUILD
110                 // On debug builds we also use the 11th bit as a debug flag
111                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
112                 CHECK(tenth_bit != eleventh_bit);
113 #endif
114                 return (ninth_bit ^ tenth_bit) ? true : false;
115         }
116 }
117 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
118         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
119         if (sizeof(void*) == 4) {
120                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
121         } else {
122                 CHECK(sizeof(uintptr_t) == 8);
123                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
124                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
125 #ifdef LDK_DEBUG_BUILD
126                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
127                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
128                 CHECK(ninth_bit == tenth_bit);
129                 CHECK(ninth_bit == eleventh_bit);
130                 t ^= 1ULL << 53;
131 #endif
132                 CHECK(ptr_is_owned(t) == is_owned);
133                 CHECK(untag_ptr(t) == ptr);
134                 return t;
135         }
136 }
137
138 static inline LDKBolt11SemanticError LDKBolt11SemanticError_from_java(JNIEnv *env, jclass clz) {
139         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
140         if (UNLIKELY((*env)->ExceptionCheck(env))) {
141                 (*env)->ExceptionDescribe(env);
142                 (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust threw an exception.");
143         }
144         switch (ord) {
145                 case 0: return LDKBolt11SemanticError_NoPaymentHash;
146                 case 1: return LDKBolt11SemanticError_MultiplePaymentHashes;
147                 case 2: return LDKBolt11SemanticError_NoDescription;
148                 case 3: return LDKBolt11SemanticError_MultipleDescriptions;
149                 case 4: return LDKBolt11SemanticError_NoPaymentSecret;
150                 case 5: return LDKBolt11SemanticError_MultiplePaymentSecrets;
151                 case 6: return LDKBolt11SemanticError_InvalidFeatures;
152                 case 7: return LDKBolt11SemanticError_InvalidRecoveryId;
153                 case 8: return LDKBolt11SemanticError_InvalidSignature;
154                 case 9: return LDKBolt11SemanticError_ImpreciseAmount;
155         }
156         (*env)->FatalError(env, "A call to Bolt11SemanticError.ordinal() from rust returned an invalid value.");
157         abort(); // Unreachable, but will let the compiler know we don't return here
158 }
159 static jclass Bolt11SemanticError_class = NULL;
160 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = NULL;
161 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = NULL;
162 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = NULL;
163 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = NULL;
164 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = NULL;
165 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = NULL;
166 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = NULL;
167 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = NULL;
168 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = NULL;
169 static jfieldID Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = NULL;
170 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt11SemanticError_init (JNIEnv *env, jclass clz) {
171         Bolt11SemanticError_class = (*env)->NewGlobalRef(env, clz);
172         CHECK(Bolt11SemanticError_class != NULL);
173         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentHash", "Lorg/ldk/enums/Bolt11SemanticError;");
174         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash != NULL);
175         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/Bolt11SemanticError;");
176         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes != NULL);
177         Bolt11SemanticError_LDKBolt11SemanticError_NoDescription = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoDescription", "Lorg/ldk/enums/Bolt11SemanticError;");
178         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoDescription != NULL);
179         Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultipleDescriptions", "Lorg/ldk/enums/Bolt11SemanticError;");
180         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions != NULL);
181         Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_NoPaymentSecret", "Lorg/ldk/enums/Bolt11SemanticError;");
182         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret != NULL);
183         Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/Bolt11SemanticError;");
184         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets != NULL);
185         Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidFeatures", "Lorg/ldk/enums/Bolt11SemanticError;");
186         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures != NULL);
187         Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidRecoveryId", "Lorg/ldk/enums/Bolt11SemanticError;");
188         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId != NULL);
189         Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_InvalidSignature", "Lorg/ldk/enums/Bolt11SemanticError;");
190         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature != NULL);
191         Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, Bolt11SemanticError_class, "LDKBolt11SemanticError_ImpreciseAmount", "Lorg/ldk/enums/Bolt11SemanticError;");
192         CHECK(Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount != NULL);
193 }
194 static inline jclass LDKBolt11SemanticError_to_java(JNIEnv *env, LDKBolt11SemanticError val) {
195         switch (val) {
196                 case LDKBolt11SemanticError_NoPaymentHash:
197                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentHash);
198                 case LDKBolt11SemanticError_MultiplePaymentHashes:
199                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentHashes);
200                 case LDKBolt11SemanticError_NoDescription:
201                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoDescription);
202                 case LDKBolt11SemanticError_MultipleDescriptions:
203                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultipleDescriptions);
204                 case LDKBolt11SemanticError_NoPaymentSecret:
205                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_NoPaymentSecret);
206                 case LDKBolt11SemanticError_MultiplePaymentSecrets:
207                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_MultiplePaymentSecrets);
208                 case LDKBolt11SemanticError_InvalidFeatures:
209                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidFeatures);
210                 case LDKBolt11SemanticError_InvalidRecoveryId:
211                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidRecoveryId);
212                 case LDKBolt11SemanticError_InvalidSignature:
213                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_InvalidSignature);
214                 case LDKBolt11SemanticError_ImpreciseAmount:
215                         return (*env)->GetStaticObjectField(env, Bolt11SemanticError_class, Bolt11SemanticError_LDKBolt11SemanticError_ImpreciseAmount);
216                 default: abort();
217         }
218 }
219
220 static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *env, jclass clz) {
221         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
222         if (UNLIKELY((*env)->ExceptionCheck(env))) {
223                 (*env)->ExceptionDescribe(env);
224                 (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust threw an exception.");
225         }
226         switch (ord) {
227                 case 0: return LDKBolt12SemanticError_AlreadyExpired;
228                 case 1: return LDKBolt12SemanticError_UnsupportedChain;
229                 case 2: return LDKBolt12SemanticError_UnexpectedChain;
230                 case 3: return LDKBolt12SemanticError_MissingAmount;
231                 case 4: return LDKBolt12SemanticError_InvalidAmount;
232                 case 5: return LDKBolt12SemanticError_InsufficientAmount;
233                 case 6: return LDKBolt12SemanticError_UnexpectedAmount;
234                 case 7: return LDKBolt12SemanticError_UnsupportedCurrency;
235                 case 8: return LDKBolt12SemanticError_UnknownRequiredFeatures;
236                 case 9: return LDKBolt12SemanticError_UnexpectedFeatures;
237                 case 10: return LDKBolt12SemanticError_MissingDescription;
238                 case 11: return LDKBolt12SemanticError_MissingSigningPubkey;
239                 case 12: return LDKBolt12SemanticError_InvalidSigningPubkey;
240                 case 13: return LDKBolt12SemanticError_UnexpectedSigningPubkey;
241                 case 14: return LDKBolt12SemanticError_MissingQuantity;
242                 case 15: return LDKBolt12SemanticError_InvalidQuantity;
243                 case 16: return LDKBolt12SemanticError_UnexpectedQuantity;
244                 case 17: return LDKBolt12SemanticError_InvalidMetadata;
245                 case 18: return LDKBolt12SemanticError_UnexpectedMetadata;
246                 case 19: return LDKBolt12SemanticError_MissingPayerMetadata;
247                 case 20: return LDKBolt12SemanticError_MissingPayerId;
248                 case 21: return LDKBolt12SemanticError_MissingPaths;
249                 case 22: return LDKBolt12SemanticError_InvalidPayInfo;
250                 case 23: return LDKBolt12SemanticError_MissingCreationTime;
251                 case 24: return LDKBolt12SemanticError_MissingPaymentHash;
252                 case 25: return LDKBolt12SemanticError_MissingSignature;
253         }
254         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
255         abort(); // Unreachable, but will let the compiler know we don't return here
256 }
257 static jclass Bolt12SemanticError_class = NULL;
258 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
259 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
260 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
261 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
262 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
263 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
264 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
265 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
266 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
267 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
268 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
269 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
270 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
271 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
272 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
273 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
274 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
275 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
276 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
277 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
278 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
279 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
280 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
281 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
282 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
283 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
284 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
285         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
286         CHECK(Bolt12SemanticError_class != NULL);
287         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
288         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
289         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
290         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
291         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
292         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
293         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
294         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
295         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
296         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
297         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
298         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
299         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
300         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
301         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
302         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
303         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
304         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
305         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
306         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
307         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
308         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
309         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
310         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
311         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
312         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
313         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
314         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
315         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
316         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
317         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
318         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
319         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
320         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
321         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
322         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
323         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
324         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
325         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
326         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
327         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
328         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
329         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
330         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
331         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
332         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
333         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
334         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
335         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
336         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
337         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
338         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
339 }
340 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
341         switch (val) {
342                 case LDKBolt12SemanticError_AlreadyExpired:
343                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
344                 case LDKBolt12SemanticError_UnsupportedChain:
345                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
346                 case LDKBolt12SemanticError_UnexpectedChain:
347                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
348                 case LDKBolt12SemanticError_MissingAmount:
349                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
350                 case LDKBolt12SemanticError_InvalidAmount:
351                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
352                 case LDKBolt12SemanticError_InsufficientAmount:
353                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
354                 case LDKBolt12SemanticError_UnexpectedAmount:
355                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
356                 case LDKBolt12SemanticError_UnsupportedCurrency:
357                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
358                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
359                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
360                 case LDKBolt12SemanticError_UnexpectedFeatures:
361                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
362                 case LDKBolt12SemanticError_MissingDescription:
363                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
364                 case LDKBolt12SemanticError_MissingSigningPubkey:
365                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
366                 case LDKBolt12SemanticError_InvalidSigningPubkey:
367                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
368                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
369                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
370                 case LDKBolt12SemanticError_MissingQuantity:
371                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
372                 case LDKBolt12SemanticError_InvalidQuantity:
373                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
374                 case LDKBolt12SemanticError_UnexpectedQuantity:
375                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
376                 case LDKBolt12SemanticError_InvalidMetadata:
377                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
378                 case LDKBolt12SemanticError_UnexpectedMetadata:
379                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
380                 case LDKBolt12SemanticError_MissingPayerMetadata:
381                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
382                 case LDKBolt12SemanticError_MissingPayerId:
383                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
384                 case LDKBolt12SemanticError_MissingPaths:
385                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
386                 case LDKBolt12SemanticError_InvalidPayInfo:
387                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
388                 case LDKBolt12SemanticError_MissingCreationTime:
389                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
390                 case LDKBolt12SemanticError_MissingPaymentHash:
391                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
392                 case LDKBolt12SemanticError_MissingSignature:
393                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
394                 default: abort();
395         }
396 }
397
398 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
399         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
400         if (UNLIKELY((*env)->ExceptionCheck(env))) {
401                 (*env)->ExceptionDescribe(env);
402                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
403         }
404         switch (ord) {
405                 case 0: return LDKCOption_NoneZ_Some;
406                 case 1: return LDKCOption_NoneZ_None;
407         }
408         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
409         abort(); // Unreachable, but will let the compiler know we don't return here
410 }
411 static jclass COption_NoneZ_class = NULL;
412 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
413 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
414 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
415         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
416         CHECK(COption_NoneZ_class != NULL);
417         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
418         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
419         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
420         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
421 }
422 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
423         switch (val) {
424                 case LDKCOption_NoneZ_Some:
425                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
426                 case LDKCOption_NoneZ_None:
427                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
428                 default: abort();
429         }
430 }
431
432 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
433         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
434         if (UNLIKELY((*env)->ExceptionCheck(env))) {
435                 (*env)->ExceptionDescribe(env);
436                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
437         }
438         switch (ord) {
439                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
440                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
441                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
442         }
443         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
444         abort(); // Unreachable, but will let the compiler know we don't return here
445 }
446 static jclass ChannelMonitorUpdateStatus_class = NULL;
447 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
448 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
449 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure = NULL;
450 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
451         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
452         CHECK(ChannelMonitorUpdateStatus_class != NULL);
453         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
454         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
455         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
456         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
457         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
458         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure != NULL);
459 }
460 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
461         switch (val) {
462                 case LDKChannelMonitorUpdateStatus_Completed:
463                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
464                 case LDKChannelMonitorUpdateStatus_InProgress:
465                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
466                 case LDKChannelMonitorUpdateStatus_PermanentFailure:
467                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_PermanentFailure);
468                 default: abort();
469         }
470 }
471
472 static inline LDKChannelShutdownState LDKChannelShutdownState_from_java(JNIEnv *env, jclass clz) {
473         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
474         if (UNLIKELY((*env)->ExceptionCheck(env))) {
475                 (*env)->ExceptionDescribe(env);
476                 (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust threw an exception.");
477         }
478         switch (ord) {
479                 case 0: return LDKChannelShutdownState_NotShuttingDown;
480                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
481                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
482                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
483                 case 4: return LDKChannelShutdownState_ShutdownComplete;
484         }
485         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
486         abort(); // Unreachable, but will let the compiler know we don't return here
487 }
488 static jclass ChannelShutdownState_class = NULL;
489 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
490 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
491 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
492 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
493 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
494 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
495         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
496         CHECK(ChannelShutdownState_class != NULL);
497         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
498         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
499         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
500         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
501         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
502         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
503         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
504         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
505         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
506         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
507 }
508 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
509         switch (val) {
510                 case LDKChannelShutdownState_NotShuttingDown:
511                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
512                 case LDKChannelShutdownState_ShutdownInitiated:
513                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
514                 case LDKChannelShutdownState_ResolvingHTLCs:
515                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
516                 case LDKChannelShutdownState_NegotiatingClosingFee:
517                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
518                 case LDKChannelShutdownState_ShutdownComplete:
519                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
520                 default: abort();
521         }
522 }
523
524 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
525         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
526         if (UNLIKELY((*env)->ExceptionCheck(env))) {
527                 (*env)->ExceptionDescribe(env);
528                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
529         }
530         switch (ord) {
531                 case 0: return LDKConfirmationTarget_MempoolMinimum;
532                 case 1: return LDKConfirmationTarget_Background;
533                 case 2: return LDKConfirmationTarget_Normal;
534                 case 3: return LDKConfirmationTarget_HighPriority;
535         }
536         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
537         abort(); // Unreachable, but will let the compiler know we don't return here
538 }
539 static jclass ConfirmationTarget_class = NULL;
540 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = NULL;
541 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
542 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
543 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
544 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
545         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
546         CHECK(ConfirmationTarget_class != NULL);
547         ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MempoolMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
548         CHECK(ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum != NULL);
549         ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
550         CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
551         ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
552         CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
553         ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
554         CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
555 }
556 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
557         switch (val) {
558                 case LDKConfirmationTarget_MempoolMinimum:
559                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum);
560                 case LDKConfirmationTarget_Background:
561                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
562                 case LDKConfirmationTarget_Normal:
563                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
564                 case LDKConfirmationTarget_HighPriority:
565                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
566                 default: abort();
567         }
568 }
569
570 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
571         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
572         if (UNLIKELY((*env)->ExceptionCheck(env))) {
573                 (*env)->ExceptionDescribe(env);
574                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
575         }
576         switch (ord) {
577                 case 0: return LDKCreationError_DescriptionTooLong;
578                 case 1: return LDKCreationError_RouteTooLong;
579                 case 2: return LDKCreationError_TimestampOutOfBounds;
580                 case 3: return LDKCreationError_InvalidAmount;
581                 case 4: return LDKCreationError_MissingRouteHints;
582                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
583         }
584         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
585         abort(); // Unreachable, but will let the compiler know we don't return here
586 }
587 static jclass CreationError_class = NULL;
588 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
589 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
590 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
591 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
592 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
593 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
594 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
595         CreationError_class = (*env)->NewGlobalRef(env, clz);
596         CHECK(CreationError_class != NULL);
597         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
598         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
599         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
600         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
601         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
602         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
603         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
604         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
605         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
606         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
607         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
608         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
609 }
610 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
611         switch (val) {
612                 case LDKCreationError_DescriptionTooLong:
613                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
614                 case LDKCreationError_RouteTooLong:
615                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
616                 case LDKCreationError_TimestampOutOfBounds:
617                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
618                 case LDKCreationError_InvalidAmount:
619                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
620                 case LDKCreationError_MissingRouteHints:
621                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
622                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
623                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
624                 default: abort();
625         }
626 }
627
628 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
629         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
630         if (UNLIKELY((*env)->ExceptionCheck(env))) {
631                 (*env)->ExceptionDescribe(env);
632                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
633         }
634         switch (ord) {
635                 case 0: return LDKCurrency_Bitcoin;
636                 case 1: return LDKCurrency_BitcoinTestnet;
637                 case 2: return LDKCurrency_Regtest;
638                 case 3: return LDKCurrency_Simnet;
639                 case 4: return LDKCurrency_Signet;
640         }
641         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
642         abort(); // Unreachable, but will let the compiler know we don't return here
643 }
644 static jclass Currency_class = NULL;
645 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
646 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
647 static jfieldID Currency_LDKCurrency_Regtest = NULL;
648 static jfieldID Currency_LDKCurrency_Simnet = NULL;
649 static jfieldID Currency_LDKCurrency_Signet = NULL;
650 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
651         Currency_class = (*env)->NewGlobalRef(env, clz);
652         CHECK(Currency_class != NULL);
653         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
654         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
655         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
656         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
657         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
658         CHECK(Currency_LDKCurrency_Regtest != NULL);
659         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
660         CHECK(Currency_LDKCurrency_Simnet != NULL);
661         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
662         CHECK(Currency_LDKCurrency_Signet != NULL);
663 }
664 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
665         switch (val) {
666                 case LDKCurrency_Bitcoin:
667                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
668                 case LDKCurrency_BitcoinTestnet:
669                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
670                 case LDKCurrency_Regtest:
671                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
672                 case LDKCurrency_Simnet:
673                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
674                 case LDKCurrency_Signet:
675                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
676                 default: abort();
677         }
678 }
679
680 static inline LDKFailureCode LDKFailureCode_from_java(JNIEnv *env, jclass clz) {
681         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
682         if (UNLIKELY((*env)->ExceptionCheck(env))) {
683                 (*env)->ExceptionDescribe(env);
684                 (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust threw an exception.");
685         }
686         switch (ord) {
687                 case 0: return LDKFailureCode_TemporaryNodeFailure;
688                 case 1: return LDKFailureCode_RequiredNodeFeatureMissing;
689                 case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails;
690         }
691         (*env)->FatalError(env, "A call to FailureCode.ordinal() from rust returned an invalid value.");
692         abort(); // Unreachable, but will let the compiler know we don't return here
693 }
694 static jclass FailureCode_class = NULL;
695 static jfieldID FailureCode_LDKFailureCode_TemporaryNodeFailure = NULL;
696 static jfieldID FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = NULL;
697 static jfieldID FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = NULL;
698 JNIEXPORT void JNICALL Java_org_ldk_enums_FailureCode_init (JNIEnv *env, jclass clz) {
699         FailureCode_class = (*env)->NewGlobalRef(env, clz);
700         CHECK(FailureCode_class != NULL);
701         FailureCode_LDKFailureCode_TemporaryNodeFailure = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_TemporaryNodeFailure", "Lorg/ldk/enums/FailureCode;");
702         CHECK(FailureCode_LDKFailureCode_TemporaryNodeFailure != NULL);
703         FailureCode_LDKFailureCode_RequiredNodeFeatureMissing = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_RequiredNodeFeatureMissing", "Lorg/ldk/enums/FailureCode;");
704         CHECK(FailureCode_LDKFailureCode_RequiredNodeFeatureMissing != NULL);
705         FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails = (*env)->GetStaticFieldID(env, FailureCode_class, "LDKFailureCode_IncorrectOrUnknownPaymentDetails", "Lorg/ldk/enums/FailureCode;");
706         CHECK(FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails != NULL);
707 }
708 static inline jclass LDKFailureCode_to_java(JNIEnv *env, LDKFailureCode val) {
709         switch (val) {
710                 case LDKFailureCode_TemporaryNodeFailure:
711                         return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_TemporaryNodeFailure);
712                 case LDKFailureCode_RequiredNodeFeatureMissing:
713                         return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_RequiredNodeFeatureMissing);
714                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails:
715                         return (*env)->GetStaticObjectField(env, FailureCode_class, FailureCode_LDKFailureCode_IncorrectOrUnknownPaymentDetails);
716                 default: abort();
717         }
718 }
719
720 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
721         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
722         if (UNLIKELY((*env)->ExceptionCheck(env))) {
723                 (*env)->ExceptionDescribe(env);
724                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
725         }
726         switch (ord) {
727                 case 0: return LDKHTLCClaim_OfferedTimeout;
728                 case 1: return LDKHTLCClaim_OfferedPreimage;
729                 case 2: return LDKHTLCClaim_AcceptedTimeout;
730                 case 3: return LDKHTLCClaim_AcceptedPreimage;
731                 case 4: return LDKHTLCClaim_Revocation;
732         }
733         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
734         abort(); // Unreachable, but will let the compiler know we don't return here
735 }
736 static jclass HTLCClaim_class = NULL;
737 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
738 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
739 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
740 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
741 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
742 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
743         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
744         CHECK(HTLCClaim_class != NULL);
745         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
746         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
747         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
748         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
749         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
750         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
751         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
752         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
753         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
754         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
755 }
756 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
757         switch (val) {
758                 case LDKHTLCClaim_OfferedTimeout:
759                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
760                 case LDKHTLCClaim_OfferedPreimage:
761                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
762                 case LDKHTLCClaim_AcceptedTimeout:
763                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
764                 case LDKHTLCClaim_AcceptedPreimage:
765                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
766                 case LDKHTLCClaim_Revocation:
767                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
768                 default: abort();
769         }
770 }
771
772 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
773         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
774         if (UNLIKELY((*env)->ExceptionCheck(env))) {
775                 (*env)->ExceptionDescribe(env);
776                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
777         }
778         switch (ord) {
779                 case 0: return LDKIOError_NotFound;
780                 case 1: return LDKIOError_PermissionDenied;
781                 case 2: return LDKIOError_ConnectionRefused;
782                 case 3: return LDKIOError_ConnectionReset;
783                 case 4: return LDKIOError_ConnectionAborted;
784                 case 5: return LDKIOError_NotConnected;
785                 case 6: return LDKIOError_AddrInUse;
786                 case 7: return LDKIOError_AddrNotAvailable;
787                 case 8: return LDKIOError_BrokenPipe;
788                 case 9: return LDKIOError_AlreadyExists;
789                 case 10: return LDKIOError_WouldBlock;
790                 case 11: return LDKIOError_InvalidInput;
791                 case 12: return LDKIOError_InvalidData;
792                 case 13: return LDKIOError_TimedOut;
793                 case 14: return LDKIOError_WriteZero;
794                 case 15: return LDKIOError_Interrupted;
795                 case 16: return LDKIOError_Other;
796                 case 17: return LDKIOError_UnexpectedEof;
797         }
798         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
799         abort(); // Unreachable, but will let the compiler know we don't return here
800 }
801 static jclass IOError_class = NULL;
802 static jfieldID IOError_LDKIOError_NotFound = NULL;
803 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
804 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
805 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
806 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
807 static jfieldID IOError_LDKIOError_NotConnected = NULL;
808 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
809 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
810 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
811 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
812 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
813 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
814 static jfieldID IOError_LDKIOError_InvalidData = NULL;
815 static jfieldID IOError_LDKIOError_TimedOut = NULL;
816 static jfieldID IOError_LDKIOError_WriteZero = NULL;
817 static jfieldID IOError_LDKIOError_Interrupted = NULL;
818 static jfieldID IOError_LDKIOError_Other = NULL;
819 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
820 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
821         IOError_class = (*env)->NewGlobalRef(env, clz);
822         CHECK(IOError_class != NULL);
823         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
824         CHECK(IOError_LDKIOError_NotFound != NULL);
825         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
826         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
827         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
828         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
829         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
830         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
831         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
832         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
833         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
834         CHECK(IOError_LDKIOError_NotConnected != NULL);
835         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
836         CHECK(IOError_LDKIOError_AddrInUse != NULL);
837         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
838         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
839         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
840         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
841         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
842         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
843         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
844         CHECK(IOError_LDKIOError_WouldBlock != NULL);
845         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
846         CHECK(IOError_LDKIOError_InvalidInput != NULL);
847         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
848         CHECK(IOError_LDKIOError_InvalidData != NULL);
849         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
850         CHECK(IOError_LDKIOError_TimedOut != NULL);
851         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
852         CHECK(IOError_LDKIOError_WriteZero != NULL);
853         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
854         CHECK(IOError_LDKIOError_Interrupted != NULL);
855         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
856         CHECK(IOError_LDKIOError_Other != NULL);
857         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
858         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
859 }
860 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
861         switch (val) {
862                 case LDKIOError_NotFound:
863                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
864                 case LDKIOError_PermissionDenied:
865                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
866                 case LDKIOError_ConnectionRefused:
867                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
868                 case LDKIOError_ConnectionReset:
869                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
870                 case LDKIOError_ConnectionAborted:
871                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
872                 case LDKIOError_NotConnected:
873                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
874                 case LDKIOError_AddrInUse:
875                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
876                 case LDKIOError_AddrNotAvailable:
877                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
878                 case LDKIOError_BrokenPipe:
879                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
880                 case LDKIOError_AlreadyExists:
881                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
882                 case LDKIOError_WouldBlock:
883                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
884                 case LDKIOError_InvalidInput:
885                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
886                 case LDKIOError_InvalidData:
887                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
888                 case LDKIOError_TimedOut:
889                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
890                 case LDKIOError_WriteZero:
891                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
892                 case LDKIOError_Interrupted:
893                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
894                 case LDKIOError_Other:
895                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
896                 case LDKIOError_UnexpectedEof:
897                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
898                 default: abort();
899         }
900 }
901
902 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
903         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
904         if (UNLIKELY((*env)->ExceptionCheck(env))) {
905                 (*env)->ExceptionDescribe(env);
906                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
907         }
908         switch (ord) {
909                 case 0: return LDKLevel_Gossip;
910                 case 1: return LDKLevel_Trace;
911                 case 2: return LDKLevel_Debug;
912                 case 3: return LDKLevel_Info;
913                 case 4: return LDKLevel_Warn;
914                 case 5: return LDKLevel_Error;
915         }
916         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
917         abort(); // Unreachable, but will let the compiler know we don't return here
918 }
919 static jclass Level_class = NULL;
920 static jfieldID Level_LDKLevel_Gossip = NULL;
921 static jfieldID Level_LDKLevel_Trace = NULL;
922 static jfieldID Level_LDKLevel_Debug = NULL;
923 static jfieldID Level_LDKLevel_Info = NULL;
924 static jfieldID Level_LDKLevel_Warn = NULL;
925 static jfieldID Level_LDKLevel_Error = NULL;
926 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
927         Level_class = (*env)->NewGlobalRef(env, clz);
928         CHECK(Level_class != NULL);
929         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
930         CHECK(Level_LDKLevel_Gossip != NULL);
931         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
932         CHECK(Level_LDKLevel_Trace != NULL);
933         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
934         CHECK(Level_LDKLevel_Debug != NULL);
935         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
936         CHECK(Level_LDKLevel_Info != NULL);
937         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
938         CHECK(Level_LDKLevel_Warn != NULL);
939         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
940         CHECK(Level_LDKLevel_Error != NULL);
941 }
942 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
943         switch (val) {
944                 case LDKLevel_Gossip:
945                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
946                 case LDKLevel_Trace:
947                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
948                 case LDKLevel_Debug:
949                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
950                 case LDKLevel_Info:
951                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
952                 case LDKLevel_Warn:
953                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
954                 case LDKLevel_Error:
955                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
956                 default: abort();
957         }
958 }
959
960 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
961         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
962         if (UNLIKELY((*env)->ExceptionCheck(env))) {
963                 (*env)->ExceptionDescribe(env);
964                 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
965         }
966         switch (ord) {
967                 case 0: return LDKNetwork_Bitcoin;
968                 case 1: return LDKNetwork_Testnet;
969                 case 2: return LDKNetwork_Regtest;
970                 case 3: return LDKNetwork_Signet;
971         }
972         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
973         abort(); // Unreachable, but will let the compiler know we don't return here
974 }
975 static jclass Network_class = NULL;
976 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
977 static jfieldID Network_LDKNetwork_Testnet = NULL;
978 static jfieldID Network_LDKNetwork_Regtest = NULL;
979 static jfieldID Network_LDKNetwork_Signet = NULL;
980 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
981         Network_class = (*env)->NewGlobalRef(env, clz);
982         CHECK(Network_class != NULL);
983         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
984         CHECK(Network_LDKNetwork_Bitcoin != NULL);
985         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
986         CHECK(Network_LDKNetwork_Testnet != NULL);
987         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
988         CHECK(Network_LDKNetwork_Regtest != NULL);
989         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
990         CHECK(Network_LDKNetwork_Signet != NULL);
991 }
992 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
993         switch (val) {
994                 case LDKNetwork_Bitcoin:
995                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
996                 case LDKNetwork_Testnet:
997                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
998                 case LDKNetwork_Regtest:
999                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1000                 case LDKNetwork_Signet:
1001                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1002                 default: abort();
1003         }
1004 }
1005
1006 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1007         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1008         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1009                 (*env)->ExceptionDescribe(env);
1010                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1011         }
1012         switch (ord) {
1013                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1014                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1015                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1016                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1017                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1018                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1019         }
1020         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1021         abort(); // Unreachable, but will let the compiler know we don't return here
1022 }
1023 static jclass PaymentFailureReason_class = NULL;
1024 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1025 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1026 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1027 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1028 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1029 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1030 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1031         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1032         CHECK(PaymentFailureReason_class != NULL);
1033         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1034         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1035         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1036         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1037         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1038         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1039         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1040         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1041         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1042         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1043         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1044         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1045 }
1046 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1047         switch (val) {
1048                 case LDKPaymentFailureReason_RecipientRejected:
1049                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1050                 case LDKPaymentFailureReason_UserAbandoned:
1051                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1052                 case LDKPaymentFailureReason_RetriesExhausted:
1053                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1054                 case LDKPaymentFailureReason_PaymentExpired:
1055                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1056                 case LDKPaymentFailureReason_RouteNotFound:
1057                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1058                 case LDKPaymentFailureReason_UnexpectedError:
1059                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1060                 default: abort();
1061         }
1062 }
1063
1064 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1065         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1066         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1067                 (*env)->ExceptionDescribe(env);
1068                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1069         }
1070         switch (ord) {
1071                 case 0: return LDKRecipient_Node;
1072                 case 1: return LDKRecipient_PhantomNode;
1073         }
1074         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1075         abort(); // Unreachable, but will let the compiler know we don't return here
1076 }
1077 static jclass Recipient_class = NULL;
1078 static jfieldID Recipient_LDKRecipient_Node = NULL;
1079 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1080 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1081         Recipient_class = (*env)->NewGlobalRef(env, clz);
1082         CHECK(Recipient_class != NULL);
1083         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1084         CHECK(Recipient_LDKRecipient_Node != NULL);
1085         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1086         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1087 }
1088 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1089         switch (val) {
1090                 case LDKRecipient_Node:
1091                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1092                 case LDKRecipient_PhantomNode:
1093                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1094                 default: abort();
1095         }
1096 }
1097
1098 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1099         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1100         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1101                 (*env)->ExceptionDescribe(env);
1102                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1103         }
1104         switch (ord) {
1105                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1106                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1107                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1108         }
1109         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1110         abort(); // Unreachable, but will let the compiler know we don't return here
1111 }
1112 static jclass RetryableSendFailure_class = NULL;
1113 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1114 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1115 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1116 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1117         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1118         CHECK(RetryableSendFailure_class != NULL);
1119         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1120         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1121         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1122         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1123         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1124         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1125 }
1126 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1127         switch (val) {
1128                 case LDKRetryableSendFailure_PaymentExpired:
1129                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1130                 case LDKRetryableSendFailure_RouteNotFound:
1131                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1132                 case LDKRetryableSendFailure_DuplicatePayment:
1133                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1134                 default: abort();
1135         }
1136 }
1137
1138 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1139         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1140         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1141                 (*env)->ExceptionDescribe(env);
1142                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1143         }
1144         switch (ord) {
1145                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1146                 case 1: return LDKSecp256k1Error_InvalidMessage;
1147                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1148                 case 3: return LDKSecp256k1Error_InvalidSignature;
1149                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1150                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1151                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1152                 case 7: return LDKSecp256k1Error_InvalidTweak;
1153                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1154                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1155                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1156         }
1157         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1158         abort(); // Unreachable, but will let the compiler know we don't return here
1159 }
1160 static jclass Secp256k1Error_class = NULL;
1161 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1162 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1163 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1164 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1165 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1166 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1167 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1168 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1169 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1170 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1171 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1172 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1173         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1174         CHECK(Secp256k1Error_class != NULL);
1175         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1176         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1177         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1178         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1179         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1180         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1181         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1182         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1183         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1184         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1185         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1186         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1187         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1188         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1189         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1190         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1191         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1192         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1193         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1194         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1195         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1196         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1197 }
1198 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1199         switch (val) {
1200                 case LDKSecp256k1Error_IncorrectSignature:
1201                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1202                 case LDKSecp256k1Error_InvalidMessage:
1203                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1204                 case LDKSecp256k1Error_InvalidPublicKey:
1205                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1206                 case LDKSecp256k1Error_InvalidSignature:
1207                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1208                 case LDKSecp256k1Error_InvalidSecretKey:
1209                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1210                 case LDKSecp256k1Error_InvalidSharedSecret:
1211                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1212                 case LDKSecp256k1Error_InvalidRecoveryId:
1213                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1214                 case LDKSecp256k1Error_InvalidTweak:
1215                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1216                 case LDKSecp256k1Error_NotEnoughMemory:
1217                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1218                 case LDKSecp256k1Error_InvalidPublicKeySum:
1219                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1220                 case LDKSecp256k1Error_InvalidParityValue:
1221                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1222                 default: abort();
1223         }
1224 }
1225
1226 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1227         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1228         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1229                 (*env)->ExceptionDescribe(env);
1230                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1231         }
1232         switch (ord) {
1233                 case 0: return LDKSiPrefix_Milli;
1234                 case 1: return LDKSiPrefix_Micro;
1235                 case 2: return LDKSiPrefix_Nano;
1236                 case 3: return LDKSiPrefix_Pico;
1237         }
1238         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1239         abort(); // Unreachable, but will let the compiler know we don't return here
1240 }
1241 static jclass SiPrefix_class = NULL;
1242 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1243 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1244 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1245 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1246 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1247         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1248         CHECK(SiPrefix_class != NULL);
1249         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1250         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1251         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1252         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1253         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1254         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1255         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1256         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1257 }
1258 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1259         switch (val) {
1260                 case LDKSiPrefix_Milli:
1261                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1262                 case LDKSiPrefix_Micro:
1263                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1264                 case LDKSiPrefix_Nano:
1265                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1266                 case LDKSiPrefix_Pico:
1267                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1268                 default: abort();
1269         }
1270 }
1271
1272 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1273         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1274         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1275                 (*env)->ExceptionDescribe(env);
1276                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1277         }
1278         switch (ord) {
1279                 case 0: return LDKUtxoLookupError_UnknownChain;
1280                 case 1: return LDKUtxoLookupError_UnknownTx;
1281         }
1282         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1283         abort(); // Unreachable, but will let the compiler know we don't return here
1284 }
1285 static jclass UtxoLookupError_class = NULL;
1286 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1287 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1288 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1289         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1290         CHECK(UtxoLookupError_class != NULL);
1291         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1292         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1293         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1294         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1295 }
1296 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1297         switch (val) {
1298                 case LDKUtxoLookupError_UnknownChain:
1299                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1300                 case LDKUtxoLookupError_UnknownTx:
1301                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1302                 default: abort();
1303         }
1304 }
1305
1306 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1307         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1308         return ret;
1309 }
1310 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1311         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1312         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1313         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1314         return ret_arr;
1315 }
1316
1317 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1319         if (!ptr_is_owned(thing)) return;
1320         void* thing_ptr = untag_ptr(thing);
1321         CHECK_ACCESS(thing_ptr);
1322         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1323         FREE(untag_ptr(thing));
1324         BigEndianScalar_free(thing_conv);
1325 }
1326
1327 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1328 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1329 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1330 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1331 static jclass LDKBech32Error_InvalidLength_class = NULL;
1332 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1333 static jclass LDKBech32Error_InvalidChar_class = NULL;
1334 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1335 static jclass LDKBech32Error_InvalidData_class = NULL;
1336 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1337 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1338 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1339 static jclass LDKBech32Error_MixedCase_class = NULL;
1340 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1342         LDKBech32Error_MissingSeparator_class =
1343                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1344         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1345         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1346         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1347         LDKBech32Error_InvalidChecksum_class =
1348                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1349         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1350         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1351         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1352         LDKBech32Error_InvalidLength_class =
1353                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1354         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1355         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1356         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1357         LDKBech32Error_InvalidChar_class =
1358                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1359         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1360         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1361         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1362         LDKBech32Error_InvalidData_class =
1363                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1364         CHECK(LDKBech32Error_InvalidData_class != NULL);
1365         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1366         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1367         LDKBech32Error_InvalidPadding_class =
1368                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1369         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1370         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1371         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1372         LDKBech32Error_MixedCase_class =
1373                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1374         CHECK(LDKBech32Error_MixedCase_class != NULL);
1375         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1376         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1377 }
1378 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1379         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1380         switch(obj->tag) {
1381                 case LDKBech32Error_MissingSeparator: {
1382                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1383                 }
1384                 case LDKBech32Error_InvalidChecksum: {
1385                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1386                 }
1387                 case LDKBech32Error_InvalidLength: {
1388                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1389                 }
1390                 case LDKBech32Error_InvalidChar: {
1391                         int32_t invalid_char_conv = obj->invalid_char;
1392                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1393                 }
1394                 case LDKBech32Error_InvalidData: {
1395                         int8_t invalid_data_conv = obj->invalid_data;
1396                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1397                 }
1398                 case LDKBech32Error_InvalidPadding: {
1399                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1400                 }
1401                 case LDKBech32Error_MixedCase: {
1402                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1403                 }
1404                 default: abort();
1405         }
1406 }
1407 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1408         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1409         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1410         return ret;
1411 }
1412 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) {
1413         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1414         LDKWitness ret_var = TxIn_get_witness(thing_conv);
1415         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1416         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1417         Witness_free(ret_var);
1418         return ret_arr;
1419 }
1420
1421 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) {
1422         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1423         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
1424         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1425         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1426         CVec_u8Z_free(ret_var);
1427         return ret_arr;
1428 }
1429
1430 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) {
1431         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1432         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1433         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(thing_conv).data);
1434         return ret_arr;
1435 }
1436
1437 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) {
1438         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1439         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
1440         return ret_conv;
1441 }
1442
1443 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) {
1444         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
1445         int32_t ret_conv = TxIn_get_sequence(thing_conv);
1446         return ret_conv;
1447 }
1448
1449 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) {
1450         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1451         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
1452         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1453         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1454         CVec_u8Z_free(ret_var);
1455         return ret_arr;
1456 }
1457
1458 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) {
1459         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
1460         int64_t ret_conv = TxOut_get_value(thing_conv);
1461         return ret_conv;
1462 }
1463
1464 static jclass LDKCOption_DurationZ_Some_class = NULL;
1465 static jmethodID LDKCOption_DurationZ_Some_meth = NULL;
1466 static jclass LDKCOption_DurationZ_None_class = NULL;
1467 static jmethodID LDKCOption_DurationZ_None_meth = NULL;
1468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1DurationZ_init (JNIEnv *env, jclass clz) {
1469         LDKCOption_DurationZ_Some_class =
1470                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_DurationZ$Some"));
1471         CHECK(LDKCOption_DurationZ_Some_class != NULL);
1472         LDKCOption_DurationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_DurationZ_Some_class, "<init>", "(J)V");
1473         CHECK(LDKCOption_DurationZ_Some_meth != NULL);
1474         LDKCOption_DurationZ_None_class =
1475                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_DurationZ$None"));
1476         CHECK(LDKCOption_DurationZ_None_class != NULL);
1477         LDKCOption_DurationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_DurationZ_None_class, "<init>", "()V");
1478         CHECK(LDKCOption_DurationZ_None_meth != NULL);
1479 }
1480 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1DurationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1481         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
1482         switch(obj->tag) {
1483                 case LDKCOption_DurationZ_Some: {
1484                         int64_t some_conv = obj->some;
1485                         return (*env)->NewObject(env, LDKCOption_DurationZ_Some_class, LDKCOption_DurationZ_Some_meth, some_conv);
1486                 }
1487                 case LDKCOption_DurationZ_None: {
1488                         return (*env)->NewObject(env, LDKCOption_DurationZ_None_class, LDKCOption_DurationZ_None_meth);
1489                 }
1490                 default: abort();
1491         }
1492 }
1493 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1494         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1495         for (size_t i = 0; i < ret.datalen; i++) {
1496                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1497         }
1498         return ret;
1499 }
1500 static jclass LDKCOption_u64Z_Some_class = NULL;
1501 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1502 static jclass LDKCOption_u64Z_None_class = NULL;
1503 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1505         LDKCOption_u64Z_Some_class =
1506                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1507         CHECK(LDKCOption_u64Z_Some_class != NULL);
1508         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1509         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1510         LDKCOption_u64Z_None_class =
1511                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1512         CHECK(LDKCOption_u64Z_None_class != NULL);
1513         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1514         CHECK(LDKCOption_u64Z_None_meth != NULL);
1515 }
1516 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1517         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1518         switch(obj->tag) {
1519                 case LDKCOption_u64Z_Some: {
1520                         int64_t some_conv = obj->some;
1521                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1522                 }
1523                 case LDKCOption_u64Z_None: {
1524                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1525                 }
1526                 default: abort();
1527         }
1528 }
1529 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1530         LDKRefund ret = *owner->contents.result;
1531         ret.is_owned = false;
1532         return ret;
1533 }
1534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1535         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1536         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1537         int64_t ret_ref = 0;
1538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1540         return ret_ref;
1541 }
1542
1543 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1544         LDKBolt12ParseError ret = *owner->contents.err;
1545         ret.is_owned = false;
1546         return ret;
1547 }
1548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1549         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1550         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1551         int64_t ret_ref = 0;
1552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1554         return ret_ref;
1555 }
1556
1557 static jclass LDKAPIError_APIMisuseError_class = NULL;
1558 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1559 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1560 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1561 static jclass LDKAPIError_InvalidRoute_class = NULL;
1562 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1563 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1564 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1565 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1566 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1567 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1568 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1570         LDKAPIError_APIMisuseError_class =
1571                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1572         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1573         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1574         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1575         LDKAPIError_FeeRateTooHigh_class =
1576                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1577         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1578         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1579         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1580         LDKAPIError_InvalidRoute_class =
1581                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1582         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1583         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1584         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1585         LDKAPIError_ChannelUnavailable_class =
1586                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1587         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1588         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1589         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1590         LDKAPIError_MonitorUpdateInProgress_class =
1591                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1592         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1593         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1594         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1595         LDKAPIError_IncompatibleShutdownScript_class =
1596                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1597         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1598         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1599         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1600 }
1601 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1602         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1603         switch(obj->tag) {
1604                 case LDKAPIError_APIMisuseError: {
1605                         LDKStr err_str = obj->api_misuse_error.err;
1606                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1607                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1608                 }
1609                 case LDKAPIError_FeeRateTooHigh: {
1610                         LDKStr err_str = obj->fee_rate_too_high.err;
1611                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1612                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1613                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1614                 }
1615                 case LDKAPIError_InvalidRoute: {
1616                         LDKStr err_str = obj->invalid_route.err;
1617                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1618                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1619                 }
1620                 case LDKAPIError_ChannelUnavailable: {
1621                         LDKStr err_str = obj->channel_unavailable.err;
1622                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1623                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1624                 }
1625                 case LDKAPIError_MonitorUpdateInProgress: {
1626                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1627                 }
1628                 case LDKAPIError_IncompatibleShutdownScript: {
1629                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1630                         int64_t script_ref = 0;
1631                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1632                         script_ref = tag_ptr(script_var.inner, false);
1633                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
1634                 }
1635                 default: abort();
1636         }
1637 }
1638 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1639 CHECK(owner->result_ok);
1640         return *owner->contents.result;
1641 }
1642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1643         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1644         CResult_NoneAPIErrorZ_get_ok(owner_conv);
1645 }
1646
1647 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
1648 CHECK(!owner->result_ok);
1649         return APIError_clone(&*owner->contents.err);
1650 }
1651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1652         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
1653         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
1654         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
1655         int64_t ret_ref = tag_ptr(ret_copy, true);
1656         return ret_ref;
1657 }
1658
1659 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
1660         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
1661         for (size_t i = 0; i < ret.datalen; i++) {
1662                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
1663         }
1664         return ret;
1665 }
1666 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
1667         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
1668         for (size_t i = 0; i < ret.datalen; i++) {
1669                 ret.data[i] = APIError_clone(&orig->data[i]);
1670         }
1671         return ret;
1672 }
1673 static jclass LDKCOption_PaymentSecretZ_Some_class = NULL;
1674 static jmethodID LDKCOption_PaymentSecretZ_Some_meth = NULL;
1675 static jclass LDKCOption_PaymentSecretZ_None_class = NULL;
1676 static jmethodID LDKCOption_PaymentSecretZ_None_meth = NULL;
1677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentSecretZ_init (JNIEnv *env, jclass clz) {
1678         LDKCOption_PaymentSecretZ_Some_class =
1679                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentSecretZ$Some"));
1680         CHECK(LDKCOption_PaymentSecretZ_Some_class != NULL);
1681         LDKCOption_PaymentSecretZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentSecretZ_Some_class, "<init>", "([B)V");
1682         CHECK(LDKCOption_PaymentSecretZ_Some_meth != NULL);
1683         LDKCOption_PaymentSecretZ_None_class =
1684                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentSecretZ$None"));
1685         CHECK(LDKCOption_PaymentSecretZ_None_class != NULL);
1686         LDKCOption_PaymentSecretZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentSecretZ_None_class, "<init>", "()V");
1687         CHECK(LDKCOption_PaymentSecretZ_None_meth != NULL);
1688 }
1689 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentSecretZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1690         LDKCOption_PaymentSecretZ *obj = (LDKCOption_PaymentSecretZ*)untag_ptr(ptr);
1691         switch(obj->tag) {
1692                 case LDKCOption_PaymentSecretZ_Some: {
1693                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
1694                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
1695                         return (*env)->NewObject(env, LDKCOption_PaymentSecretZ_Some_class, LDKCOption_PaymentSecretZ_Some_meth, some_arr);
1696                 }
1697                 case LDKCOption_PaymentSecretZ_None: {
1698                         return (*env)->NewObject(env, LDKCOption_PaymentSecretZ_None_class, LDKCOption_PaymentSecretZ_None_meth);
1699                 }
1700                 default: abort();
1701         }
1702 }
1703 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
1704 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
1705 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
1706 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
1707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
1708         LDKCOption_CVec_u8ZZ_Some_class =
1709                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
1710         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
1711         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
1712         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
1713         LDKCOption_CVec_u8ZZ_None_class =
1714                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
1715         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
1716         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
1717         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
1718 }
1719 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1720         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
1721         switch(obj->tag) {
1722                 case LDKCOption_CVec_u8ZZ_Some: {
1723                         LDKCVec_u8Z some_var = obj->some;
1724                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
1725                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
1726                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
1727                 }
1728                 case LDKCOption_CVec_u8ZZ_None: {
1729                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
1730                 }
1731                 default: abort();
1732         }
1733 }
1734 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1735 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1736 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1737 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1738 static jclass LDKDecodeError_InvalidValue_class = NULL;
1739 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1740 static jclass LDKDecodeError_ShortRead_class = NULL;
1741 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1742 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1743 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1744 static jclass LDKDecodeError_Io_class = NULL;
1745 static jmethodID LDKDecodeError_Io_meth = NULL;
1746 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1747 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1749         LDKDecodeError_UnknownVersion_class =
1750                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1751         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1752         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1753         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1754         LDKDecodeError_UnknownRequiredFeature_class =
1755                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1756         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1757         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1758         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1759         LDKDecodeError_InvalidValue_class =
1760                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1761         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1762         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1763         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1764         LDKDecodeError_ShortRead_class =
1765                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1766         CHECK(LDKDecodeError_ShortRead_class != NULL);
1767         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1768         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1769         LDKDecodeError_BadLengthDescriptor_class =
1770                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1771         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1772         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1773         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1774         LDKDecodeError_Io_class =
1775                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1776         CHECK(LDKDecodeError_Io_class != NULL);
1777         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1778         CHECK(LDKDecodeError_Io_meth != NULL);
1779         LDKDecodeError_UnsupportedCompression_class =
1780                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1781         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1782         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1783         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1784 }
1785 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1786         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1787         switch(obj->tag) {
1788                 case LDKDecodeError_UnknownVersion: {
1789                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1790                 }
1791                 case LDKDecodeError_UnknownRequiredFeature: {
1792                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1793                 }
1794                 case LDKDecodeError_InvalidValue: {
1795                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1796                 }
1797                 case LDKDecodeError_ShortRead: {
1798                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1799                 }
1800                 case LDKDecodeError_BadLengthDescriptor: {
1801                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1802                 }
1803                 case LDKDecodeError_Io: {
1804                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1805                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1806                 }
1807                 case LDKDecodeError_UnsupportedCompression: {
1808                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1809                 }
1810                 default: abort();
1811         }
1812 }
1813 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1814         LDKRecipientOnionFields ret = *owner->contents.result;
1815         ret.is_owned = false;
1816         return ret;
1817 }
1818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1819         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1820         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
1821         int64_t ret_ref = 0;
1822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1824         return ret_ref;
1825 }
1826
1827 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
1828 CHECK(!owner->result_ok);
1829         return DecodeError_clone(&*owner->contents.err);
1830 }
1831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1832         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
1833         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1834         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
1835         int64_t ret_ref = tag_ptr(ret_copy, true);
1836         return ret_ref;
1837 }
1838
1839 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1840         LDKBlindedPayInfo ret = *owner->contents.result;
1841         ret.is_owned = false;
1842         return ret;
1843 }
1844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1845         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1846         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1847         int64_t ret_ref = 0;
1848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1850         return ret_ref;
1851 }
1852
1853 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1854 CHECK(!owner->result_ok);
1855         return DecodeError_clone(&*owner->contents.err);
1856 }
1857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1858         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1859         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1860         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1861         int64_t ret_ref = tag_ptr(ret_copy, true);
1862         return ret_ref;
1863 }
1864
1865 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1866         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1867         ret.is_owned = false;
1868         return ret;
1869 }
1870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1871         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1872         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1873         int64_t ret_ref = 0;
1874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1876         return ret_ref;
1877 }
1878
1879 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1880 CHECK(!owner->result_ok);
1881         return DecodeError_clone(&*owner->contents.err);
1882 }
1883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1884         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1885         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1886         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1887         int64_t ret_ref = tag_ptr(ret_copy, true);
1888         return ret_ref;
1889 }
1890
1891 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1892         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1893         ret.is_owned = false;
1894         return ret;
1895 }
1896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1897         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1898         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1899         int64_t ret_ref = 0;
1900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1902         return ret_ref;
1903 }
1904
1905 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1906 CHECK(!owner->result_ok);
1907         return DecodeError_clone(&*owner->contents.err);
1908 }
1909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1910         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1911         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1912         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1913         int64_t ret_ref = tag_ptr(ret_copy, true);
1914         return ret_ref;
1915 }
1916
1917 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1918 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1919 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1920 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1921 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1922 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1924         LDKSpendableOutputDescriptor_StaticOutput_class =
1925                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
1926         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1927         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1928         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1929         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1930                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
1931         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1932         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1933         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1934         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1935                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
1936         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1937         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1938         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1939 }
1940 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1941         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1942         switch(obj->tag) {
1943                 case LDKSpendableOutputDescriptor_StaticOutput: {
1944                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1945                         int64_t outpoint_ref = 0;
1946                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1947                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1948                         LDKTxOut* output_ref = &obj->static_output.output;
1949                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false));
1950                 }
1951                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1952                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1953                         int64_t delayed_payment_output_ref = 0;
1954                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1955                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1956                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1957                 }
1958                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1959                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1960                         int64_t static_payment_output_ref = 0;
1961                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1962                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1963                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1964                 }
1965                 default: abort();
1966         }
1967 }
1968 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1969 CHECK(owner->result_ok);
1970         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1971 }
1972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1973         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1974         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1975         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1976         int64_t ret_ref = tag_ptr(ret_copy, true);
1977         return ret_ref;
1978 }
1979
1980 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1981 CHECK(!owner->result_ok);
1982         return DecodeError_clone(&*owner->contents.err);
1983 }
1984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1985         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1986         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1987         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1988         int64_t ret_ref = tag_ptr(ret_copy, true);
1989         return ret_ref;
1990 }
1991
1992 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1993         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1994         for (size_t i = 0; i < ret.datalen; i++) {
1995                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1996         }
1997         return ret;
1998 }
1999 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2000         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2001         for (size_t i = 0; i < ret.datalen; i++) {
2002                 ret.data[i] = TxOut_clone(&orig->data[i]);
2003         }
2004         return ret;
2005 }
2006 static jclass LDKCOption_PackedLockTimeZ_Some_class = NULL;
2007 static jmethodID LDKCOption_PackedLockTimeZ_Some_meth = NULL;
2008 static jclass LDKCOption_PackedLockTimeZ_None_class = NULL;
2009 static jmethodID LDKCOption_PackedLockTimeZ_None_meth = NULL;
2010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PackedLockTimeZ_init (JNIEnv *env, jclass clz) {
2011         LDKCOption_PackedLockTimeZ_Some_class =
2012                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PackedLockTimeZ$Some"));
2013         CHECK(LDKCOption_PackedLockTimeZ_Some_class != NULL);
2014         LDKCOption_PackedLockTimeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PackedLockTimeZ_Some_class, "<init>", "(I)V");
2015         CHECK(LDKCOption_PackedLockTimeZ_Some_meth != NULL);
2016         LDKCOption_PackedLockTimeZ_None_class =
2017                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PackedLockTimeZ$None"));
2018         CHECK(LDKCOption_PackedLockTimeZ_None_class != NULL);
2019         LDKCOption_PackedLockTimeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PackedLockTimeZ_None_class, "<init>", "()V");
2020         CHECK(LDKCOption_PackedLockTimeZ_None_meth != NULL);
2021 }
2022 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PackedLockTimeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2023         LDKCOption_PackedLockTimeZ *obj = (LDKCOption_PackedLockTimeZ*)untag_ptr(ptr);
2024         switch(obj->tag) {
2025                 case LDKCOption_PackedLockTimeZ_Some: {
2026                         int32_t some_conv = obj->some;
2027                         return (*env)->NewObject(env, LDKCOption_PackedLockTimeZ_Some_class, LDKCOption_PackedLockTimeZ_Some_meth, some_conv);
2028                 }
2029                 case LDKCOption_PackedLockTimeZ_None: {
2030                         return (*env)->NewObject(env, LDKCOption_PackedLockTimeZ_None_class, LDKCOption_PackedLockTimeZ_None_meth);
2031                 }
2032                 default: abort();
2033         }
2034 }
2035 static inline struct LDKCVec_u8Z C2Tuple_PartiallySignedTransactionusizeZ_get_a(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR owner){
2036         return CVec_u8Z_clone(&owner->a);
2037 }
2038 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2039         LDKC2Tuple_PartiallySignedTransactionusizeZ* owner_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(owner);
2040         LDKCVec_u8Z ret_var = C2Tuple_PartiallySignedTransactionusizeZ_get_a(owner_conv);
2041         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2042         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2043         CVec_u8Z_free(ret_var);
2044         return ret_arr;
2045 }
2046
2047 static inline uintptr_t C2Tuple_PartiallySignedTransactionusizeZ_get_b(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR owner){
2048         return owner->b;
2049 }
2050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2051         LDKC2Tuple_PartiallySignedTransactionusizeZ* owner_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(owner);
2052         int64_t ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_get_b(owner_conv);
2053         return ret_conv;
2054 }
2055
2056 static inline struct LDKC2Tuple_PartiallySignedTransactionusizeZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR owner){
2057 CHECK(owner->result_ok);
2058         return C2Tuple_PartiallySignedTransactionusizeZ_clone(&*owner->contents.result);
2059 }
2060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2061         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(owner);
2062         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
2063         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(owner_conv);
2064         return tag_ptr(ret_conv, true);
2065 }
2066
2067 static inline void CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR owner){
2068 CHECK(!owner->result_ok);
2069         return *owner->contents.err;
2070 }
2071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2072         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(owner);
2073         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(owner_conv);
2074 }
2075
2076 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
2077         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
2078         for (size_t i = 0; i < ret.datalen; i++) {
2079                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2080         }
2081         return ret;
2082 }
2083 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2084 CHECK(owner->result_ok);
2085         return *owner->contents.result;
2086 }
2087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2088         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2089         CResult_NoneNoneZ_get_ok(owner_conv);
2090 }
2091
2092 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2093 CHECK(!owner->result_ok);
2094         return *owner->contents.err;
2095 }
2096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2097         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2098         CResult_NoneNoneZ_get_err(owner_conv);
2099 }
2100
2101 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
2102         return owner->a;
2103 }
2104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2105         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
2106         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2107         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
2108         return ret_arr;
2109 }
2110
2111 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
2112         return owner->b;
2113 }
2114 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2115         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
2116         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
2117         jobjectArray ret_arr = NULL;
2118         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2119         ;
2120         for (size_t i = 0; i < ret_var.datalen; i++) {
2121                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2122                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2123                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2124         }
2125         
2126         return ret_arr;
2127 }
2128
2129 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
2130 CHECK(owner->result_ok);
2131         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
2132 }
2133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2134         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
2135         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2136         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
2137         return tag_ptr(ret_conv, true);
2138 }
2139
2140 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
2141 CHECK(!owner->result_ok);
2142         return *owner->contents.err;
2143 }
2144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2145         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
2146         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
2147 }
2148
2149 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
2150 CHECK(owner->result_ok);
2151         return *owner->contents.result;
2152 }
2153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2154         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
2155         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2156         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
2157         return ret_arr;
2158 }
2159
2160 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
2161 CHECK(!owner->result_ok);
2162         return *owner->contents.err;
2163 }
2164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2165         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
2166         CResult_SignatureNoneZ_get_err(owner_conv);
2167 }
2168
2169 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2170 CHECK(owner->result_ok);
2171         return *owner->contents.result;
2172 }
2173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2174         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2175         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2176         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2177         return ret_arr;
2178 }
2179
2180 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2181 CHECK(!owner->result_ok);
2182         return *owner->contents.err;
2183 }
2184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2185         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2186         CResult_PublicKeyNoneZ_get_err(owner_conv);
2187 }
2188
2189 static jclass LDKCOption_ScalarZ_Some_class = NULL;
2190 static jmethodID LDKCOption_ScalarZ_Some_meth = NULL;
2191 static jclass LDKCOption_ScalarZ_None_class = NULL;
2192 static jmethodID LDKCOption_ScalarZ_None_meth = NULL;
2193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ScalarZ_init (JNIEnv *env, jclass clz) {
2194         LDKCOption_ScalarZ_Some_class =
2195                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScalarZ$Some"));
2196         CHECK(LDKCOption_ScalarZ_Some_class != NULL);
2197         LDKCOption_ScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ScalarZ_Some_class, "<init>", "(J)V");
2198         CHECK(LDKCOption_ScalarZ_Some_meth != NULL);
2199         LDKCOption_ScalarZ_None_class =
2200                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScalarZ$None"));
2201         CHECK(LDKCOption_ScalarZ_None_class != NULL);
2202         LDKCOption_ScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ScalarZ_None_class, "<init>", "()V");
2203         CHECK(LDKCOption_ScalarZ_None_meth != NULL);
2204 }
2205 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2206         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
2207         switch(obj->tag) {
2208                 case LDKCOption_ScalarZ_Some: {
2209                         LDKBigEndianScalar* some_ref = &obj->some;
2210                         return (*env)->NewObject(env, LDKCOption_ScalarZ_Some_class, LDKCOption_ScalarZ_Some_meth, tag_ptr(some_ref, false));
2211                 }
2212                 case LDKCOption_ScalarZ_None: {
2213                         return (*env)->NewObject(env, LDKCOption_ScalarZ_None_class, LDKCOption_ScalarZ_None_meth);
2214                 }
2215                 default: abort();
2216         }
2217 }
2218 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
2219 CHECK(owner->result_ok);
2220         return ThirtyTwoBytes_clone(&*owner->contents.result);
2221 }
2222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2223         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
2224         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2225         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SharedSecretNoneZ_get_ok(owner_conv).data);
2226         return ret_arr;
2227 }
2228
2229 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
2230 CHECK(!owner->result_ok);
2231         return *owner->contents.err;
2232 }
2233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2234         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
2235         CResult_SharedSecretNoneZ_get_err(owner_conv);
2236 }
2237
2238 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2239 CHECK(owner->result_ok);
2240         return *owner->contents.result;
2241 }
2242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2243         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2244         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2245         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2246         return ret_arr;
2247 }
2248
2249 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2250 CHECK(!owner->result_ok);
2251         return *owner->contents.err;
2252 }
2253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2254         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2255         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2256 }
2257
2258 typedef struct LDKChannelSigner_JCalls {
2259         atomic_size_t refcnt;
2260         JavaVM *vm;
2261         jweak o;
2262         jmethodID get_per_commitment_point_meth;
2263         jmethodID release_commitment_secret_meth;
2264         jmethodID validate_holder_commitment_meth;
2265         jmethodID channel_keys_id_meth;
2266         jmethodID provide_channel_parameters_meth;
2267 } LDKChannelSigner_JCalls;
2268 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2269         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2270         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2271                 JNIEnv *env;
2272                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2273                 if (get_jenv_res == JNI_EDETACHED) {
2274                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2275                 } else {
2276                         DO_ASSERT(get_jenv_res == JNI_OK);
2277                 }
2278                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2279                 if (get_jenv_res == JNI_EDETACHED) {
2280                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2281                 }
2282                 FREE(j_calls);
2283         }
2284 }
2285 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2286         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2287         JNIEnv *env;
2288         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2289         if (get_jenv_res == JNI_EDETACHED) {
2290                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2291         } else {
2292                 DO_ASSERT(get_jenv_res == JNI_OK);
2293         }
2294         int64_t idx_conv = idx;
2295         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2296         CHECK(obj != NULL);
2297         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2298         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2299                 (*env)->ExceptionDescribe(env);
2300                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2301         }
2302         LDKPublicKey ret_ref;
2303         CHECK((*env)->GetArrayLength(env, ret) == 33);
2304         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2305         if (get_jenv_res == JNI_EDETACHED) {
2306                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2307         }
2308         return ret_ref;
2309 }
2310 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2311         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2312         JNIEnv *env;
2313         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2314         if (get_jenv_res == JNI_EDETACHED) {
2315                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2316         } else {
2317                 DO_ASSERT(get_jenv_res == JNI_OK);
2318         }
2319         int64_t idx_conv = idx;
2320         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2321         CHECK(obj != NULL);
2322         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2323         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2324                 (*env)->ExceptionDescribe(env);
2325                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2326         }
2327         LDKThirtyTwoBytes ret_ref;
2328         CHECK((*env)->GetArrayLength(env, ret) == 32);
2329         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2330         if (get_jenv_res == JNI_EDETACHED) {
2331                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2332         }
2333         return ret_ref;
2334 }
2335 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
2336         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2337         JNIEnv *env;
2338         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2339         if (get_jenv_res == JNI_EDETACHED) {
2340                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2341         } else {
2342                 DO_ASSERT(get_jenv_res == JNI_OK);
2343         }
2344         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2345         int64_t holder_tx_ref = 0;
2346         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2347         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2348         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2349         LDKCVec_PaymentPreimageZ preimages_var = preimages;
2350         jobjectArray preimages_arr = NULL;
2351         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2352         ;
2353         for (size_t i = 0; i < preimages_var.datalen; i++) {
2354                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2355                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2356                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2357         }
2358         
2359         FREE(preimages_var.data);
2360         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2361         CHECK(obj != NULL);
2362         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
2363         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2364                 (*env)->ExceptionDescribe(env);
2365                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
2366         }
2367         void* ret_ptr = untag_ptr(ret);
2368         CHECK_ACCESS(ret_ptr);
2369         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2370         FREE(untag_ptr(ret));
2371         if (get_jenv_res == JNI_EDETACHED) {
2372                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2373         }
2374         return ret_conv;
2375 }
2376 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
2377         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2378         JNIEnv *env;
2379         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2380         if (get_jenv_res == JNI_EDETACHED) {
2381                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2382         } else {
2383                 DO_ASSERT(get_jenv_res == JNI_OK);
2384         }
2385         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2386         CHECK(obj != NULL);
2387         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2388         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2389                 (*env)->ExceptionDescribe(env);
2390                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
2391         }
2392         LDKThirtyTwoBytes ret_ref;
2393         CHECK((*env)->GetArrayLength(env, ret) == 32);
2394         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2395         if (get_jenv_res == JNI_EDETACHED) {
2396                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2397         }
2398         return ret_ref;
2399 }
2400 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2401         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2402         JNIEnv *env;
2403         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2404         if (get_jenv_res == JNI_EDETACHED) {
2405                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2406         } else {
2407                 DO_ASSERT(get_jenv_res == JNI_OK);
2408         }
2409         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2410         int64_t channel_parameters_ref = 0;
2411         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
2412         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
2413         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
2414         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2415         CHECK(obj != NULL);
2416         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
2417         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2418                 (*env)->ExceptionDescribe(env);
2419                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
2420         }
2421         if (get_jenv_res == JNI_EDETACHED) {
2422                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2423         }
2424 }
2425 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2426         jclass c = (*env)->GetObjectClass(env, o);
2427         CHECK(c != NULL);
2428         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
2429         atomic_init(&calls->refcnt, 1);
2430         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2431         calls->o = (*env)->NewWeakGlobalRef(env, o);
2432         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2433         CHECK(calls->get_per_commitment_point_meth != NULL);
2434         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2435         CHECK(calls->release_commitment_secret_meth != NULL);
2436         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
2437         CHECK(calls->validate_holder_commitment_meth != NULL);
2438         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2439         CHECK(calls->channel_keys_id_meth != NULL);
2440         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
2441         CHECK(calls->provide_channel_parameters_meth != NULL);
2442
2443         LDKChannelPublicKeys pubkeys_conv;
2444         pubkeys_conv.inner = untag_ptr(pubkeys);
2445         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2446         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2447
2448         LDKChannelSigner ret = {
2449                 .this_arg = (void*) calls,
2450                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
2451                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
2452                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
2453                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
2454                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
2455                 .free = LDKChannelSigner_JCalls_free,
2456                 .pubkeys = pubkeys_conv,
2457                 .set_pubkeys = NULL,
2458         };
2459         return ret;
2460 }
2461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2462         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
2463         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
2464         return tag_ptr(res_ptr, true);
2465 }
2466 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) {
2467         void* this_arg_ptr = untag_ptr(this_arg);
2468         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2469         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2470         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2471         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2472         return ret_arr;
2473 }
2474
2475 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2476         void* this_arg_ptr = untag_ptr(this_arg);
2477         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2478         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2479         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2480         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2481         return ret_arr;
2482 }
2483
2484 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) {
2485         void* this_arg_ptr = untag_ptr(this_arg);
2486         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2487         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2488         LDKHolderCommitmentTransaction holder_tx_conv;
2489         holder_tx_conv.inner = untag_ptr(holder_tx);
2490         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
2491         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
2492         holder_tx_conv.is_owned = false;
2493         LDKCVec_PaymentPreimageZ preimages_constr;
2494         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
2495         if (preimages_constr.datalen > 0)
2496                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
2497         else
2498                 preimages_constr.data = NULL;
2499         for (size_t i = 0; i < preimages_constr.datalen; i++) {
2500                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
2501                 LDKThirtyTwoBytes preimages_conv_8_ref;
2502                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
2503                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
2504                 preimages_constr.data[i] = preimages_conv_8_ref;
2505         }
2506         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2507         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
2508         return tag_ptr(ret_conv, true);
2509 }
2510
2511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2512         void* this_arg_ptr = untag_ptr(this_arg);
2513         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2514         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2515         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2516         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2517         return ret_arr;
2518 }
2519
2520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2521         void* this_arg_ptr = untag_ptr(this_arg);
2522         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2523         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2524         LDKChannelTransactionParameters channel_parameters_conv;
2525         channel_parameters_conv.inner = untag_ptr(channel_parameters);
2526         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
2527         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
2528         channel_parameters_conv.is_owned = false;
2529         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
2530 }
2531
2532 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
2533         if (this_arg->set_pubkeys != NULL)
2534                 this_arg->set_pubkeys(this_arg);
2535         return this_arg->pubkeys;
2536 }
2537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2538         void* this_arg_ptr = untag_ptr(this_arg);
2539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2540         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
2541         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
2542         int64_t ret_ref = 0;
2543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2545         return ret_ref;
2546 }
2547
2548 typedef struct LDKEcdsaChannelSigner_JCalls {
2549         atomic_size_t refcnt;
2550         JavaVM *vm;
2551         jweak o;
2552         LDKChannelSigner_JCalls* ChannelSigner;
2553         jmethodID sign_counterparty_commitment_meth;
2554         jmethodID validate_counterparty_revocation_meth;
2555         jmethodID sign_holder_commitment_and_htlcs_meth;
2556         jmethodID sign_justice_revoked_output_meth;
2557         jmethodID sign_justice_revoked_htlc_meth;
2558         jmethodID sign_holder_htlc_transaction_meth;
2559         jmethodID sign_counterparty_htlc_transaction_meth;
2560         jmethodID sign_closing_transaction_meth;
2561         jmethodID sign_holder_anchor_input_meth;
2562         jmethodID sign_channel_announcement_with_funding_key_meth;
2563 } LDKEcdsaChannelSigner_JCalls;
2564 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
2565         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2566         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2567                 JNIEnv *env;
2568                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2569                 if (get_jenv_res == JNI_EDETACHED) {
2570                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2571                 } else {
2572                         DO_ASSERT(get_jenv_res == JNI_OK);
2573                 }
2574                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2575                 if (get_jenv_res == JNI_EDETACHED) {
2576                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2577                 }
2578                 FREE(j_calls);
2579         }
2580 }
2581 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
2582         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2583         JNIEnv *env;
2584         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2585         if (get_jenv_res == JNI_EDETACHED) {
2586                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2587         } else {
2588                 DO_ASSERT(get_jenv_res == JNI_OK);
2589         }
2590         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2591         int64_t commitment_tx_ref = 0;
2592         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
2593         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2594         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2595         LDKCVec_PaymentPreimageZ preimages_var = preimages;
2596         jobjectArray preimages_arr = NULL;
2597         preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
2598         ;
2599         for (size_t i = 0; i < preimages_var.datalen; i++) {
2600                 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
2601                 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
2602                 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
2603         }
2604         
2605         FREE(preimages_var.data);
2606         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2607         CHECK(obj != NULL);
2608         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
2609         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2610                 (*env)->ExceptionDescribe(env);
2611                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
2612         }
2613         void* ret_ptr = untag_ptr(ret);
2614         CHECK_ACCESS(ret_ptr);
2615         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2616         FREE(untag_ptr(ret));
2617         if (get_jenv_res == JNI_EDETACHED) {
2618                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2619         }
2620         return ret_conv;
2621 }
2622 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2623         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2624         JNIEnv *env;
2625         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2626         if (get_jenv_res == JNI_EDETACHED) {
2627                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2628         } else {
2629                 DO_ASSERT(get_jenv_res == JNI_OK);
2630         }
2631         int64_t idx_conv = idx;
2632         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2633         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2634         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2635         CHECK(obj != NULL);
2636         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
2637         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2638                 (*env)->ExceptionDescribe(env);
2639                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKEcdsaChannelSigner from rust threw an exception.");
2640         }
2641         void* ret_ptr = untag_ptr(ret);
2642         CHECK_ACCESS(ret_ptr);
2643         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2644         FREE(untag_ptr(ret));
2645         if (get_jenv_res == JNI_EDETACHED) {
2646                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2647         }
2648         return ret_conv;
2649 }
2650 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2651         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2652         JNIEnv *env;
2653         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2654         if (get_jenv_res == JNI_EDETACHED) {
2655                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2656         } else {
2657                 DO_ASSERT(get_jenv_res == JNI_OK);
2658         }
2659         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2660         int64_t commitment_tx_ref = 0;
2661         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2662         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2663         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2664         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2665         CHECK(obj != NULL);
2666         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2667         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2668                 (*env)->ExceptionDescribe(env);
2669                 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKEcdsaChannelSigner from rust threw an exception.");
2670         }
2671         void* ret_ptr = untag_ptr(ret);
2672         CHECK_ACCESS(ret_ptr);
2673         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2674         FREE(untag_ptr(ret));
2675         if (get_jenv_res == JNI_EDETACHED) {
2676                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2677         }
2678         return ret_conv;
2679 }
2680 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]) {
2681         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2682         JNIEnv *env;
2683         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2684         if (get_jenv_res == JNI_EDETACHED) {
2685                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2686         } else {
2687                 DO_ASSERT(get_jenv_res == JNI_OK);
2688         }
2689         LDKTransaction justice_tx_var = justice_tx;
2690         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2691         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2692         Transaction_free(justice_tx_var);
2693         int64_t input_conv = input;
2694         int64_t amount_conv = amount;
2695         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2696         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2697         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2698         CHECK(obj != NULL);
2699         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);
2700         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2701                 (*env)->ExceptionDescribe(env);
2702                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
2703         }
2704         void* ret_ptr = untag_ptr(ret);
2705         CHECK_ACCESS(ret_ptr);
2706         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2707         FREE(untag_ptr(ret));
2708         if (get_jenv_res == JNI_EDETACHED) {
2709                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2710         }
2711         return ret_conv;
2712 }
2713 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) {
2714         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2715         JNIEnv *env;
2716         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2717         if (get_jenv_res == JNI_EDETACHED) {
2718                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2719         } else {
2720                 DO_ASSERT(get_jenv_res == JNI_OK);
2721         }
2722         LDKTransaction justice_tx_var = justice_tx;
2723         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2724         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2725         Transaction_free(justice_tx_var);
2726         int64_t input_conv = input;
2727         int64_t amount_conv = amount;
2728         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2729         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2730         LDKHTLCOutputInCommitment htlc_var = *htlc;
2731         int64_t htlc_ref = 0;
2732         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2733         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2734         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2735         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2736         CHECK(obj != NULL);
2737         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);
2738         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2739                 (*env)->ExceptionDescribe(env);
2740                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
2741         }
2742         void* ret_ptr = untag_ptr(ret);
2743         CHECK_ACCESS(ret_ptr);
2744         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2745         FREE(untag_ptr(ret));
2746         if (get_jenv_res == JNI_EDETACHED) {
2747                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2748         }
2749         return ret_conv;
2750 }
2751 LDKCResult_SignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
2752         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2753         JNIEnv *env;
2754         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2755         if (get_jenv_res == JNI_EDETACHED) {
2756                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2757         } else {
2758                 DO_ASSERT(get_jenv_res == JNI_OK);
2759         }
2760         LDKTransaction htlc_tx_var = htlc_tx;
2761         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2762         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2763         Transaction_free(htlc_tx_var);
2764         int64_t input_conv = input;
2765         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
2766         int64_t htlc_descriptor_ref = 0;
2767         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
2768         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
2769         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
2770         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2771         CHECK(obj != NULL);
2772         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
2773         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2774                 (*env)->ExceptionDescribe(env);
2775                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
2776         }
2777         void* ret_ptr = untag_ptr(ret);
2778         CHECK_ACCESS(ret_ptr);
2779         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2780         FREE(untag_ptr(ret));
2781         if (get_jenv_res == JNI_EDETACHED) {
2782                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2783         }
2784         return ret_conv;
2785 }
2786 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) {
2787         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2788         JNIEnv *env;
2789         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2790         if (get_jenv_res == JNI_EDETACHED) {
2791                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2792         } else {
2793                 DO_ASSERT(get_jenv_res == JNI_OK);
2794         }
2795         LDKTransaction htlc_tx_var = htlc_tx;
2796         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2797         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2798         Transaction_free(htlc_tx_var);
2799         int64_t input_conv = input;
2800         int64_t amount_conv = amount;
2801         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2802         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2803         LDKHTLCOutputInCommitment htlc_var = *htlc;
2804         int64_t htlc_ref = 0;
2805         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2806         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2807         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2808         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2809         CHECK(obj != NULL);
2810         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);
2811         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2812                 (*env)->ExceptionDescribe(env);
2813                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
2814         }
2815         void* ret_ptr = untag_ptr(ret);
2816         CHECK_ACCESS(ret_ptr);
2817         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2818         FREE(untag_ptr(ret));
2819         if (get_jenv_res == JNI_EDETACHED) {
2820                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2821         }
2822         return ret_conv;
2823 }
2824 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2825         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2826         JNIEnv *env;
2827         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2828         if (get_jenv_res == JNI_EDETACHED) {
2829                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2830         } else {
2831                 DO_ASSERT(get_jenv_res == JNI_OK);
2832         }
2833         LDKClosingTransaction closing_tx_var = *closing_tx;
2834         int64_t closing_tx_ref = 0;
2835         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2836         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2837         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2838         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2839         CHECK(obj != NULL);
2840         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2841         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2842                 (*env)->ExceptionDescribe(env);
2843                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
2844         }
2845         void* ret_ptr = untag_ptr(ret);
2846         CHECK_ACCESS(ret_ptr);
2847         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2848         FREE(untag_ptr(ret));
2849         if (get_jenv_res == JNI_EDETACHED) {
2850                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2851         }
2852         return ret_conv;
2853 }
2854 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2855         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2856         JNIEnv *env;
2857         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2858         if (get_jenv_res == JNI_EDETACHED) {
2859                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2860         } else {
2861                 DO_ASSERT(get_jenv_res == JNI_OK);
2862         }
2863         LDKTransaction anchor_tx_var = anchor_tx;
2864         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
2865         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
2866         Transaction_free(anchor_tx_var);
2867         int64_t input_conv = input;
2868         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2869         CHECK(obj != NULL);
2870         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
2871         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2872                 (*env)->ExceptionDescribe(env);
2873                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
2874         }
2875         void* ret_ptr = untag_ptr(ret);
2876         CHECK_ACCESS(ret_ptr);
2877         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2878         FREE(untag_ptr(ret));
2879         if (get_jenv_res == JNI_EDETACHED) {
2880                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2881         }
2882         return ret_conv;
2883 }
2884 LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2885         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2886         JNIEnv *env;
2887         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2888         if (get_jenv_res == JNI_EDETACHED) {
2889                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2890         } else {
2891                 DO_ASSERT(get_jenv_res == JNI_OK);
2892         }
2893         LDKUnsignedChannelAnnouncement msg_var = *msg;
2894         int64_t msg_ref = 0;
2895         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2896         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2897         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2898         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2899         CHECK(obj != NULL);
2900         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
2901         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2902                 (*env)->ExceptionDescribe(env);
2903                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
2904         }
2905         void* ret_ptr = untag_ptr(ret);
2906         CHECK_ACCESS(ret_ptr);
2907         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2908         FREE(untag_ptr(ret));
2909         if (get_jenv_res == JNI_EDETACHED) {
2910                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2911         }
2912         return ret_conv;
2913 }
2914 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2915         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2916         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2917         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2918 }
2919 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
2920         jclass c = (*env)->GetObjectClass(env, o);
2921         CHECK(c != NULL);
2922         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2923         atomic_init(&calls->refcnt, 1);
2924         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2925         calls->o = (*env)->NewWeakGlobalRef(env, o);
2926         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
2927         CHECK(calls->sign_counterparty_commitment_meth != NULL);
2928         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2929         CHECK(calls->validate_counterparty_revocation_meth != NULL);
2930         calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2931         CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2932         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2933         CHECK(calls->sign_justice_revoked_output_meth != NULL);
2934         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2935         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2936         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
2937         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
2938         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2939         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2940         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2941         CHECK(calls->sign_closing_transaction_meth != NULL);
2942         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
2943         CHECK(calls->sign_holder_anchor_input_meth != NULL);
2944         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
2945         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
2946
2947         LDKChannelPublicKeys pubkeys_conv;
2948         pubkeys_conv.inner = untag_ptr(pubkeys);
2949         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2950         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2951
2952         LDKEcdsaChannelSigner ret = {
2953                 .this_arg = (void*) calls,
2954                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2955                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
2956                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
2957                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2958                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2959                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2960                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2961                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2962                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2963                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2964                 .free = LDKEcdsaChannelSigner_JCalls_free,
2965                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
2966         };
2967         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2968         return ret;
2969 }
2970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
2971         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2972         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
2973         return tag_ptr(res_ptr, true);
2974 }
2975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
2976         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
2977         return tag_ptr(&inp->ChannelSigner, false);
2978 }
2979 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) {
2980         void* this_arg_ptr = untag_ptr(this_arg);
2981         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2982         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2983         LDKCommitmentTransaction commitment_tx_conv;
2984         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2985         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2986         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2987         commitment_tx_conv.is_owned = false;
2988         LDKCVec_PaymentPreimageZ preimages_constr;
2989         preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
2990         if (preimages_constr.datalen > 0)
2991                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
2992         else
2993                 preimages_constr.data = NULL;
2994         for (size_t i = 0; i < preimages_constr.datalen; i++) {
2995                 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
2996                 LDKThirtyTwoBytes preimages_conv_8_ref;
2997                 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
2998                 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
2999                 preimages_constr.data[i] = preimages_conv_8_ref;
3000         }
3001         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3002         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
3003         return tag_ptr(ret_conv, true);
3004 }
3005
3006 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) {
3007         void* this_arg_ptr = untag_ptr(this_arg);
3008         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3009         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3010         uint8_t secret_arr[32];
3011         CHECK((*env)->GetArrayLength(env, secret) == 32);
3012         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3013         uint8_t (*secret_ref)[32] = &secret_arr;
3014         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3015         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3016         return tag_ptr(ret_conv, true);
3017 }
3018
3019 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) {
3020         void* this_arg_ptr = untag_ptr(this_arg);
3021         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3022         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3023         LDKHolderCommitmentTransaction commitment_tx_conv;
3024         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3025         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3026         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3027         commitment_tx_conv.is_owned = false;
3028         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3029         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3030         return tag_ptr(ret_conv, true);
3031 }
3032
3033 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) {
3034         void* this_arg_ptr = untag_ptr(this_arg);
3035         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3036         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3037         LDKTransaction justice_tx_ref;
3038         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3039         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3040         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3041         justice_tx_ref.data_is_owned = true;
3042         uint8_t per_commitment_key_arr[32];
3043         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3044         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3045         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3046         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3047         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3048         return tag_ptr(ret_conv, true);
3049 }
3050
3051 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) {
3052         void* this_arg_ptr = untag_ptr(this_arg);
3053         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3054         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3055         LDKTransaction justice_tx_ref;
3056         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3057         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3058         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3059         justice_tx_ref.data_is_owned = true;
3060         uint8_t per_commitment_key_arr[32];
3061         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3062         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3063         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3064         LDKHTLCOutputInCommitment htlc_conv;
3065         htlc_conv.inner = untag_ptr(htlc);
3066         htlc_conv.is_owned = ptr_is_owned(htlc);
3067         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3068         htlc_conv.is_owned = false;
3069         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3070         *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);
3071         return tag_ptr(ret_conv, true);
3072 }
3073
3074 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) {
3075         void* this_arg_ptr = untag_ptr(this_arg);
3076         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3077         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3078         LDKTransaction htlc_tx_ref;
3079         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3080         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3081         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3082         htlc_tx_ref.data_is_owned = true;
3083         LDKHTLCDescriptor htlc_descriptor_conv;
3084         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3085         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3086         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3087         htlc_descriptor_conv.is_owned = false;
3088         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3089         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3090         return tag_ptr(ret_conv, true);
3091 }
3092
3093 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) {
3094         void* this_arg_ptr = untag_ptr(this_arg);
3095         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3096         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3097         LDKTransaction htlc_tx_ref;
3098         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3099         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3100         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3101         htlc_tx_ref.data_is_owned = true;
3102         LDKPublicKey per_commitment_point_ref;
3103         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3104         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3105         LDKHTLCOutputInCommitment htlc_conv;
3106         htlc_conv.inner = untag_ptr(htlc);
3107         htlc_conv.is_owned = ptr_is_owned(htlc);
3108         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3109         htlc_conv.is_owned = false;
3110         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3111         *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);
3112         return tag_ptr(ret_conv, true);
3113 }
3114
3115 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) {
3116         void* this_arg_ptr = untag_ptr(this_arg);
3117         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3118         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3119         LDKClosingTransaction closing_tx_conv;
3120         closing_tx_conv.inner = untag_ptr(closing_tx);
3121         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3122         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3123         closing_tx_conv.is_owned = false;
3124         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3125         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3126         return tag_ptr(ret_conv, true);
3127 }
3128
3129 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) {
3130         void* this_arg_ptr = untag_ptr(this_arg);
3131         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3132         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3133         LDKTransaction anchor_tx_ref;
3134         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3135         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3136         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3137         anchor_tx_ref.data_is_owned = true;
3138         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3139         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3140         return tag_ptr(ret_conv, true);
3141 }
3142
3143 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) {
3144         void* this_arg_ptr = untag_ptr(this_arg);
3145         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3146         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3147         LDKUnsignedChannelAnnouncement msg_conv;
3148         msg_conv.inner = untag_ptr(msg);
3149         msg_conv.is_owned = ptr_is_owned(msg);
3150         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3151         msg_conv.is_owned = false;
3152         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3153         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3154         return tag_ptr(ret_conv, true);
3155 }
3156
3157 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3158         atomic_size_t refcnt;
3159         JavaVM *vm;
3160         jweak o;
3161         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3162         LDKChannelSigner_JCalls* ChannelSigner;
3163         jmethodID write_meth;
3164 } LDKWriteableEcdsaChannelSigner_JCalls;
3165 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3166         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3167         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3168                 JNIEnv *env;
3169                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3170                 if (get_jenv_res == JNI_EDETACHED) {
3171                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3172                 } else {
3173                         DO_ASSERT(get_jenv_res == JNI_OK);
3174                 }
3175                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3176                 if (get_jenv_res == JNI_EDETACHED) {
3177                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3178                 }
3179                 FREE(j_calls);
3180         }
3181 }
3182 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3183         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3184         JNIEnv *env;
3185         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3186         if (get_jenv_res == JNI_EDETACHED) {
3187                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3188         } else {
3189                 DO_ASSERT(get_jenv_res == JNI_OK);
3190         }
3191         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3192         CHECK(obj != NULL);
3193         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3194         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3195                 (*env)->ExceptionDescribe(env);
3196                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3197         }
3198         LDKCVec_u8Z ret_ref;
3199         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3200         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3201         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3202         if (get_jenv_res == JNI_EDETACHED) {
3203                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3204         }
3205         return ret_ref;
3206 }
3207 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3208         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3209         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3210         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3211         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3212 }
3213 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3214         jclass c = (*env)->GetObjectClass(env, o);
3215         CHECK(c != NULL);
3216         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3217         atomic_init(&calls->refcnt, 1);
3218         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3219         calls->o = (*env)->NewWeakGlobalRef(env, o);
3220         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3221         CHECK(calls->write_meth != NULL);
3222
3223         LDKChannelPublicKeys pubkeys_conv;
3224         pubkeys_conv.inner = untag_ptr(pubkeys);
3225         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3226         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3227
3228         LDKWriteableEcdsaChannelSigner ret = {
3229                 .this_arg = (void*) calls,
3230                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3231                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3232                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3233                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3234         };
3235         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3236         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3237         return ret;
3238 }
3239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3240         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3241         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3242         return tag_ptr(res_ptr, true);
3243 }
3244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3245         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3246         return tag_ptr(&inp->EcdsaChannelSigner, false);
3247 }
3248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3249         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3250         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3251 }
3252 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3253         void* this_arg_ptr = untag_ptr(this_arg);
3254         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3255         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3256         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3257         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3258         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3259         CVec_u8Z_free(ret_var);
3260         return ret_arr;
3261 }
3262
3263 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3264 CHECK(owner->result_ok);
3265         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3266 }
3267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3268         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3269         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3270         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3271         return tag_ptr(ret_ret, true);
3272 }
3273
3274 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3275 CHECK(!owner->result_ok);
3276         return DecodeError_clone(&*owner->contents.err);
3277 }
3278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3279         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3280         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3281         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3282         int64_t ret_ref = tag_ptr(ret_copy, true);
3283         return ret_ref;
3284 }
3285
3286 static inline struct LDKCVec_u8Z CResult_ScriptNoneZ_get_ok(LDKCResult_ScriptNoneZ *NONNULL_PTR owner){
3287 CHECK(owner->result_ok);
3288         return CVec_u8Z_clone(&*owner->contents.result);
3289 }
3290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3291         LDKCResult_ScriptNoneZ* owner_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(owner);
3292         LDKCVec_u8Z ret_var = CResult_ScriptNoneZ_get_ok(owner_conv);
3293         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3294         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3295         CVec_u8Z_free(ret_var);
3296         return ret_arr;
3297 }
3298
3299 static inline void CResult_ScriptNoneZ_get_err(LDKCResult_ScriptNoneZ *NONNULL_PTR owner){
3300 CHECK(!owner->result_ok);
3301         return *owner->contents.err;
3302 }
3303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3304         LDKCResult_ScriptNoneZ* owner_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(owner);
3305         CResult_ScriptNoneZ_get_err(owner_conv);
3306 }
3307
3308 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3309         LDKShutdownScript ret = *owner->contents.result;
3310         ret.is_owned = false;
3311         return ret;
3312 }
3313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3314         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3315         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3316         int64_t ret_ref = 0;
3317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3319         return ret_ref;
3320 }
3321
3322 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3323 CHECK(!owner->result_ok);
3324         return *owner->contents.err;
3325 }
3326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3327         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3328         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
3329 }
3330
3331 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3332         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3333         for (size_t i = 0; i < ret.datalen; i++) {
3334                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3335         }
3336         return ret;
3337 }
3338 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3339 CHECK(owner->result_ok);
3340         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
3341 }
3342 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3343         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3344         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
3345         jobjectArray ret_arr = NULL;
3346         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3347         ;
3348         for (size_t i = 0; i < ret_var.datalen; i++) {
3349                 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
3350                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
3351                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
3352                 CVec_u8Z_free(ret_conv_8_var);
3353                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3354         }
3355         
3356         FREE(ret_var.data);
3357         return ret_arr;
3358 }
3359
3360 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
3361 CHECK(!owner->result_ok);
3362         return *owner->contents.err;
3363 }
3364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3365         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
3366         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
3367 }
3368
3369 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3370         LDKInMemorySigner ret = *owner->contents.result;
3371         ret.is_owned = false;
3372         return ret;
3373 }
3374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3375         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3376         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
3377         int64_t ret_ref = 0;
3378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3380         return ret_ref;
3381 }
3382
3383 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
3384 CHECK(!owner->result_ok);
3385         return DecodeError_clone(&*owner->contents.err);
3386 }
3387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3388         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
3389         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3390         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
3391         int64_t ret_ref = tag_ptr(ret_copy, true);
3392         return ret_ref;
3393 }
3394
3395 static inline struct LDKCVec_u8Z CResult_PartiallySignedTransactionNoneZ_get_ok(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR owner){
3396 CHECK(owner->result_ok);
3397         return CVec_u8Z_clone(&*owner->contents.result);
3398 }
3399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3400         LDKCResult_PartiallySignedTransactionNoneZ* owner_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(owner);
3401         LDKCVec_u8Z ret_var = CResult_PartiallySignedTransactionNoneZ_get_ok(owner_conv);
3402         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3403         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3404         CVec_u8Z_free(ret_var);
3405         return ret_arr;
3406 }
3407
3408 static inline void CResult_PartiallySignedTransactionNoneZ_get_err(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR owner){
3409 CHECK(!owner->result_ok);
3410         return *owner->contents.err;
3411 }
3412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3413         LDKCResult_PartiallySignedTransactionNoneZ* owner_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(owner);
3414         CResult_PartiallySignedTransactionNoneZ_get_err(owner_conv);
3415 }
3416
3417 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3418 CHECK(owner->result_ok);
3419         return *owner->contents.result;
3420 }
3421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3422         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3423         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
3424         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3425         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3426         return ret_arr;
3427 }
3428
3429 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
3430 CHECK(!owner->result_ok);
3431         return *owner->contents.err;
3432 }
3433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3434         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
3435         CResult_TransactionNoneZ_get_err(owner_conv);
3436 }
3437
3438 typedef struct LDKScore_JCalls {
3439         atomic_size_t refcnt;
3440         JavaVM *vm;
3441         jweak o;
3442         jmethodID channel_penalty_msat_meth;
3443         jmethodID payment_path_failed_meth;
3444         jmethodID payment_path_successful_meth;
3445         jmethodID probe_failed_meth;
3446         jmethodID probe_successful_meth;
3447         jmethodID write_meth;
3448 } LDKScore_JCalls;
3449 static void LDKScore_JCalls_free(void* this_arg) {
3450         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3451         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3452                 JNIEnv *env;
3453                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3454                 if (get_jenv_res == JNI_EDETACHED) {
3455                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3456                 } else {
3457                         DO_ASSERT(get_jenv_res == JNI_OK);
3458                 }
3459                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3460                 if (get_jenv_res == JNI_EDETACHED) {
3461                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3462                 }
3463                 FREE(j_calls);
3464         }
3465 }
3466 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) {
3467         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3468         JNIEnv *env;
3469         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3470         if (get_jenv_res == JNI_EDETACHED) {
3471                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3472         } else {
3473                 DO_ASSERT(get_jenv_res == JNI_OK);
3474         }
3475         int64_t short_channel_id_conv = short_channel_id;
3476         LDKNodeId source_var = *source;
3477         int64_t source_ref = 0;
3478         source_var = NodeId_clone(&source_var);
3479         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
3480         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
3481         LDKNodeId target_var = *target;
3482         int64_t target_ref = 0;
3483         target_var = NodeId_clone(&target_var);
3484         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
3485         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
3486         LDKChannelUsage usage_var = usage;
3487         int64_t usage_ref = 0;
3488         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
3489         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
3490         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
3491         int64_t score_params_ref = 0;
3492         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
3493         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
3494         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
3495         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3496         CHECK(obj != NULL);
3497         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);
3498         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3499                 (*env)->ExceptionDescribe(env);
3500                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
3501         }
3502         if (get_jenv_res == JNI_EDETACHED) {
3503                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3504         }
3505         return ret;
3506 }
3507 void payment_path_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3508         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3509         JNIEnv *env;
3510         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3511         if (get_jenv_res == JNI_EDETACHED) {
3512                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3513         } else {
3514                 DO_ASSERT(get_jenv_res == JNI_OK);
3515         }
3516         LDKPath path_var = *path;
3517         int64_t path_ref = 0;
3518         path_var = Path_clone(&path_var);
3519         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3520         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3521         int64_t short_channel_id_conv = short_channel_id;
3522         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3523         CHECK(obj != NULL);
3524         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv);
3525         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3526                 (*env)->ExceptionDescribe(env);
3527                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
3528         }
3529         if (get_jenv_res == JNI_EDETACHED) {
3530                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3531         }
3532 }
3533 void payment_path_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
3534         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3535         JNIEnv *env;
3536         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3537         if (get_jenv_res == JNI_EDETACHED) {
3538                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3539         } else {
3540                 DO_ASSERT(get_jenv_res == JNI_OK);
3541         }
3542         LDKPath path_var = *path;
3543         int64_t path_ref = 0;
3544         path_var = Path_clone(&path_var);
3545         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3546         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3547         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3548         CHECK(obj != NULL);
3549         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref);
3550         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3551                 (*env)->ExceptionDescribe(env);
3552                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
3553         }
3554         if (get_jenv_res == JNI_EDETACHED) {
3555                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3556         }
3557 }
3558 void probe_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
3559         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3560         JNIEnv *env;
3561         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3562         if (get_jenv_res == JNI_EDETACHED) {
3563                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3564         } else {
3565                 DO_ASSERT(get_jenv_res == JNI_OK);
3566         }
3567         LDKPath path_var = *path;
3568         int64_t path_ref = 0;
3569         path_var = Path_clone(&path_var);
3570         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3571         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3572         int64_t short_channel_id_conv = short_channel_id;
3573         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3574         CHECK(obj != NULL);
3575         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv);
3576         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3577                 (*env)->ExceptionDescribe(env);
3578                 (*env)->FatalError(env, "A call to probe_failed in LDKScore from rust threw an exception.");
3579         }
3580         if (get_jenv_res == JNI_EDETACHED) {
3581                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3582         }
3583 }
3584 void probe_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
3585         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3586         JNIEnv *env;
3587         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3588         if (get_jenv_res == JNI_EDETACHED) {
3589                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3590         } else {
3591                 DO_ASSERT(get_jenv_res == JNI_OK);
3592         }
3593         LDKPath path_var = *path;
3594         int64_t path_ref = 0;
3595         path_var = Path_clone(&path_var);
3596         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
3597         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
3598         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3599         CHECK(obj != NULL);
3600         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref);
3601         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3602                 (*env)->ExceptionDescribe(env);
3603                 (*env)->FatalError(env, "A call to probe_successful in LDKScore from rust threw an exception.");
3604         }
3605         if (get_jenv_res == JNI_EDETACHED) {
3606                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3607         }
3608 }
3609 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
3610         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
3611         JNIEnv *env;
3612         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3613         if (get_jenv_res == JNI_EDETACHED) {
3614                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3615         } else {
3616                 DO_ASSERT(get_jenv_res == JNI_OK);
3617         }
3618         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3619         CHECK(obj != NULL);
3620         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3621         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3622                 (*env)->ExceptionDescribe(env);
3623                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
3624         }
3625         LDKCVec_u8Z ret_ref;
3626         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3627         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3628         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3629         if (get_jenv_res == JNI_EDETACHED) {
3630                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3631         }
3632         return ret_ref;
3633 }
3634 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
3635         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
3636         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3637 }
3638 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
3639         jclass c = (*env)->GetObjectClass(env, o);
3640         CHECK(c != NULL);
3641         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
3642         atomic_init(&calls->refcnt, 1);
3643         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3644         calls->o = (*env)->NewWeakGlobalRef(env, o);
3645         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
3646         CHECK(calls->channel_penalty_msat_meth != NULL);
3647         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJ)V");
3648         CHECK(calls->payment_path_failed_meth != NULL);
3649         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(J)V");
3650         CHECK(calls->payment_path_successful_meth != NULL);
3651         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJ)V");
3652         CHECK(calls->probe_failed_meth != NULL);
3653         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(J)V");
3654         CHECK(calls->probe_successful_meth != NULL);
3655         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3656         CHECK(calls->write_meth != NULL);
3657
3658         LDKScore ret = {
3659                 .this_arg = (void*) calls,
3660                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
3661                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
3662                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
3663                 .probe_failed = probe_failed_LDKScore_jcall,
3664                 .probe_successful = probe_successful_LDKScore_jcall,
3665                 .write = write_LDKScore_jcall,
3666                 .free = LDKScore_JCalls_free,
3667         };
3668         return ret;
3669 }
3670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
3671         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
3672         *res_ptr = LDKScore_init(env, clz, o);
3673         return tag_ptr(res_ptr, true);
3674 }
3675 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) {
3676         void* this_arg_ptr = untag_ptr(this_arg);
3677         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3678         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3679         LDKNodeId source_conv;
3680         source_conv.inner = untag_ptr(source);
3681         source_conv.is_owned = ptr_is_owned(source);
3682         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
3683         source_conv.is_owned = false;
3684         LDKNodeId target_conv;
3685         target_conv.inner = untag_ptr(target);
3686         target_conv.is_owned = ptr_is_owned(target);
3687         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
3688         target_conv.is_owned = false;
3689         LDKChannelUsage usage_conv;
3690         usage_conv.inner = untag_ptr(usage);
3691         usage_conv.is_owned = ptr_is_owned(usage);
3692         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
3693         usage_conv = ChannelUsage_clone(&usage_conv);
3694         LDKProbabilisticScoringFeeParameters score_params_conv;
3695         score_params_conv.inner = untag_ptr(score_params);
3696         score_params_conv.is_owned = ptr_is_owned(score_params);
3697         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
3698         score_params_conv.is_owned = false;
3699         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);
3700         return ret_conv;
3701 }
3702
3703 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) {
3704         void* this_arg_ptr = untag_ptr(this_arg);
3705         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3706         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3707         LDKPath path_conv;
3708         path_conv.inner = untag_ptr(path);
3709         path_conv.is_owned = ptr_is_owned(path);
3710         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
3711         path_conv.is_owned = false;
3712         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
3713 }
3714
3715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
3716         void* this_arg_ptr = untag_ptr(this_arg);
3717         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3718         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3719         LDKPath path_conv;
3720         path_conv.inner = untag_ptr(path);
3721         path_conv.is_owned = ptr_is_owned(path);
3722         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
3723         path_conv.is_owned = false;
3724         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
3725 }
3726
3727 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) {
3728         void* this_arg_ptr = untag_ptr(this_arg);
3729         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3730         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3731         LDKPath path_conv;
3732         path_conv.inner = untag_ptr(path);
3733         path_conv.is_owned = ptr_is_owned(path);
3734         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
3735         path_conv.is_owned = false;
3736         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
3737 }
3738
3739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1probe_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
3740         void* this_arg_ptr = untag_ptr(this_arg);
3741         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3742         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3743         LDKPath path_conv;
3744         path_conv.inner = untag_ptr(path);
3745         path_conv.is_owned = ptr_is_owned(path);
3746         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
3747         path_conv.is_owned = false;
3748         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
3749 }
3750
3751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3752         void* this_arg_ptr = untag_ptr(this_arg);
3753         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3754         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
3755         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3756         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3757         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3758         CVec_u8Z_free(ret_var);
3759         return ret_arr;
3760 }
3761
3762 typedef struct LDKLockableScore_JCalls {
3763         atomic_size_t refcnt;
3764         JavaVM *vm;
3765         jweak o;
3766         jmethodID lock_meth;
3767 } LDKLockableScore_JCalls;
3768 static void LDKLockableScore_JCalls_free(void* this_arg) {
3769         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
3770         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3771                 JNIEnv *env;
3772                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3773                 if (get_jenv_res == JNI_EDETACHED) {
3774                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3775                 } else {
3776                         DO_ASSERT(get_jenv_res == JNI_OK);
3777                 }
3778                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3779                 if (get_jenv_res == JNI_EDETACHED) {
3780                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3781                 }
3782                 FREE(j_calls);
3783         }
3784 }
3785 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
3786         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
3787         JNIEnv *env;
3788         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3789         if (get_jenv_res == JNI_EDETACHED) {
3790                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3791         } else {
3792                 DO_ASSERT(get_jenv_res == JNI_OK);
3793         }
3794         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3795         CHECK(obj != NULL);
3796         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
3797         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3798                 (*env)->ExceptionDescribe(env);
3799                 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
3800         }
3801         void* ret_ptr = untag_ptr(ret);
3802         CHECK_ACCESS(ret_ptr);
3803         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
3804         if (ret_conv.free == LDKScore_JCalls_free) {
3805                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3806                 LDKScore_JCalls_cloned(&ret_conv);
3807         }// WARNING: we may need a move here but no clone is available for LDKScore
3808         
3809         if (get_jenv_res == JNI_EDETACHED) {
3810                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3811         }
3812         return ret_conv;
3813 }
3814 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
3815         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
3816         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3817 }
3818 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
3819         jclass c = (*env)->GetObjectClass(env, o);
3820         CHECK(c != NULL);
3821         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
3822         atomic_init(&calls->refcnt, 1);
3823         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3824         calls->o = (*env)->NewWeakGlobalRef(env, o);
3825         calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
3826         CHECK(calls->lock_meth != NULL);
3827
3828         LDKLockableScore ret = {
3829                 .this_arg = (void*) calls,
3830                 .lock = lock_LDKLockableScore_jcall,
3831                 .free = LDKLockableScore_JCalls_free,
3832         };
3833         return ret;
3834 }
3835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
3836         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
3837         *res_ptr = LDKLockableScore_init(env, clz, o);
3838         return tag_ptr(res_ptr, true);
3839 }
3840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
3841         void* this_arg_ptr = untag_ptr(this_arg);
3842         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3843         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
3844         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
3845         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
3846         return tag_ptr(ret_ret, true);
3847 }
3848
3849 typedef struct LDKWriteableScore_JCalls {
3850         atomic_size_t refcnt;
3851         JavaVM *vm;
3852         jweak o;
3853         LDKLockableScore_JCalls* LockableScore;
3854         jmethodID write_meth;
3855 } LDKWriteableScore_JCalls;
3856 static void LDKWriteableScore_JCalls_free(void* this_arg) {
3857         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
3858         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3859                 JNIEnv *env;
3860                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3861                 if (get_jenv_res == JNI_EDETACHED) {
3862                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3863                 } else {
3864                         DO_ASSERT(get_jenv_res == JNI_OK);
3865                 }
3866                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3867                 if (get_jenv_res == JNI_EDETACHED) {
3868                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3869                 }
3870                 FREE(j_calls);
3871         }
3872 }
3873 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
3874         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
3875         JNIEnv *env;
3876         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3877         if (get_jenv_res == JNI_EDETACHED) {
3878                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3879         } else {
3880                 DO_ASSERT(get_jenv_res == JNI_OK);
3881         }
3882         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3883         CHECK(obj != NULL);
3884         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3885         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3886                 (*env)->ExceptionDescribe(env);
3887                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
3888         }
3889         LDKCVec_u8Z ret_ref;
3890         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3891         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3892         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3893         if (get_jenv_res == JNI_EDETACHED) {
3894                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3895         }
3896         return ret_ref;
3897 }
3898 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
3899         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
3900         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3901         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
3902 }
3903 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
3904         jclass c = (*env)->GetObjectClass(env, o);
3905         CHECK(c != NULL);
3906         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
3907         atomic_init(&calls->refcnt, 1);
3908         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3909         calls->o = (*env)->NewWeakGlobalRef(env, o);
3910         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3911         CHECK(calls->write_meth != NULL);
3912
3913         LDKWriteableScore ret = {
3914                 .this_arg = (void*) calls,
3915                 .write = write_LDKWriteableScore_jcall,
3916                 .free = LDKWriteableScore_JCalls_free,
3917                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
3918         };
3919         calls->LockableScore = ret.LockableScore.this_arg;
3920         return ret;
3921 }
3922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
3923         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
3924         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
3925         return tag_ptr(res_ptr, true);
3926 }
3927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
3928         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
3929         return tag_ptr(&inp->LockableScore, false);
3930 }
3931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3932         void* this_arg_ptr = untag_ptr(this_arg);
3933         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3934         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
3935         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3936         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3937         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3938         CVec_u8Z_free(ret_var);
3939         return ret_arr;
3940 }
3941
3942 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
3943 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
3944 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
3945 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
3946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
3947         LDKCOption_WriteableScoreZ_Some_class =
3948                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
3949         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
3950         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
3951         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
3952         LDKCOption_WriteableScoreZ_None_class =
3953                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
3954         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
3955         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
3956         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
3957 }
3958 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3959         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
3960         switch(obj->tag) {
3961                 case LDKCOption_WriteableScoreZ_Some: {
3962                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
3963                         *some_ret = obj->some;
3964                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3965                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
3966                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3967                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
3968                         }
3969                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
3970                 }
3971                 case LDKCOption_WriteableScoreZ_None: {
3972                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
3973                 }
3974                 default: abort();
3975         }
3976 }
3977 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
3978 CHECK(owner->result_ok);
3979         return *owner->contents.result;
3980 }
3981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3982         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
3983         CResult_NoneErrorZ_get_ok(owner_conv);
3984 }
3985
3986 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
3987 CHECK(!owner->result_ok);
3988         return *owner->contents.err;
3989 }
3990 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3991         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
3992         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
3993         return ret_conv;
3994 }
3995
3996 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
3997         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
3998         for (size_t i = 0; i < ret.datalen; i++) {
3999                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4000         }
4001         return ret;
4002 }
4003 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4004         LDKRoute ret = *owner->contents.result;
4005         ret.is_owned = false;
4006         return ret;
4007 }
4008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4009         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4010         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4011         int64_t ret_ref = 0;
4012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4014         return ret_ref;
4015 }
4016
4017 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4018         LDKLightningError ret = *owner->contents.err;
4019         ret.is_owned = false;
4020         return ret;
4021 }
4022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4023         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4024         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4025         int64_t ret_ref = 0;
4026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4028         return ret_ref;
4029 }
4030
4031 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4032         LDKInFlightHtlcs ret = *owner->contents.result;
4033         ret.is_owned = false;
4034         return ret;
4035 }
4036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4037         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4038         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4039         int64_t ret_ref = 0;
4040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4042         return ret_ref;
4043 }
4044
4045 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4046 CHECK(!owner->result_ok);
4047         return DecodeError_clone(&*owner->contents.err);
4048 }
4049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4050         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4051         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4052         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4053         int64_t ret_ref = tag_ptr(ret_copy, true);
4054         return ret_ref;
4055 }
4056
4057 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4058         LDKRouteHop ret = *owner->contents.result;
4059         ret.is_owned = false;
4060         return ret;
4061 }
4062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4063         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4064         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4065         int64_t ret_ref = 0;
4066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4068         return ret_ref;
4069 }
4070
4071 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4072 CHECK(!owner->result_ok);
4073         return DecodeError_clone(&*owner->contents.err);
4074 }
4075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4076         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4077         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4078         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
4079         int64_t ret_ref = tag_ptr(ret_copy, true);
4080         return ret_ref;
4081 }
4082
4083 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
4084         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
4085         for (size_t i = 0; i < ret.datalen; i++) {
4086                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
4087         }
4088         return ret;
4089 }
4090 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4091         LDKBlindedTail ret = *owner->contents.result;
4092         ret.is_owned = false;
4093         return ret;
4094 }
4095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4096         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4097         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
4098         int64_t ret_ref = 0;
4099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4101         return ret_ref;
4102 }
4103
4104 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
4105 CHECK(!owner->result_ok);
4106         return DecodeError_clone(&*owner->contents.err);
4107 }
4108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4109         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
4110         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4111         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
4112         int64_t ret_ref = tag_ptr(ret_copy, true);
4113         return ret_ref;
4114 }
4115
4116 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
4117         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
4118         for (size_t i = 0; i < ret.datalen; i++) {
4119                 ret.data[i] = RouteHop_clone(&orig->data[i]);
4120         }
4121         return ret;
4122 }
4123 static jclass LDKCOption_u32Z_Some_class = NULL;
4124 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
4125 static jclass LDKCOption_u32Z_None_class = NULL;
4126 static jmethodID LDKCOption_u32Z_None_meth = NULL;
4127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
4128         LDKCOption_u32Z_Some_class =
4129                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
4130         CHECK(LDKCOption_u32Z_Some_class != NULL);
4131         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
4132         CHECK(LDKCOption_u32Z_Some_meth != NULL);
4133         LDKCOption_u32Z_None_class =
4134                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
4135         CHECK(LDKCOption_u32Z_None_class != NULL);
4136         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
4137         CHECK(LDKCOption_u32Z_None_meth != NULL);
4138 }
4139 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4140         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
4141         switch(obj->tag) {
4142                 case LDKCOption_u32Z_Some: {
4143                         int32_t some_conv = obj->some;
4144                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
4145                 }
4146                 case LDKCOption_u32Z_None: {
4147                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
4148                 }
4149                 default: abort();
4150         }
4151 }
4152 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
4153         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
4154         for (size_t i = 0; i < ret.datalen; i++) {
4155                 ret.data[i] = Path_clone(&orig->data[i]);
4156         }
4157         return ret;
4158 }
4159 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4160         LDKRoute ret = *owner->contents.result;
4161         ret.is_owned = false;
4162         return ret;
4163 }
4164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4165         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4166         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
4167         int64_t ret_ref = 0;
4168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4170         return ret_ref;
4171 }
4172
4173 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
4174 CHECK(!owner->result_ok);
4175         return DecodeError_clone(&*owner->contents.err);
4176 }
4177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4178         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
4179         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4180         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
4181         int64_t ret_ref = tag_ptr(ret_copy, true);
4182         return ret_ref;
4183 }
4184
4185 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4186         LDKRouteParameters ret = *owner->contents.result;
4187         ret.is_owned = false;
4188         return ret;
4189 }
4190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4191         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4192         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
4193         int64_t ret_ref = 0;
4194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4196         return ret_ref;
4197 }
4198
4199 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
4200 CHECK(!owner->result_ok);
4201         return DecodeError_clone(&*owner->contents.err);
4202 }
4203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4204         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
4205         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4206         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
4207         int64_t ret_ref = tag_ptr(ret_copy, true);
4208         return ret_ref;
4209 }
4210
4211 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
4212         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
4213         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
4214         return ret;
4215 }
4216 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4217         LDKPaymentParameters ret = *owner->contents.result;
4218         ret.is_owned = false;
4219         return ret;
4220 }
4221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4222         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4223         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
4224         int64_t ret_ref = 0;
4225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4227         return ret_ref;
4228 }
4229
4230 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
4231 CHECK(!owner->result_ok);
4232         return DecodeError_clone(&*owner->contents.err);
4233 }
4234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4235         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
4236         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4237         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
4238         int64_t ret_ref = tag_ptr(ret_copy, true);
4239         return ret_ref;
4240 }
4241
4242 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4243         LDKBlindedPayInfo ret = owner->a;
4244         ret.is_owned = false;
4245         return ret;
4246 }
4247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4248         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4249         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4250         int64_t ret_ref = 0;
4251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4253         return ret_ref;
4254 }
4255
4256 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4257         LDKBlindedPath ret = owner->b;
4258         ret.is_owned = false;
4259         return ret;
4260 }
4261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4262         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4263         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4264         int64_t ret_ref = 0;
4265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4267         return ret_ref;
4268 }
4269
4270 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4271         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4272         for (size_t i = 0; i < ret.datalen; i++) {
4273                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4274         }
4275         return ret;
4276 }
4277 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
4278         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
4279         for (size_t i = 0; i < ret.datalen; i++) {
4280                 ret.data[i] = RouteHint_clone(&orig->data[i]);
4281         }
4282         return ret;
4283 }
4284 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
4285         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
4286         for (size_t i = 0; i < ret.datalen; i++) {
4287                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
4288         }
4289         return ret;
4290 }
4291 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4292         LDKRouteHint ret = *owner->contents.result;
4293         ret.is_owned = false;
4294         return ret;
4295 }
4296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4297         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4298         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
4299         int64_t ret_ref = 0;
4300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4302         return ret_ref;
4303 }
4304
4305 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
4306 CHECK(!owner->result_ok);
4307         return DecodeError_clone(&*owner->contents.err);
4308 }
4309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4310         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
4311         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4312         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
4313         int64_t ret_ref = tag_ptr(ret_copy, true);
4314         return ret_ref;
4315 }
4316
4317 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4318         LDKRouteHintHop ret = *owner->contents.result;
4319         ret.is_owned = false;
4320         return ret;
4321 }
4322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4323         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4324         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
4325         int64_t ret_ref = 0;
4326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4328         return ret_ref;
4329 }
4330
4331 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
4332 CHECK(!owner->result_ok);
4333         return DecodeError_clone(&*owner->contents.err);
4334 }
4335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4336         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
4337         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4338         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
4339         int64_t ret_ref = tag_ptr(ret_copy, true);
4340         return ret_ref;
4341 }
4342
4343 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4344         LDKFixedPenaltyScorer ret = *owner->contents.result;
4345         ret.is_owned = false;
4346         return ret;
4347 }
4348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4349         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4350         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
4351         int64_t ret_ref = 0;
4352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4354         return ret_ref;
4355 }
4356
4357 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
4358 CHECK(!owner->result_ok);
4359         return DecodeError_clone(&*owner->contents.err);
4360 }
4361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4362         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
4363         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4364         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
4365         int64_t ret_ref = tag_ptr(ret_copy, true);
4366         return ret_ref;
4367 }
4368
4369 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
4370         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
4371         for (size_t i = 0; i < ret.datalen; i++) {
4372                 ret.data[i] = NodeId_clone(&orig->data[i]);
4373         }
4374         return ret;
4375 }
4376 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4377         return owner->a;
4378 }
4379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4380         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4381         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
4382         return ret_conv;
4383 }
4384
4385 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
4386         return owner->b;
4387 }
4388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4389         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
4390         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
4391         return ret_conv;
4392 }
4393
4394 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
4395 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
4396 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
4397 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
4398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
4399         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
4400                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
4401         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
4402         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
4403         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
4404         LDKCOption_C2Tuple_u64u64ZZ_None_class =
4405                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
4406         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
4407         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
4408         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
4409 }
4410 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4411         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
4412         switch(obj->tag) {
4413                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
4414                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4415                         *some_conv = obj->some;
4416                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
4417                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
4418                 }
4419                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
4420                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
4421                 }
4422                 default: abort();
4423         }
4424 }
4425 static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
4426         return owner->a;
4427 }
4428 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4429         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4430         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4431         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_a(owner_conv).data);
4432         return ret_arr;
4433 }
4434
4435 static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
4436         return owner->b;
4437 }
4438 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4439         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
4440         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4441         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple_Z_get_b(owner_conv).data);
4442         return ret_arr;
4443 }
4444
4445 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
4446         return owner->a;
4447 }
4448 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4449         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
4450         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4451         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_a(owner_conv).data);
4452         return ret_arr;
4453 }
4454
4455 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
4456         return owner->b;
4457 }
4458 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4459         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
4460         int16_tArray ret_arr = (*env)->NewShortArray(env, 8);
4461         (*env)->SetShortArrayRegion(env, ret_arr, 0, 8, C2Tuple__u168_u168Z_get_b(owner_conv).data);
4462         return ret_arr;
4463 }
4464
4465 static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class = NULL;
4466 static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = NULL;
4467 static jclass LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class = NULL;
4468 static jmethodID LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = NULL;
4469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_init (JNIEnv *env, jclass clz) {
4470         LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class =
4471                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$Some"));
4472         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class != NULL);
4473         LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, "<init>", "(J)V");
4474         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth != NULL);
4475         LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class =
4476                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_EightU16sEightU16sZZ$None"));
4477         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class != NULL);
4478         LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, "<init>", "()V");
4479         CHECK(LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth != NULL);
4480 }
4481 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1EightU16sEightU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4482         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
4483         switch(obj->tag) {
4484                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: {
4485                         LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
4486                         *some_conv = obj->some;
4487                         *some_conv = C2Tuple__u168_u168Z_clone(some_conv);
4488                         return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_meth, tag_ptr(some_conv, true));
4489                 }
4490                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: {
4491                         return (*env)->NewObject(env, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_class, LDKCOption_C2Tuple_EightU16sEightU16sZZ_None_meth);
4492                 }
4493                 default: abort();
4494         }
4495 }
4496 typedef struct LDKLogger_JCalls {
4497         atomic_size_t refcnt;
4498         JavaVM *vm;
4499         jweak o;
4500         jmethodID log_meth;
4501 } LDKLogger_JCalls;
4502 static void LDKLogger_JCalls_free(void* this_arg) {
4503         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4504         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4505                 JNIEnv *env;
4506                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4507                 if (get_jenv_res == JNI_EDETACHED) {
4508                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4509                 } else {
4510                         DO_ASSERT(get_jenv_res == JNI_OK);
4511                 }
4512                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4513                 if (get_jenv_res == JNI_EDETACHED) {
4514                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4515                 }
4516                 FREE(j_calls);
4517         }
4518 }
4519 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
4520         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4521         JNIEnv *env;
4522         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4523         if (get_jenv_res == JNI_EDETACHED) {
4524                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4525         } else {
4526                 DO_ASSERT(get_jenv_res == JNI_OK);
4527         }
4528         LDKRecord record_var = *record;
4529         int64_t record_ref = 0;
4530         record_var = Record_clone(&record_var);
4531         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
4532         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
4533         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4534         CHECK(obj != NULL);
4535         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
4536         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4537                 (*env)->ExceptionDescribe(env);
4538                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4539         }
4540         if (get_jenv_res == JNI_EDETACHED) {
4541                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4542         }
4543 }
4544 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4545         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4546         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4547 }
4548 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4549         jclass c = (*env)->GetObjectClass(env, o);
4550         CHECK(c != NULL);
4551         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4552         atomic_init(&calls->refcnt, 1);
4553         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4554         calls->o = (*env)->NewWeakGlobalRef(env, o);
4555         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
4556         CHECK(calls->log_meth != NULL);
4557
4558         LDKLogger ret = {
4559                 .this_arg = (void*) calls,
4560                 .log = log_LDKLogger_jcall,
4561                 .free = LDKLogger_JCalls_free,
4562         };
4563         return ret;
4564 }
4565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4566         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4567         *res_ptr = LDKLogger_init(env, clz, o);
4568         return tag_ptr(res_ptr, true);
4569 }
4570 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4571         LDKProbabilisticScorer ret = *owner->contents.result;
4572         ret.is_owned = false;
4573         return ret;
4574 }
4575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4576         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4577         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
4578         int64_t ret_ref = 0;
4579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4581         return ret_ref;
4582 }
4583
4584 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
4585 CHECK(!owner->result_ok);
4586         return DecodeError_clone(&*owner->contents.err);
4587 }
4588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4589         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
4590         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4591         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
4592         int64_t ret_ref = tag_ptr(ret_copy, true);
4593         return ret_ref;
4594 }
4595
4596 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4597         return owner->a;
4598 }
4599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4600         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4601         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
4602         return ret_conv;
4603 }
4604
4605 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
4606         return owner->b;
4607 }
4608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4609         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
4610         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
4611         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4612         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4613         return ret_arr;
4614 }
4615
4616 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
4617         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
4618         for (size_t i = 0; i < ret.datalen; i++) {
4619                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
4620         }
4621         return ret;
4622 }
4623 static jclass LDKCOption_BlockHashZ_Some_class = NULL;
4624 static jmethodID LDKCOption_BlockHashZ_Some_meth = NULL;
4625 static jclass LDKCOption_BlockHashZ_None_class = NULL;
4626 static jmethodID LDKCOption_BlockHashZ_None_meth = NULL;
4627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BlockHashZ_init (JNIEnv *env, jclass clz) {
4628         LDKCOption_BlockHashZ_Some_class =
4629                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BlockHashZ$Some"));
4630         CHECK(LDKCOption_BlockHashZ_Some_class != NULL);
4631         LDKCOption_BlockHashZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BlockHashZ_Some_class, "<init>", "([B)V");
4632         CHECK(LDKCOption_BlockHashZ_Some_meth != NULL);
4633         LDKCOption_BlockHashZ_None_class =
4634                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BlockHashZ$None"));
4635         CHECK(LDKCOption_BlockHashZ_None_class != NULL);
4636         LDKCOption_BlockHashZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BlockHashZ_None_class, "<init>", "()V");
4637         CHECK(LDKCOption_BlockHashZ_None_meth != NULL);
4638 }
4639 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BlockHashZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4640         LDKCOption_BlockHashZ *obj = (LDKCOption_BlockHashZ*)untag_ptr(ptr);
4641         switch(obj->tag) {
4642                 case LDKCOption_BlockHashZ_Some: {
4643                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
4644                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
4645                         return (*env)->NewObject(env, LDKCOption_BlockHashZ_Some_class, LDKCOption_BlockHashZ_Some_meth, some_arr);
4646                 }
4647                 case LDKCOption_BlockHashZ_None: {
4648                         return (*env)->NewObject(env, LDKCOption_BlockHashZ_None_class, LDKCOption_BlockHashZ_None_meth);
4649                 }
4650                 default: abort();
4651         }
4652 }
4653 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCOption_BlockHashZZ_get_a(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR owner){
4654         return ThirtyTwoBytes_clone(&owner->a);
4655 }
4656 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4657         LDKC2Tuple_TxidCOption_BlockHashZZ* owner_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(owner);
4658         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4659         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCOption_BlockHashZZ_get_a(owner_conv).data);
4660         return ret_arr;
4661 }
4662
4663 static inline struct LDKCOption_BlockHashZ C2Tuple_TxidCOption_BlockHashZZ_get_b(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR owner){
4664         return COption_BlockHashZ_clone(&owner->b);
4665 }
4666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4667         LDKC2Tuple_TxidCOption_BlockHashZZ* owner_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(owner);
4668         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
4669         *ret_copy = C2Tuple_TxidCOption_BlockHashZZ_get_b(owner_conv);
4670         int64_t ret_ref = tag_ptr(ret_copy, true);
4671         return ret_ref;
4672 }
4673
4674 static inline LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ CVec_C2Tuple_TxidCOption_BlockHashZZZ_clone(const LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ *orig) {
4675         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ clone bytes"), .datalen = orig->datalen };
4676         for (size_t i = 0; i < ret.datalen; i++) {
4677                 ret.data[i] = C2Tuple_TxidCOption_BlockHashZZ_clone(&orig->data[i]);
4678         }
4679         return ret;
4680 }
4681 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
4682 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
4683 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
4684 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
4685 static jclass LDKMonitorEvent_Completed_class = NULL;
4686 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
4687 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
4688 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
4689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
4690         LDKMonitorEvent_HTLCEvent_class =
4691                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
4692         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
4693         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
4694         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
4695         LDKMonitorEvent_CommitmentTxConfirmed_class =
4696                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
4697         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
4698         LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
4699         CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
4700         LDKMonitorEvent_Completed_class =
4701                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
4702         CHECK(LDKMonitorEvent_Completed_class != NULL);
4703         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJ)V");
4704         CHECK(LDKMonitorEvent_Completed_meth != NULL);
4705         LDKMonitorEvent_UpdateFailed_class =
4706                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
4707         CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
4708         LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
4709         CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
4710 }
4711 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4712         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
4713         switch(obj->tag) {
4714                 case LDKMonitorEvent_HTLCEvent: {
4715                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
4716                         int64_t htlc_event_ref = 0;
4717                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
4718                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
4719                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
4720                 }
4721                 case LDKMonitorEvent_CommitmentTxConfirmed: {
4722                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
4723                         int64_t commitment_tx_confirmed_ref = 0;
4724                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
4725                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
4726                         return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
4727                 }
4728                 case LDKMonitorEvent_Completed: {
4729                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
4730                         int64_t funding_txo_ref = 0;
4731                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4732                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
4733                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
4734                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, monitor_update_id_conv);
4735                 }
4736                 case LDKMonitorEvent_UpdateFailed: {
4737                         LDKOutPoint update_failed_var = obj->update_failed;
4738                         int64_t update_failed_ref = 0;
4739                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
4740                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
4741                         return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
4742                 }
4743                 default: abort();
4744         }
4745 }
4746 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
4747         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
4748         for (size_t i = 0; i < ret.datalen; i++) {
4749                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
4750         }
4751         return ret;
4752 }
4753 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4754         LDKOutPoint ret = owner->a;
4755         ret.is_owned = false;
4756         return ret;
4757 }
4758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4759         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4760         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
4761         int64_t ret_ref = 0;
4762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4764         return ret_ref;
4765 }
4766
4767 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4768         return CVec_MonitorEventZ_clone(&owner->b);
4769 }
4770 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4771         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4772         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
4773         int64_tArray ret_arr = NULL;
4774         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4775         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4776         for (size_t o = 0; o < ret_var.datalen; o++) {
4777                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
4778                 *ret_conv_14_copy = ret_var.data[o];
4779                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
4780                 ret_arr_ptr[o] = ret_conv_14_ref;
4781         }
4782         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4783         FREE(ret_var.data);
4784         return ret_arr;
4785 }
4786
4787 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
4788         return owner->c;
4789 }
4790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
4791         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
4792         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4793         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form);
4794         return ret_arr;
4795 }
4796
4797 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
4798         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
4799         for (size_t i = 0; i < ret.datalen; i++) {
4800                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
4801         }
4802         return ret;
4803 }
4804 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4805         LDKInitFeatures ret = *owner->contents.result;
4806         ret.is_owned = false;
4807         return ret;
4808 }
4809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4810         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4811         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
4812         int64_t ret_ref = 0;
4813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4815         return ret_ref;
4816 }
4817
4818 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
4819 CHECK(!owner->result_ok);
4820         return DecodeError_clone(&*owner->contents.err);
4821 }
4822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4823         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
4824         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4825         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
4826         int64_t ret_ref = tag_ptr(ret_copy, true);
4827         return ret_ref;
4828 }
4829
4830 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4831         LDKChannelFeatures ret = *owner->contents.result;
4832         ret.is_owned = false;
4833         return ret;
4834 }
4835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4836         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4837         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
4838         int64_t ret_ref = 0;
4839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4841         return ret_ref;
4842 }
4843
4844 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
4845 CHECK(!owner->result_ok);
4846         return DecodeError_clone(&*owner->contents.err);
4847 }
4848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4849         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
4850         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4851         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
4852         int64_t ret_ref = tag_ptr(ret_copy, true);
4853         return ret_ref;
4854 }
4855
4856 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4857         LDKNodeFeatures ret = *owner->contents.result;
4858         ret.is_owned = false;
4859         return ret;
4860 }
4861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4862         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4863         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
4864         int64_t ret_ref = 0;
4865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4867         return ret_ref;
4868 }
4869
4870 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4871 CHECK(!owner->result_ok);
4872         return DecodeError_clone(&*owner->contents.err);
4873 }
4874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4875         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
4876         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4877         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
4878         int64_t ret_ref = tag_ptr(ret_copy, true);
4879         return ret_ref;
4880 }
4881
4882 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4883         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
4884         ret.is_owned = false;
4885         return ret;
4886 }
4887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4888         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4889         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4890         int64_t ret_ref = 0;
4891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4893         return ret_ref;
4894 }
4895
4896 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4897 CHECK(!owner->result_ok);
4898         return DecodeError_clone(&*owner->contents.err);
4899 }
4900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4901         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4902         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4903         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4904         int64_t ret_ref = tag_ptr(ret_copy, true);
4905         return ret_ref;
4906 }
4907
4908 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4909         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
4910         ret.is_owned = false;
4911         return ret;
4912 }
4913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4914         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4915         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
4916         int64_t ret_ref = 0;
4917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4919         return ret_ref;
4920 }
4921
4922 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
4923 CHECK(!owner->result_ok);
4924         return DecodeError_clone(&*owner->contents.err);
4925 }
4926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4927         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
4928         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4929         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
4930         int64_t ret_ref = tag_ptr(ret_copy, true);
4931         return ret_ref;
4932 }
4933
4934 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4935         LDKBlindedHopFeatures ret = *owner->contents.result;
4936         ret.is_owned = false;
4937         return ret;
4938 }
4939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4940         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4941         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
4942         int64_t ret_ref = 0;
4943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4945         return ret_ref;
4946 }
4947
4948 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
4949 CHECK(!owner->result_ok);
4950         return DecodeError_clone(&*owner->contents.err);
4951 }
4952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4953         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
4954         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4955         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
4956         int64_t ret_ref = tag_ptr(ret_copy, true);
4957         return ret_ref;
4958 }
4959
4960 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4961         LDKChannelTypeFeatures ret = *owner->contents.result;
4962         ret.is_owned = false;
4963         return ret;
4964 }
4965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4966         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4967         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
4968         int64_t ret_ref = 0;
4969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4971         return ret_ref;
4972 }
4973
4974 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
4975 CHECK(!owner->result_ok);
4976         return DecodeError_clone(&*owner->contents.err);
4977 }
4978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4979         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
4980         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4981         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
4982         int64_t ret_ref = tag_ptr(ret_copy, true);
4983         return ret_ref;
4984 }
4985
4986 static inline LDKCVec_ChainHashZ CVec_ChainHashZ_clone(const LDKCVec_ChainHashZ *orig) {
4987         LDKCVec_ChainHashZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ChainHashZ clone bytes"), .datalen = orig->datalen };
4988         for (size_t i = 0; i < ret.datalen; i++) {
4989                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4990         }
4991         return ret;
4992 }
4993 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
4994         LDKOffer ret = *owner->contents.result;
4995         ret.is_owned = false;
4996         return ret;
4997 }
4998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4999         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5000         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5001         int64_t ret_ref = 0;
5002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5004         return ret_ref;
5005 }
5006
5007 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5008         LDKBolt12ParseError ret = *owner->contents.err;
5009         ret.is_owned = false;
5010         return ret;
5011 }
5012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5013         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5014         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5015         int64_t ret_ref = 0;
5016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5018         return ret_ref;
5019 }
5020
5021 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5022 CHECK(owner->result_ok);
5023         return *owner->contents.result;
5024 }
5025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5026         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5027         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5028         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
5029         return ret_arr;
5030 }
5031
5032 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5033 CHECK(!owner->result_ok);
5034         return *owner->contents.err;
5035 }
5036 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5037         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5038         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
5039         return ret_conv;
5040 }
5041
5042 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5043         LDKNodeId ret = *owner->contents.result;
5044         ret.is_owned = false;
5045         return ret;
5046 }
5047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5048         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5049         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5050         int64_t ret_ref = 0;
5051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5053         return ret_ref;
5054 }
5055
5056 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5057 CHECK(!owner->result_ok);
5058         return DecodeError_clone(&*owner->contents.err);
5059 }
5060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5061         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5062         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5063         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5064         int64_t ret_ref = tag_ptr(ret_copy, true);
5065         return ret_ref;
5066 }
5067
5068 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
5069 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
5070 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
5071 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
5072 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
5073 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
5074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
5075         LDKNetworkUpdate_ChannelUpdateMessage_class =
5076                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
5077         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
5078         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
5079         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
5080         LDKNetworkUpdate_ChannelFailure_class =
5081                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
5082         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
5083         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
5084         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
5085         LDKNetworkUpdate_NodeFailure_class =
5086                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
5087         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
5088         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
5089         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
5090 }
5091 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5092         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
5093         switch(obj->tag) {
5094                 case LDKNetworkUpdate_ChannelUpdateMessage: {
5095                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
5096                         int64_t msg_ref = 0;
5097                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5098                         msg_ref = tag_ptr(msg_var.inner, false);
5099                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
5100                 }
5101                 case LDKNetworkUpdate_ChannelFailure: {
5102                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
5103                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
5104                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
5105                 }
5106                 case LDKNetworkUpdate_NodeFailure: {
5107                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5108                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
5109                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
5110                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
5111                 }
5112                 default: abort();
5113         }
5114 }
5115 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
5116 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
5117 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
5118 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
5119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
5120         LDKCOption_NetworkUpdateZ_Some_class =
5121                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
5122         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
5123         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
5124         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
5125         LDKCOption_NetworkUpdateZ_None_class =
5126                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
5127         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
5128         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
5129         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
5130 }
5131 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5132         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
5133         switch(obj->tag) {
5134                 case LDKCOption_NetworkUpdateZ_Some: {
5135                         int64_t some_ref = tag_ptr(&obj->some, false);
5136                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
5137                 }
5138                 case LDKCOption_NetworkUpdateZ_None: {
5139                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
5140                 }
5141                 default: abort();
5142         }
5143 }
5144 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5145 CHECK(owner->result_ok);
5146         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5147 }
5148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5149         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5150         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5151         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5152         int64_t ret_ref = tag_ptr(ret_copy, true);
5153         return ret_ref;
5154 }
5155
5156 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5157 CHECK(!owner->result_ok);
5158         return DecodeError_clone(&*owner->contents.err);
5159 }
5160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5161         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5162         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5163         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5164         int64_t ret_ref = tag_ptr(ret_copy, true);
5165         return ret_ref;
5166 }
5167
5168 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5169 CHECK(owner->result_ok);
5170         return TxOut_clone(&*owner->contents.result);
5171 }
5172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5173         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5174         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5175         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5176         return tag_ptr(ret_ref, true);
5177 }
5178
5179 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5180 CHECK(!owner->result_ok);
5181         return UtxoLookupError_clone(&*owner->contents.err);
5182 }
5183 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5184         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5185         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5186         return ret_conv;
5187 }
5188
5189 static jclass LDKUtxoResult_Sync_class = NULL;
5190 static jmethodID LDKUtxoResult_Sync_meth = NULL;
5191 static jclass LDKUtxoResult_Async_class = NULL;
5192 static jmethodID LDKUtxoResult_Async_meth = NULL;
5193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
5194         LDKUtxoResult_Sync_class =
5195                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
5196         CHECK(LDKUtxoResult_Sync_class != NULL);
5197         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
5198         CHECK(LDKUtxoResult_Sync_meth != NULL);
5199         LDKUtxoResult_Async_class =
5200                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
5201         CHECK(LDKUtxoResult_Async_class != NULL);
5202         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
5203         CHECK(LDKUtxoResult_Async_meth != NULL);
5204 }
5205 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5206         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5207         switch(obj->tag) {
5208                 case LDKUtxoResult_Sync: {
5209                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5210                         *sync_conv = obj->sync;
5211                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5212                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
5213                 }
5214                 case LDKUtxoResult_Async: {
5215                         LDKUtxoFuture async_var = obj->async;
5216                         int64_t async_ref = 0;
5217                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5218                         async_ref = tag_ptr(async_var.inner, false);
5219                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
5220                 }
5221                 default: abort();
5222         }
5223 }
5224 typedef struct LDKUtxoLookup_JCalls {
5225         atomic_size_t refcnt;
5226         JavaVM *vm;
5227         jweak o;
5228         jmethodID get_utxo_meth;
5229 } LDKUtxoLookup_JCalls;
5230 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5231         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5232         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5233                 JNIEnv *env;
5234                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5235                 if (get_jenv_res == JNI_EDETACHED) {
5236                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5237                 } else {
5238                         DO_ASSERT(get_jenv_res == JNI_OK);
5239                 }
5240                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5241                 if (get_jenv_res == JNI_EDETACHED) {
5242                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5243                 }
5244                 FREE(j_calls);
5245         }
5246 }
5247 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
5248         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5249         JNIEnv *env;
5250         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5251         if (get_jenv_res == JNI_EDETACHED) {
5252                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5253         } else {
5254                 DO_ASSERT(get_jenv_res == JNI_OK);
5255         }
5256         int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
5257         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
5258         int64_t short_channel_id_conv = short_channel_id;
5259         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5260         CHECK(obj != NULL);
5261         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
5262         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5263                 (*env)->ExceptionDescribe(env);
5264                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
5265         }
5266         void* ret_ptr = untag_ptr(ret);
5267         CHECK_ACCESS(ret_ptr);
5268         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5269         FREE(untag_ptr(ret));
5270         if (get_jenv_res == JNI_EDETACHED) {
5271                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5272         }
5273         return ret_conv;
5274 }
5275 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5276         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5277         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5278 }
5279 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
5280         jclass c = (*env)->GetObjectClass(env, o);
5281         CHECK(c != NULL);
5282         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5283         atomic_init(&calls->refcnt, 1);
5284         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5285         calls->o = (*env)->NewWeakGlobalRef(env, o);
5286         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5287         CHECK(calls->get_utxo_meth != NULL);
5288
5289         LDKUtxoLookup ret = {
5290                 .this_arg = (void*) calls,
5291                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5292                 .free = LDKUtxoLookup_JCalls_free,
5293         };
5294         return ret;
5295 }
5296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
5297         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5298         *res_ptr = LDKUtxoLookup_init(env, clz, o);
5299         return tag_ptr(res_ptr, true);
5300 }
5301 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) {
5302         void* this_arg_ptr = untag_ptr(this_arg);
5303         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5304         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5305         uint8_t genesis_hash_arr[32];
5306         CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
5307         (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
5308         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
5309         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5310         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
5311         int64_t ret_ref = tag_ptr(ret_copy, true);
5312         return ret_ref;
5313 }
5314
5315 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
5316 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
5317 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
5318 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
5319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
5320         LDKCOption_UtxoLookupZ_Some_class =
5321                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
5322         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
5323         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
5324         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
5325         LDKCOption_UtxoLookupZ_None_class =
5326                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
5327         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
5328         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
5329         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
5330 }
5331 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5332         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5333         switch(obj->tag) {
5334                 case LDKCOption_UtxoLookupZ_Some: {
5335                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5336                         *some_ret = obj->some;
5337                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5338                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5339                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5340                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5341                         }
5342                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
5343                 }
5344                 case LDKCOption_UtxoLookupZ_None: {
5345                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
5346                 }
5347                 default: abort();
5348         }
5349 }
5350 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5351 CHECK(owner->result_ok);
5352         return *owner->contents.result;
5353 }
5354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5355         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5356         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5357 }
5358
5359 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5360         LDKLightningError ret = *owner->contents.err;
5361         ret.is_owned = false;
5362         return ret;
5363 }
5364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5365         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5366         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5367         int64_t ret_ref = 0;
5368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5370         return ret_ref;
5371 }
5372
5373 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5374 CHECK(owner->result_ok);
5375         return *owner->contents.result;
5376 }
5377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5378         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5379         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5380         return ret_conv;
5381 }
5382
5383 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5384         LDKLightningError ret = *owner->contents.err;
5385         ret.is_owned = false;
5386         return ret;
5387 }
5388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5389         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5390         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5391         int64_t ret_ref = 0;
5392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5394         return ret_ref;
5395 }
5396
5397 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5398         LDKChannelAnnouncement ret = owner->a;
5399         ret.is_owned = false;
5400         return ret;
5401 }
5402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5403         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5404         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5405         int64_t ret_ref = 0;
5406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5408         return ret_ref;
5409 }
5410
5411 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5412         LDKChannelUpdate ret = owner->b;
5413         ret.is_owned = false;
5414         return ret;
5415 }
5416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5417         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5418         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5419         int64_t ret_ref = 0;
5420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5422         return ret_ref;
5423 }
5424
5425 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5426         LDKChannelUpdate ret = owner->c;
5427         ret.is_owned = false;
5428         return ret;
5429 }
5430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5431         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5432         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5433         int64_t ret_ref = 0;
5434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5436         return ret_ref;
5437 }
5438
5439 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
5440 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
5441 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
5442 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
5443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
5444         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
5445                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
5446         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
5447         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
5448         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
5449         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
5450                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
5451         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
5452         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
5453         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
5454 }
5455 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5456         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5457         switch(obj->tag) {
5458                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
5459                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5460                         *some_conv = obj->some;
5461                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
5462                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
5463                 }
5464                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
5465                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
5466                 }
5467                 default: abort();
5468         }
5469 }
5470 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
5471 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
5472 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
5473 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
5474 static jclass LDKErrorAction_IgnoreError_class = NULL;
5475 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
5476 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
5477 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
5478 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
5479 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
5480 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
5481 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
5482 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
5483 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
5484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
5485         LDKErrorAction_DisconnectPeer_class =
5486                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
5487         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
5488         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
5489         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
5490         LDKErrorAction_DisconnectPeerWithWarning_class =
5491                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
5492         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
5493         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
5494         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
5495         LDKErrorAction_IgnoreError_class =
5496                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
5497         CHECK(LDKErrorAction_IgnoreError_class != NULL);
5498         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
5499         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
5500         LDKErrorAction_IgnoreAndLog_class =
5501                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
5502         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
5503         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
5504         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
5505         LDKErrorAction_IgnoreDuplicateGossip_class =
5506                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
5507         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
5508         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
5509         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
5510         LDKErrorAction_SendErrorMessage_class =
5511                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
5512         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
5513         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
5514         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
5515         LDKErrorAction_SendWarningMessage_class =
5516                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
5517         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
5518         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
5519         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
5520 }
5521 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5522         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
5523         switch(obj->tag) {
5524                 case LDKErrorAction_DisconnectPeer: {
5525                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
5526                         int64_t msg_ref = 0;
5527                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5528                         msg_ref = tag_ptr(msg_var.inner, false);
5529                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
5530                 }
5531                 case LDKErrorAction_DisconnectPeerWithWarning: {
5532                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
5533                         int64_t msg_ref = 0;
5534                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5535                         msg_ref = tag_ptr(msg_var.inner, false);
5536                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
5537                 }
5538                 case LDKErrorAction_IgnoreError: {
5539                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
5540                 }
5541                 case LDKErrorAction_IgnoreAndLog: {
5542                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
5543                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
5544                 }
5545                 case LDKErrorAction_IgnoreDuplicateGossip: {
5546                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
5547                 }
5548                 case LDKErrorAction_SendErrorMessage: {
5549                         LDKErrorMessage msg_var = obj->send_error_message.msg;
5550                         int64_t msg_ref = 0;
5551                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5552                         msg_ref = tag_ptr(msg_var.inner, false);
5553                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
5554                 }
5555                 case LDKErrorAction_SendWarningMessage: {
5556                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
5557                         int64_t msg_ref = 0;
5558                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5559                         msg_ref = tag_ptr(msg_var.inner, false);
5560                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
5561                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
5562                 }
5563                 default: abort();
5564         }
5565 }
5566 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
5567 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
5568 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
5569 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
5570 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
5571 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
5572 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
5573 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
5574 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
5575 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
5576 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
5577 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
5578 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
5579 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
5580 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
5581 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
5582 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
5583 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
5584 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
5585 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
5586 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
5587 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
5588 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
5589 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
5590 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
5591 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
5592 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
5593 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
5594 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
5595 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
5596 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
5597 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
5598 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
5599 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
5600 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
5601 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
5602 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
5603 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
5604 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
5605 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
5606 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
5607 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
5608 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
5609 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
5610 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
5611 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
5612 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
5613 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
5614 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
5615 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
5616 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
5617 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
5618 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
5619 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
5620 static jclass LDKMessageSendEvent_HandleError_class = NULL;
5621 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
5622 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
5623 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
5624 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
5625 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
5626 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
5627 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
5628 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
5629 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
5630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
5631         LDKMessageSendEvent_SendAcceptChannel_class =
5632                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
5633         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
5634         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
5635         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
5636         LDKMessageSendEvent_SendAcceptChannelV2_class =
5637                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
5638         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
5639         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
5640         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
5641         LDKMessageSendEvent_SendOpenChannel_class =
5642                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
5643         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
5644         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
5645         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
5646         LDKMessageSendEvent_SendOpenChannelV2_class =
5647                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
5648         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
5649         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
5650         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
5651         LDKMessageSendEvent_SendFundingCreated_class =
5652                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
5653         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
5654         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
5655         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
5656         LDKMessageSendEvent_SendFundingSigned_class =
5657                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
5658         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
5659         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
5660         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
5661         LDKMessageSendEvent_SendTxAddInput_class =
5662                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
5663         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
5664         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
5665         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
5666         LDKMessageSendEvent_SendTxAddOutput_class =
5667                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
5668         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
5669         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
5670         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
5671         LDKMessageSendEvent_SendTxRemoveInput_class =
5672                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
5673         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
5674         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
5675         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
5676         LDKMessageSendEvent_SendTxRemoveOutput_class =
5677                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
5678         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
5679         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
5680         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
5681         LDKMessageSendEvent_SendTxComplete_class =
5682                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
5683         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
5684         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
5685         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
5686         LDKMessageSendEvent_SendTxSignatures_class =
5687                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
5688         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
5689         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
5690         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
5691         LDKMessageSendEvent_SendTxInitRbf_class =
5692                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
5693         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
5694         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
5695         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
5696         LDKMessageSendEvent_SendTxAckRbf_class =
5697                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
5698         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
5699         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
5700         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
5701         LDKMessageSendEvent_SendTxAbort_class =
5702                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
5703         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
5704         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
5705         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
5706         LDKMessageSendEvent_SendChannelReady_class =
5707                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
5708         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
5709         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
5710         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
5711         LDKMessageSendEvent_SendAnnouncementSignatures_class =
5712                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
5713         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
5714         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
5715         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
5716         LDKMessageSendEvent_UpdateHTLCs_class =
5717                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
5718         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
5719         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
5720         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
5721         LDKMessageSendEvent_SendRevokeAndACK_class =
5722                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
5723         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
5724         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
5725         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
5726         LDKMessageSendEvent_SendClosingSigned_class =
5727                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
5728         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
5729         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
5730         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
5731         LDKMessageSendEvent_SendShutdown_class =
5732                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
5733         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
5734         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
5735         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
5736         LDKMessageSendEvent_SendChannelReestablish_class =
5737                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
5738         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
5739         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
5740         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
5741         LDKMessageSendEvent_SendChannelAnnouncement_class =
5742                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
5743         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
5744         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
5745         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
5746         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
5747                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
5748         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
5749         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
5750         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
5751         LDKMessageSendEvent_BroadcastChannelUpdate_class =
5752                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
5753         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
5754         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
5755         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
5756         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
5757                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
5758         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
5759         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
5760         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
5761         LDKMessageSendEvent_SendChannelUpdate_class =
5762                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
5763         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
5764         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
5765         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
5766         LDKMessageSendEvent_HandleError_class =
5767                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
5768         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
5769         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
5770         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
5771         LDKMessageSendEvent_SendChannelRangeQuery_class =
5772                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
5773         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
5774         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
5775         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
5776         LDKMessageSendEvent_SendShortIdsQuery_class =
5777                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
5778         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
5779         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
5780         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
5781         LDKMessageSendEvent_SendReplyChannelRange_class =
5782                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
5783         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
5784         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
5785         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
5786         LDKMessageSendEvent_SendGossipTimestampFilter_class =
5787                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
5788         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
5789         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
5790         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
5791 }
5792 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5793         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5794         switch(obj->tag) {
5795                 case LDKMessageSendEvent_SendAcceptChannel: {
5796                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5797                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
5798                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
5799                         int64_t msg_ref = 0;
5800                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5801                         msg_ref = tag_ptr(msg_var.inner, false);
5802                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
5803                 }
5804                 case LDKMessageSendEvent_SendAcceptChannelV2: {
5805                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5806                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
5807                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
5808                         int64_t msg_ref = 0;
5809                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5810                         msg_ref = tag_ptr(msg_var.inner, false);
5811                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
5812                 }
5813                 case LDKMessageSendEvent_SendOpenChannel: {
5814                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5815                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
5816                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
5817                         int64_t msg_ref = 0;
5818                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5819                         msg_ref = tag_ptr(msg_var.inner, false);
5820                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
5821                 }
5822                 case LDKMessageSendEvent_SendOpenChannelV2: {
5823                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5824                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
5825                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
5826                         int64_t msg_ref = 0;
5827                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5828                         msg_ref = tag_ptr(msg_var.inner, false);
5829                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
5830                 }
5831                 case LDKMessageSendEvent_SendFundingCreated: {
5832                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5833                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
5834                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
5835                         int64_t msg_ref = 0;
5836                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5837                         msg_ref = tag_ptr(msg_var.inner, false);
5838                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
5839                 }
5840                 case LDKMessageSendEvent_SendFundingSigned: {
5841                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5842                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
5843                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
5844                         int64_t msg_ref = 0;
5845                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5846                         msg_ref = tag_ptr(msg_var.inner, false);
5847                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
5848                 }
5849                 case LDKMessageSendEvent_SendTxAddInput: {
5850                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5851                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
5852                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
5853                         int64_t msg_ref = 0;
5854                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5855                         msg_ref = tag_ptr(msg_var.inner, false);
5856                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
5857                 }
5858                 case LDKMessageSendEvent_SendTxAddOutput: {
5859                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5860                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
5861                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
5862                         int64_t msg_ref = 0;
5863                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5864                         msg_ref = tag_ptr(msg_var.inner, false);
5865                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
5866                 }
5867                 case LDKMessageSendEvent_SendTxRemoveInput: {
5868                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5869                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
5870                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
5871                         int64_t msg_ref = 0;
5872                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5873                         msg_ref = tag_ptr(msg_var.inner, false);
5874                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
5875                 }
5876                 case LDKMessageSendEvent_SendTxRemoveOutput: {
5877                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5878                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
5879                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
5880                         int64_t msg_ref = 0;
5881                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5882                         msg_ref = tag_ptr(msg_var.inner, false);
5883                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
5884                 }
5885                 case LDKMessageSendEvent_SendTxComplete: {
5886                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5887                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
5888                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
5889                         int64_t msg_ref = 0;
5890                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5891                         msg_ref = tag_ptr(msg_var.inner, false);
5892                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
5893                 }
5894                 case LDKMessageSendEvent_SendTxSignatures: {
5895                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5896                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
5897                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
5898                         int64_t msg_ref = 0;
5899                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5900                         msg_ref = tag_ptr(msg_var.inner, false);
5901                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
5902                 }
5903                 case LDKMessageSendEvent_SendTxInitRbf: {
5904                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5905                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
5906                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
5907                         int64_t msg_ref = 0;
5908                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5909                         msg_ref = tag_ptr(msg_var.inner, false);
5910                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
5911                 }
5912                 case LDKMessageSendEvent_SendTxAckRbf: {
5913                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5914                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
5915                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
5916                         int64_t msg_ref = 0;
5917                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5918                         msg_ref = tag_ptr(msg_var.inner, false);
5919                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
5920                 }
5921                 case LDKMessageSendEvent_SendTxAbort: {
5922                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5923                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
5924                         LDKTxAddInput msg_var = obj->send_tx_abort.msg;
5925                         int64_t msg_ref = 0;
5926                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5927                         msg_ref = tag_ptr(msg_var.inner, false);
5928                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
5929                 }
5930                 case LDKMessageSendEvent_SendChannelReady: {
5931                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5932                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
5933                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
5934                         int64_t msg_ref = 0;
5935                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5936                         msg_ref = tag_ptr(msg_var.inner, false);
5937                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
5938                 }
5939                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
5940                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5941                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
5942                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
5943                         int64_t msg_ref = 0;
5944                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5945                         msg_ref = tag_ptr(msg_var.inner, false);
5946                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
5947                 }
5948                 case LDKMessageSendEvent_UpdateHTLCs: {
5949                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5950                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
5951                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
5952                         int64_t updates_ref = 0;
5953                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
5954                         updates_ref = tag_ptr(updates_var.inner, false);
5955                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
5956                 }
5957                 case LDKMessageSendEvent_SendRevokeAndACK: {
5958                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5959                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
5960                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
5961                         int64_t msg_ref = 0;
5962                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5963                         msg_ref = tag_ptr(msg_var.inner, false);
5964                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
5965                 }
5966                 case LDKMessageSendEvent_SendClosingSigned: {
5967                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5968                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
5969                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
5970                         int64_t msg_ref = 0;
5971                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5972                         msg_ref = tag_ptr(msg_var.inner, false);
5973                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
5974                 }
5975                 case LDKMessageSendEvent_SendShutdown: {
5976                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5977                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
5978                         LDKShutdown msg_var = obj->send_shutdown.msg;
5979                         int64_t msg_ref = 0;
5980                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5981                         msg_ref = tag_ptr(msg_var.inner, false);
5982                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
5983                 }
5984                 case LDKMessageSendEvent_SendChannelReestablish: {
5985                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5986                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
5987                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
5988                         int64_t msg_ref = 0;
5989                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5990                         msg_ref = tag_ptr(msg_var.inner, false);
5991                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
5992                 }
5993                 case LDKMessageSendEvent_SendChannelAnnouncement: {
5994                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
5995                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
5996                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
5997                         int64_t msg_ref = 0;
5998                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5999                         msg_ref = tag_ptr(msg_var.inner, false);
6000                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
6001                         int64_t update_msg_ref = 0;
6002                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6003                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6004                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
6005                 }
6006                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
6007                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
6008                         int64_t msg_ref = 0;
6009                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6010                         msg_ref = tag_ptr(msg_var.inner, false);
6011                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
6012                         int64_t update_msg_ref = 0;
6013                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
6014                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
6015                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
6016                 }
6017                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
6018                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
6019                         int64_t msg_ref = 0;
6020                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6021                         msg_ref = tag_ptr(msg_var.inner, false);
6022                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
6023                 }
6024                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
6025                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
6026                         int64_t msg_ref = 0;
6027                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6028                         msg_ref = tag_ptr(msg_var.inner, false);
6029                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
6030                 }
6031                 case LDKMessageSendEvent_SendChannelUpdate: {
6032                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6033                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
6034                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
6035                         int64_t msg_ref = 0;
6036                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6037                         msg_ref = tag_ptr(msg_var.inner, false);
6038                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
6039                 }
6040                 case LDKMessageSendEvent_HandleError: {
6041                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6042                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
6043                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
6044                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
6045                 }
6046                 case LDKMessageSendEvent_SendChannelRangeQuery: {
6047                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6048                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
6049                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
6050                         int64_t msg_ref = 0;
6051                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6052                         msg_ref = tag_ptr(msg_var.inner, false);
6053                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
6054                 }
6055                 case LDKMessageSendEvent_SendShortIdsQuery: {
6056                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6057                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
6058                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
6059                         int64_t msg_ref = 0;
6060                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6061                         msg_ref = tag_ptr(msg_var.inner, false);
6062                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
6063                 }
6064                 case LDKMessageSendEvent_SendReplyChannelRange: {
6065                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6066                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
6067                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
6068                         int64_t msg_ref = 0;
6069                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6070                         msg_ref = tag_ptr(msg_var.inner, false);
6071                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
6072                 }
6073                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
6074                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6075                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
6076                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
6077                         int64_t msg_ref = 0;
6078                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6079                         msg_ref = tag_ptr(msg_var.inner, false);
6080                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
6081                 }
6082                 default: abort();
6083         }
6084 }
6085 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
6086         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
6087         for (size_t i = 0; i < ret.datalen; i++) {
6088                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
6089         }
6090         return ret;
6091 }
6092 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6093         LDKChannelUpdateInfo ret = *owner->contents.result;
6094         ret.is_owned = false;
6095         return ret;
6096 }
6097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6098         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6099         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
6100         int64_t ret_ref = 0;
6101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6103         return ret_ref;
6104 }
6105
6106 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
6107 CHECK(!owner->result_ok);
6108         return DecodeError_clone(&*owner->contents.err);
6109 }
6110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6111         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
6112         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6113         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
6114         int64_t ret_ref = tag_ptr(ret_copy, true);
6115         return ret_ref;
6116 }
6117
6118 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6119         LDKChannelInfo ret = *owner->contents.result;
6120         ret.is_owned = false;
6121         return ret;
6122 }
6123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6124         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6125         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
6126         int64_t ret_ref = 0;
6127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6129         return ret_ref;
6130 }
6131
6132 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
6133 CHECK(!owner->result_ok);
6134         return DecodeError_clone(&*owner->contents.err);
6135 }
6136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6137         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
6138         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6139         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
6140         int64_t ret_ref = tag_ptr(ret_copy, true);
6141         return ret_ref;
6142 }
6143
6144 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6145         LDKRoutingFees ret = *owner->contents.result;
6146         ret.is_owned = false;
6147         return ret;
6148 }
6149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6150         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6151         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
6152         int64_t ret_ref = 0;
6153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6155         return ret_ref;
6156 }
6157
6158 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
6159 CHECK(!owner->result_ok);
6160         return DecodeError_clone(&*owner->contents.err);
6161 }
6162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6163         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
6164         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6165         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
6166         int64_t ret_ref = tag_ptr(ret_copy, true);
6167         return ret_ref;
6168 }
6169
6170 static jclass LDKNetAddress_IPv4_class = NULL;
6171 static jmethodID LDKNetAddress_IPv4_meth = NULL;
6172 static jclass LDKNetAddress_IPv6_class = NULL;
6173 static jmethodID LDKNetAddress_IPv6_meth = NULL;
6174 static jclass LDKNetAddress_OnionV2_class = NULL;
6175 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
6176 static jclass LDKNetAddress_OnionV3_class = NULL;
6177 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
6178 static jclass LDKNetAddress_Hostname_class = NULL;
6179 static jmethodID LDKNetAddress_Hostname_meth = NULL;
6180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
6181         LDKNetAddress_IPv4_class =
6182                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
6183         CHECK(LDKNetAddress_IPv4_class != NULL);
6184         LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
6185         CHECK(LDKNetAddress_IPv4_meth != NULL);
6186         LDKNetAddress_IPv6_class =
6187                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
6188         CHECK(LDKNetAddress_IPv6_class != NULL);
6189         LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
6190         CHECK(LDKNetAddress_IPv6_meth != NULL);
6191         LDKNetAddress_OnionV2_class =
6192                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
6193         CHECK(LDKNetAddress_OnionV2_class != NULL);
6194         LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
6195         CHECK(LDKNetAddress_OnionV2_meth != NULL);
6196         LDKNetAddress_OnionV3_class =
6197                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
6198         CHECK(LDKNetAddress_OnionV3_class != NULL);
6199         LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
6200         CHECK(LDKNetAddress_OnionV3_meth != NULL);
6201         LDKNetAddress_Hostname_class =
6202                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$Hostname"));
6203         CHECK(LDKNetAddress_Hostname_class != NULL);
6204         LDKNetAddress_Hostname_meth = (*env)->GetMethodID(env, LDKNetAddress_Hostname_class, "<init>", "(JS)V");
6205         CHECK(LDKNetAddress_Hostname_meth != NULL);
6206 }
6207 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6208         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
6209         switch(obj->tag) {
6210                 case LDKNetAddress_IPv4: {
6211                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
6212                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
6213                         int16_t port_conv = obj->i_pv4.port;
6214                         return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
6215                 }
6216                 case LDKNetAddress_IPv6: {
6217                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
6218                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
6219                         int16_t port_conv = obj->i_pv6.port;
6220                         return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
6221                 }
6222                 case LDKNetAddress_OnionV2: {
6223                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
6224                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
6225                         return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
6226                 }
6227                 case LDKNetAddress_OnionV3: {
6228                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
6229                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
6230                         int16_t checksum_conv = obj->onion_v3.checksum;
6231                         int8_t version_conv = obj->onion_v3.version;
6232                         int16_t port_conv = obj->onion_v3.port;
6233                         return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
6234                 }
6235                 case LDKNetAddress_Hostname: {
6236                         LDKHostname hostname_var = obj->hostname.hostname;
6237                         int64_t hostname_ref = 0;
6238                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
6239                         hostname_ref = tag_ptr(hostname_var.inner, false);
6240                         int16_t port_conv = obj->hostname.port;
6241                         return (*env)->NewObject(env, LDKNetAddress_Hostname_class, LDKNetAddress_Hostname_meth, hostname_ref, port_conv);
6242                 }
6243                 default: abort();
6244         }
6245 }
6246 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
6247         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
6248         for (size_t i = 0; i < ret.datalen; i++) {
6249                 ret.data[i] = NetAddress_clone(&orig->data[i]);
6250         }
6251         return ret;
6252 }
6253 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6254         LDKNodeAnnouncementInfo ret = *owner->contents.result;
6255         ret.is_owned = false;
6256         return ret;
6257 }
6258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6259         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6260         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
6261         int64_t ret_ref = 0;
6262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6264         return ret_ref;
6265 }
6266
6267 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
6268 CHECK(!owner->result_ok);
6269         return DecodeError_clone(&*owner->contents.err);
6270 }
6271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6272         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
6273         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6274         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
6275         int64_t ret_ref = tag_ptr(ret_copy, true);
6276         return ret_ref;
6277 }
6278
6279 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6280         LDKNodeAlias ret = *owner->contents.result;
6281         ret.is_owned = false;
6282         return ret;
6283 }
6284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6285         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6286         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
6287         int64_t ret_ref = 0;
6288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6290         return ret_ref;
6291 }
6292
6293 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
6294 CHECK(!owner->result_ok);
6295         return DecodeError_clone(&*owner->contents.err);
6296 }
6297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6298         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
6299         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6300         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
6301         int64_t ret_ref = tag_ptr(ret_copy, true);
6302         return ret_ref;
6303 }
6304
6305 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6306         LDKNodeInfo ret = *owner->contents.result;
6307         ret.is_owned = false;
6308         return ret;
6309 }
6310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6311         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6312         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
6313         int64_t ret_ref = 0;
6314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6316         return ret_ref;
6317 }
6318
6319 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
6320 CHECK(!owner->result_ok);
6321         return DecodeError_clone(&*owner->contents.err);
6322 }
6323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6324         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
6325         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6326         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
6327         int64_t ret_ref = tag_ptr(ret_copy, true);
6328         return ret_ref;
6329 }
6330
6331 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6332         LDKNetworkGraph ret = *owner->contents.result;
6333         ret.is_owned = false;
6334         return ret;
6335 }
6336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6337         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6338         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
6339         int64_t ret_ref = 0;
6340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6342         return ret_ref;
6343 }
6344
6345 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
6346 CHECK(!owner->result_ok);
6347         return DecodeError_clone(&*owner->contents.err);
6348 }
6349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6350         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
6351         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6352         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
6353         int64_t ret_ref = tag_ptr(ret_copy, true);
6354         return ret_ref;
6355 }
6356
6357 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
6358 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
6359 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
6360 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
6361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
6362         LDKCOption_CVec_NetAddressZZ_Some_class =
6363                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
6364         CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
6365         LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
6366         CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
6367         LDKCOption_CVec_NetAddressZZ_None_class =
6368                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
6369         CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
6370         LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
6371         CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
6372 }
6373 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6374         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
6375         switch(obj->tag) {
6376                 case LDKCOption_CVec_NetAddressZZ_Some: {
6377                         LDKCVec_NetAddressZ some_var = obj->some;
6378                         int64_tArray some_arr = NULL;
6379                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
6380                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
6381                         for (size_t m = 0; m < some_var.datalen; m++) {
6382                                 int64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
6383                                 some_arr_ptr[m] = some_conv_12_ref;
6384                         }
6385                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
6386                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
6387                 }
6388                 case LDKCOption_CVec_NetAddressZZ_None: {
6389                         return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
6390                 }
6391                 default: abort();
6392         }
6393 }
6394 static jclass LDKCOption_PaymentPreimageZ_Some_class = NULL;
6395 static jmethodID LDKCOption_PaymentPreimageZ_Some_meth = NULL;
6396 static jclass LDKCOption_PaymentPreimageZ_None_class = NULL;
6397 static jmethodID LDKCOption_PaymentPreimageZ_None_meth = NULL;
6398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentPreimageZ_init (JNIEnv *env, jclass clz) {
6399         LDKCOption_PaymentPreimageZ_Some_class =
6400                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentPreimageZ$Some"));
6401         CHECK(LDKCOption_PaymentPreimageZ_Some_class != NULL);
6402         LDKCOption_PaymentPreimageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentPreimageZ_Some_class, "<init>", "([B)V");
6403         CHECK(LDKCOption_PaymentPreimageZ_Some_meth != NULL);
6404         LDKCOption_PaymentPreimageZ_None_class =
6405                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentPreimageZ$None"));
6406         CHECK(LDKCOption_PaymentPreimageZ_None_class != NULL);
6407         LDKCOption_PaymentPreimageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentPreimageZ_None_class, "<init>", "()V");
6408         CHECK(LDKCOption_PaymentPreimageZ_None_meth != NULL);
6409 }
6410 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentPreimageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6411         LDKCOption_PaymentPreimageZ *obj = (LDKCOption_PaymentPreimageZ*)untag_ptr(ptr);
6412         switch(obj->tag) {
6413                 case LDKCOption_PaymentPreimageZ_Some: {
6414                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
6415                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
6416                         return (*env)->NewObject(env, LDKCOption_PaymentPreimageZ_Some_class, LDKCOption_PaymentPreimageZ_Some_meth, some_arr);
6417                 }
6418                 case LDKCOption_PaymentPreimageZ_None: {
6419                         return (*env)->NewObject(env, LDKCOption_PaymentPreimageZ_None_class, LDKCOption_PaymentPreimageZ_None_meth);
6420                 }
6421                 default: abort();
6422         }
6423 }
6424 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
6425         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
6426         for (size_t i = 0; i < ret.datalen; i++) {
6427                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
6428         }
6429         return ret;
6430 }
6431 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
6432         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
6433         for (size_t i = 0; i < ret.datalen; i++) {
6434                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
6435         }
6436         return ret;
6437 }
6438 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
6439         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
6440         for (size_t i = 0; i < ret.datalen; i++) {
6441                 ret.data[i] = Utxo_clone(&orig->data[i]);
6442         }
6443         return ret;
6444 }
6445 static jclass LDKCOption_TxOutZ_Some_class = NULL;
6446 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
6447 static jclass LDKCOption_TxOutZ_None_class = NULL;
6448 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
6449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
6450         LDKCOption_TxOutZ_Some_class =
6451                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
6452         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
6453         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
6454         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
6455         LDKCOption_TxOutZ_None_class =
6456                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
6457         CHECK(LDKCOption_TxOutZ_None_class != NULL);
6458         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
6459         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
6460 }
6461 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6462         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
6463         switch(obj->tag) {
6464                 case LDKCOption_TxOutZ_Some: {
6465                         LDKTxOut* some_ref = &obj->some;
6466                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
6467                 }
6468                 case LDKCOption_TxOutZ_None: {
6469                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
6470                 }
6471                 default: abort();
6472         }
6473 }
6474 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
6475         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
6476         for (size_t i = 0; i < ret.datalen; i++) {
6477                 ret.data[i] = Input_clone(&orig->data[i]);
6478         }
6479         return ret;
6480 }
6481 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6482         LDKCoinSelection ret = *owner->contents.result;
6483         ret.is_owned = false;
6484         return ret;
6485 }
6486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6487         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6488         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
6489         int64_t ret_ref = 0;
6490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6492         return ret_ref;
6493 }
6494
6495 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
6496 CHECK(!owner->result_ok);
6497         return *owner->contents.err;
6498 }
6499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6500         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
6501         CResult_CoinSelectionNoneZ_get_err(owner_conv);
6502 }
6503
6504 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6505 CHECK(owner->result_ok);
6506         return CVec_UtxoZ_clone(&*owner->contents.result);
6507 }
6508 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6509         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6510         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
6511         int64_tArray ret_arr = NULL;
6512         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6513         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6514         for (size_t g = 0; g < ret_var.datalen; g++) {
6515                 LDKUtxo ret_conv_6_var = ret_var.data[g];
6516                 int64_t ret_conv_6_ref = 0;
6517                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
6518                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
6519                 ret_arr_ptr[g] = ret_conv_6_ref;
6520         }
6521         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6522         FREE(ret_var.data);
6523         return ret_arr;
6524 }
6525
6526 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
6527 CHECK(!owner->result_ok);
6528         return *owner->contents.err;
6529 }
6530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6531         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
6532         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
6533 }
6534
6535 static jclass LDKCOption_u16Z_Some_class = NULL;
6536 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
6537 static jclass LDKCOption_u16Z_None_class = NULL;
6538 static jmethodID LDKCOption_u16Z_None_meth = NULL;
6539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
6540         LDKCOption_u16Z_Some_class =
6541                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
6542         CHECK(LDKCOption_u16Z_Some_class != NULL);
6543         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
6544         CHECK(LDKCOption_u16Z_Some_meth != NULL);
6545         LDKCOption_u16Z_None_class =
6546                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
6547         CHECK(LDKCOption_u16Z_None_class != NULL);
6548         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
6549         CHECK(LDKCOption_u16Z_None_meth != NULL);
6550 }
6551 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6552         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
6553         switch(obj->tag) {
6554                 case LDKCOption_u16Z_Some: {
6555                         int16_t some_conv = obj->some;
6556                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
6557                 }
6558                 case LDKCOption_u16Z_None: {
6559                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
6560                 }
6561                 default: abort();
6562         }
6563 }
6564 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
6565 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
6566 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
6567 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
6568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
6569         LDKCOption_ChannelShutdownStateZ_Some_class =
6570                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
6571         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
6572         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
6573         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
6574         LDKCOption_ChannelShutdownStateZ_None_class =
6575                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
6576         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
6577         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
6578         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
6579 }
6580 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6581         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
6582         switch(obj->tag) {
6583                 case LDKCOption_ChannelShutdownStateZ_Some: {
6584                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
6585                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
6586                 }
6587                 case LDKCOption_ChannelShutdownStateZ_None: {
6588                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
6589                 }
6590                 default: abort();
6591         }
6592 }
6593 static jclass LDKCOption_PaymentHashZ_Some_class = NULL;
6594 static jmethodID LDKCOption_PaymentHashZ_Some_meth = NULL;
6595 static jclass LDKCOption_PaymentHashZ_None_class = NULL;
6596 static jmethodID LDKCOption_PaymentHashZ_None_meth = NULL;
6597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentHashZ_init (JNIEnv *env, jclass clz) {
6598         LDKCOption_PaymentHashZ_Some_class =
6599                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentHashZ$Some"));
6600         CHECK(LDKCOption_PaymentHashZ_Some_class != NULL);
6601         LDKCOption_PaymentHashZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentHashZ_Some_class, "<init>", "([B)V");
6602         CHECK(LDKCOption_PaymentHashZ_Some_meth != NULL);
6603         LDKCOption_PaymentHashZ_None_class =
6604                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentHashZ$None"));
6605         CHECK(LDKCOption_PaymentHashZ_None_class != NULL);
6606         LDKCOption_PaymentHashZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentHashZ_None_class, "<init>", "()V");
6607         CHECK(LDKCOption_PaymentHashZ_None_meth != NULL);
6608 }
6609 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentHashZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6610         LDKCOption_PaymentHashZ *obj = (LDKCOption_PaymentHashZ*)untag_ptr(ptr);
6611         switch(obj->tag) {
6612                 case LDKCOption_PaymentHashZ_Some: {
6613                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
6614                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
6615                         return (*env)->NewObject(env, LDKCOption_PaymentHashZ_Some_class, LDKCOption_PaymentHashZ_Some_meth, some_arr);
6616                 }
6617                 case LDKCOption_PaymentHashZ_None: {
6618                         return (*env)->NewObject(env, LDKCOption_PaymentHashZ_None_class, LDKCOption_PaymentHashZ_None_meth);
6619                 }
6620                 default: abort();
6621         }
6622 }
6623 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6624 CHECK(owner->result_ok);
6625         return ThirtyTwoBytes_clone(&*owner->contents.result);
6626 }
6627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6628         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
6629         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6630         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
6631         return ret_arr;
6632 }
6633
6634 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
6635 CHECK(!owner->result_ok);
6636         return APIError_clone(&*owner->contents.err);
6637 }
6638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6639         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
6640         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6641         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
6642         int64_t ret_ref = tag_ptr(ret_copy, true);
6643         return ret_ref;
6644 }
6645
6646 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
6647 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
6648 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
6649 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
6650 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
6651 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
6652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
6653         LDKRecentPaymentDetails_Pending_class =
6654                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
6655         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
6656         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([BJ)V");
6657         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
6658         LDKRecentPaymentDetails_Fulfilled_class =
6659                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
6660         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
6661         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "(J)V");
6662         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
6663         LDKRecentPaymentDetails_Abandoned_class =
6664                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
6665         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
6666         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B)V");
6667         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
6668 }
6669 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6670         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
6671         switch(obj->tag) {
6672                 case LDKRecentPaymentDetails_Pending: {
6673                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
6674                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
6675                         int64_t total_msat_conv = obj->pending.total_msat;
6676                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_hash_arr, total_msat_conv);
6677                 }
6678                 case LDKRecentPaymentDetails_Fulfilled: {
6679                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
6680                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_hash_ref);
6681                 }
6682                 case LDKRecentPaymentDetails_Abandoned: {
6683                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
6684                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
6685                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_hash_arr);
6686                 }
6687                 default: abort();
6688         }
6689 }
6690 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
6691         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
6692         for (size_t i = 0; i < ret.datalen; i++) {
6693                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
6694         }
6695         return ret;
6696 }
6697 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
6698 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
6699 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
6700 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
6701 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
6702 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
6703 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
6704 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
6705 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
6706 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
6707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
6708         LDKPaymentSendFailure_ParameterError_class =
6709                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
6710         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
6711         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
6712         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
6713         LDKPaymentSendFailure_PathParameterError_class =
6714                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
6715         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
6716         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
6717         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
6718         LDKPaymentSendFailure_AllFailedResendSafe_class =
6719                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
6720         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
6721         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
6722         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
6723         LDKPaymentSendFailure_DuplicatePayment_class =
6724                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
6725         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
6726         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
6727         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
6728         LDKPaymentSendFailure_PartialFailure_class =
6729                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
6730         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
6731         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
6732         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
6733 }
6734 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6735         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6736         switch(obj->tag) {
6737                 case LDKPaymentSendFailure_ParameterError: {
6738                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
6739                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
6740                 }
6741                 case LDKPaymentSendFailure_PathParameterError: {
6742                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6743                         int64_tArray path_parameter_error_arr = NULL;
6744                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
6745                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
6746                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6747                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6748                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6749                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6750                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
6751                         }
6752                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
6753                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
6754                 }
6755                 case LDKPaymentSendFailure_AllFailedResendSafe: {
6756                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
6757                         int64_tArray all_failed_resend_safe_arr = NULL;
6758                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
6759                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
6760                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
6761                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
6762                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
6763                         }
6764                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
6765                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
6766                 }
6767                 case LDKPaymentSendFailure_DuplicatePayment: {
6768                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
6769                 }
6770                 case LDKPaymentSendFailure_PartialFailure: {
6771                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6772                         int64_tArray results_arr = NULL;
6773                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
6774                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
6775                         for (size_t w = 0; w < results_var.datalen; w++) {
6776                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6777                                 *results_conv_22_conv = results_var.data[w];
6778                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6779                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
6780                         }
6781                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
6782                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6783                         int64_t failed_paths_retry_ref = 0;
6784                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6785                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
6786                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
6787                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
6788                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
6789                 }
6790                 default: abort();
6791         }
6792 }
6793 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6794 CHECK(owner->result_ok);
6795         return *owner->contents.result;
6796 }
6797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6798         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6799         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6800 }
6801
6802 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6803 CHECK(!owner->result_ok);
6804         return PaymentSendFailure_clone(&*owner->contents.err);
6805 }
6806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6807         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6808         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6809         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6810         int64_t ret_ref = tag_ptr(ret_copy, true);
6811         return ret_ref;
6812 }
6813
6814 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6815 CHECK(owner->result_ok);
6816         return *owner->contents.result;
6817 }
6818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6819         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6820         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
6821 }
6822
6823 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6824 CHECK(!owner->result_ok);
6825         return RetryableSendFailure_clone(&*owner->contents.err);
6826 }
6827 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6828         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6829         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
6830         return ret_conv;
6831 }
6832
6833 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
6834 CHECK(owner->result_ok);
6835         return ThirtyTwoBytes_clone(&*owner->contents.result);
6836 }
6837 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6838         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
6839         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6840         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data);
6841         return ret_arr;
6842 }
6843
6844 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
6845 CHECK(!owner->result_ok);
6846         return PaymentSendFailure_clone(&*owner->contents.err);
6847 }
6848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6849         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
6850         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6851         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
6852         int64_t ret_ref = tag_ptr(ret_copy, true);
6853         return ret_ref;
6854 }
6855
6856 static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
6857 CHECK(owner->result_ok);
6858         return ThirtyTwoBytes_clone(&*owner->contents.result);
6859 }
6860 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6861         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
6862         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6863         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data);
6864         return ret_arr;
6865 }
6866
6867 static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
6868 CHECK(!owner->result_ok);
6869         return RetryableSendFailure_clone(&*owner->contents.err);
6870 }
6871 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6872         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
6873         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv));
6874         return ret_conv;
6875 }
6876
6877 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6878         return ThirtyTwoBytes_clone(&owner->a);
6879 }
6880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6881         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6882         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6883         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
6884         return ret_arr;
6885 }
6886
6887 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6888         return ThirtyTwoBytes_clone(&owner->b);
6889 }
6890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6891         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6892         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6893         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
6894         return ret_arr;
6895 }
6896
6897 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6898 CHECK(owner->result_ok);
6899         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
6900 }
6901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6902         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6903         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
6904         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
6905         return tag_ptr(ret_conv, true);
6906 }
6907
6908 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6909 CHECK(!owner->result_ok);
6910         return PaymentSendFailure_clone(&*owner->contents.err);
6911 }
6912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6913         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6914         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6915         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
6916         int64_t ret_ref = tag_ptr(ret_copy, true);
6917         return ret_ref;
6918 }
6919
6920 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
6921         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
6922         for (size_t i = 0; i < ret.datalen; i++) {
6923                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
6924         }
6925         return ret;
6926 }
6927 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6928         return ThirtyTwoBytes_clone(&owner->a);
6929 }
6930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6931         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6932         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6933         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
6934         return ret_arr;
6935 }
6936
6937 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6938         return ThirtyTwoBytes_clone(&owner->b);
6939 }
6940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6941         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6942         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6943         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
6944         return ret_arr;
6945 }
6946
6947 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6948 CHECK(owner->result_ok);
6949         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6950 }
6951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6952         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6953         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6954         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6955         return tag_ptr(ret_conv, true);
6956 }
6957
6958 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6959 CHECK(!owner->result_ok);
6960         return *owner->contents.err;
6961 }
6962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6963         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6964         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6965 }
6966
6967 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6968 CHECK(owner->result_ok);
6969         return ThirtyTwoBytes_clone(&*owner->contents.result);
6970 }
6971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6972         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6973         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6974         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
6975         return ret_arr;
6976 }
6977
6978 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6979 CHECK(!owner->result_ok);
6980         return *owner->contents.err;
6981 }
6982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6983         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6984         CResult_PaymentSecretNoneZ_get_err(owner_conv);
6985 }
6986
6987 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6988 CHECK(owner->result_ok);
6989         return ThirtyTwoBytes_clone(&*owner->contents.result);
6990 }
6991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6992         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
6993         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6994         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
6995         return ret_arr;
6996 }
6997
6998 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6999 CHECK(!owner->result_ok);
7000         return APIError_clone(&*owner->contents.err);
7001 }
7002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7003         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
7004         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7005         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
7006         int64_t ret_ref = tag_ptr(ret_copy, true);
7007         return ret_ref;
7008 }
7009
7010 static jclass LDKCOption_CVec_ChainHashZZ_Some_class = NULL;
7011 static jmethodID LDKCOption_CVec_ChainHashZZ_Some_meth = NULL;
7012 static jclass LDKCOption_CVec_ChainHashZZ_None_class = NULL;
7013 static jmethodID LDKCOption_CVec_ChainHashZZ_None_meth = NULL;
7014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ChainHashZZ_init (JNIEnv *env, jclass clz) {
7015         LDKCOption_CVec_ChainHashZZ_Some_class =
7016                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ChainHashZZ$Some"));
7017         CHECK(LDKCOption_CVec_ChainHashZZ_Some_class != NULL);
7018         LDKCOption_CVec_ChainHashZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ChainHashZZ_Some_class, "<init>", "([[B)V");
7019         CHECK(LDKCOption_CVec_ChainHashZZ_Some_meth != NULL);
7020         LDKCOption_CVec_ChainHashZZ_None_class =
7021                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ChainHashZZ$None"));
7022         CHECK(LDKCOption_CVec_ChainHashZZ_None_class != NULL);
7023         LDKCOption_CVec_ChainHashZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ChainHashZZ_None_class, "<init>", "()V");
7024         CHECK(LDKCOption_CVec_ChainHashZZ_None_meth != NULL);
7025 }
7026 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ChainHashZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7027         LDKCOption_CVec_ChainHashZZ *obj = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(ptr);
7028         switch(obj->tag) {
7029                 case LDKCOption_CVec_ChainHashZZ_Some: {
7030                         LDKCVec_ChainHashZ some_var = obj->some;
7031                         jobjectArray some_arr = NULL;
7032                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
7033                         ;
7034                         for (size_t i = 0; i < some_var.datalen; i++) {
7035                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
7036                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
7037                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
7038                         }
7039                         
7040                         return (*env)->NewObject(env, LDKCOption_CVec_ChainHashZZ_Some_class, LDKCOption_CVec_ChainHashZZ_Some_meth, some_arr);
7041                 }
7042                 case LDKCOption_CVec_ChainHashZZ_None: {
7043                         return (*env)->NewObject(env, LDKCOption_CVec_ChainHashZZ_None_class, LDKCOption_CVec_ChainHashZZ_None_meth);
7044                 }
7045                 default: abort();
7046         }
7047 }
7048 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7049         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
7050         ret.is_owned = false;
7051         return ret;
7052 }
7053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7054         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7055         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
7056         int64_t ret_ref = 0;
7057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7059         return ret_ref;
7060 }
7061
7062 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
7063 CHECK(!owner->result_ok);
7064         return DecodeError_clone(&*owner->contents.err);
7065 }
7066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7067         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
7068         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7069         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
7070         int64_t ret_ref = tag_ptr(ret_copy, true);
7071         return ret_ref;
7072 }
7073
7074 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7075         LDKChannelCounterparty ret = *owner->contents.result;
7076         ret.is_owned = false;
7077         return ret;
7078 }
7079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7080         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7081         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
7082         int64_t ret_ref = 0;
7083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7085         return ret_ref;
7086 }
7087
7088 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
7089 CHECK(!owner->result_ok);
7090         return DecodeError_clone(&*owner->contents.err);
7091 }
7092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7093         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
7094         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7095         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
7096         int64_t ret_ref = tag_ptr(ret_copy, true);
7097         return ret_ref;
7098 }
7099
7100 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7101         LDKChannelDetails ret = *owner->contents.result;
7102         ret.is_owned = false;
7103         return ret;
7104 }
7105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7106         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7107         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
7108         int64_t ret_ref = 0;
7109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7111         return ret_ref;
7112 }
7113
7114 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
7115 CHECK(!owner->result_ok);
7116         return DecodeError_clone(&*owner->contents.err);
7117 }
7118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7119         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
7120         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7121         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
7122         int64_t ret_ref = tag_ptr(ret_copy, true);
7123         return ret_ref;
7124 }
7125
7126 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7127         LDKPhantomRouteHints ret = *owner->contents.result;
7128         ret.is_owned = false;
7129         return ret;
7130 }
7131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7132         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7133         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
7134         int64_t ret_ref = 0;
7135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7137         return ret_ref;
7138 }
7139
7140 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
7141 CHECK(!owner->result_ok);
7142         return DecodeError_clone(&*owner->contents.err);
7143 }
7144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7145         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
7146         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7147         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
7148         int64_t ret_ref = tag_ptr(ret_copy, true);
7149         return ret_ref;
7150 }
7151
7152 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7153 CHECK(owner->result_ok);
7154         return ChannelShutdownState_clone(&*owner->contents.result);
7155 }
7156 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7157         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7158         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
7159         return ret_conv;
7160 }
7161
7162 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
7163 CHECK(!owner->result_ok);
7164         return DecodeError_clone(&*owner->contents.err);
7165 }
7166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7167         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
7168         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7169         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
7170         int64_t ret_ref = tag_ptr(ret_copy, true);
7171         return ret_ref;
7172 }
7173
7174 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
7175         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
7176         for (size_t i = 0; i < ret.datalen; i++) {
7177                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
7178         }
7179         return ret;
7180 }
7181 typedef struct LDKWatch_JCalls {
7182         atomic_size_t refcnt;
7183         JavaVM *vm;
7184         jweak o;
7185         jmethodID watch_channel_meth;
7186         jmethodID update_channel_meth;
7187         jmethodID release_pending_monitor_events_meth;
7188 } LDKWatch_JCalls;
7189 static void LDKWatch_JCalls_free(void* this_arg) {
7190         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7191         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7192                 JNIEnv *env;
7193                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7194                 if (get_jenv_res == JNI_EDETACHED) {
7195                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7196                 } else {
7197                         DO_ASSERT(get_jenv_res == JNI_OK);
7198                 }
7199                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7200                 if (get_jenv_res == JNI_EDETACHED) {
7201                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7202                 }
7203                 FREE(j_calls);
7204         }
7205 }
7206 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
7207         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7208         JNIEnv *env;
7209         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7210         if (get_jenv_res == JNI_EDETACHED) {
7211                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7212         } else {
7213                 DO_ASSERT(get_jenv_res == JNI_OK);
7214         }
7215         LDKOutPoint funding_txo_var = funding_txo;
7216         int64_t funding_txo_ref = 0;
7217         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7218         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7219         LDKChannelMonitor monitor_var = monitor;
7220         int64_t monitor_ref = 0;
7221         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
7222         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
7223         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7224         CHECK(obj != NULL);
7225         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
7226         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7227                 (*env)->ExceptionDescribe(env);
7228                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
7229         }
7230         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7231         if (get_jenv_res == JNI_EDETACHED) {
7232                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7233         }
7234         return ret_conv;
7235 }
7236 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
7237         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7238         JNIEnv *env;
7239         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7240         if (get_jenv_res == JNI_EDETACHED) {
7241                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7242         } else {
7243                 DO_ASSERT(get_jenv_res == JNI_OK);
7244         }
7245         LDKOutPoint funding_txo_var = funding_txo;
7246         int64_t funding_txo_ref = 0;
7247         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
7248         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
7249         LDKChannelMonitorUpdate update_var = *update;
7250         int64_t update_ref = 0;
7251         update_var = ChannelMonitorUpdate_clone(&update_var);
7252         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
7253         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
7254         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7255         CHECK(obj != NULL);
7256         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
7257         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7258                 (*env)->ExceptionDescribe(env);
7259                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
7260         }
7261         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
7262         if (get_jenv_res == JNI_EDETACHED) {
7263                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7264         }
7265         return ret_conv;
7266 }
7267 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
7268         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
7269         JNIEnv *env;
7270         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7271         if (get_jenv_res == JNI_EDETACHED) {
7272                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7273         } else {
7274                 DO_ASSERT(get_jenv_res == JNI_OK);
7275         }
7276         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7277         CHECK(obj != NULL);
7278         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
7279         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7280                 (*env)->ExceptionDescribe(env);
7281                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
7282         }
7283         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
7284         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7285         if (ret_constr.datalen > 0)
7286                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
7287         else
7288                 ret_constr.data = NULL;
7289         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7290         for (size_t x = 0; x < ret_constr.datalen; x++) {
7291                 int64_t ret_conv_49 = ret_vals[x];
7292                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
7293                 CHECK_ACCESS(ret_conv_49_ptr);
7294                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
7295                 FREE(untag_ptr(ret_conv_49));
7296                 ret_constr.data[x] = ret_conv_49_conv;
7297         }
7298         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7299         if (get_jenv_res == JNI_EDETACHED) {
7300                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7301         }
7302         return ret_constr;
7303 }
7304 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
7305         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
7306         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7307 }
7308 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
7309         jclass c = (*env)->GetObjectClass(env, o);
7310         CHECK(c != NULL);
7311         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
7312         atomic_init(&calls->refcnt, 1);
7313         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7314         calls->o = (*env)->NewWeakGlobalRef(env, o);
7315         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7316         CHECK(calls->watch_channel_meth != NULL);
7317         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
7318         CHECK(calls->update_channel_meth != NULL);
7319         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
7320         CHECK(calls->release_pending_monitor_events_meth != NULL);
7321
7322         LDKWatch ret = {
7323                 .this_arg = (void*) calls,
7324                 .watch_channel = watch_channel_LDKWatch_jcall,
7325                 .update_channel = update_channel_LDKWatch_jcall,
7326                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
7327                 .free = LDKWatch_JCalls_free,
7328         };
7329         return ret;
7330 }
7331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
7332         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
7333         *res_ptr = LDKWatch_init(env, clz, o);
7334         return tag_ptr(res_ptr, true);
7335 }
7336 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) {
7337         void* this_arg_ptr = untag_ptr(this_arg);
7338         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7339         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7340         LDKOutPoint funding_txo_conv;
7341         funding_txo_conv.inner = untag_ptr(funding_txo);
7342         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7343         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7344         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7345         LDKChannelMonitor monitor_conv;
7346         monitor_conv.inner = untag_ptr(monitor);
7347         monitor_conv.is_owned = ptr_is_owned(monitor);
7348         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
7349         monitor_conv = ChannelMonitor_clone(&monitor_conv);
7350         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
7351         return ret_conv;
7352 }
7353
7354 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) {
7355         void* this_arg_ptr = untag_ptr(this_arg);
7356         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7357         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7358         LDKOutPoint funding_txo_conv;
7359         funding_txo_conv.inner = untag_ptr(funding_txo);
7360         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
7361         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
7362         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7363         LDKChannelMonitorUpdate update_conv;
7364         update_conv.inner = untag_ptr(update);
7365         update_conv.is_owned = ptr_is_owned(update);
7366         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
7367         update_conv.is_owned = false;
7368         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
7369         return ret_conv;
7370 }
7371
7372 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7373         void* this_arg_ptr = untag_ptr(this_arg);
7374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7375         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
7376         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
7377         int64_tArray ret_arr = NULL;
7378         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7379         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7380         for (size_t x = 0; x < ret_var.datalen; x++) {
7381                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
7382                 *ret_conv_49_conv = ret_var.data[x];
7383                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
7384         }
7385         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7386         FREE(ret_var.data);
7387         return ret_arr;
7388 }
7389
7390 typedef struct LDKBroadcasterInterface_JCalls {
7391         atomic_size_t refcnt;
7392         JavaVM *vm;
7393         jweak o;
7394         jmethodID broadcast_transactions_meth;
7395 } LDKBroadcasterInterface_JCalls;
7396 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
7397         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7398         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7399                 JNIEnv *env;
7400                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7401                 if (get_jenv_res == JNI_EDETACHED) {
7402                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7403                 } else {
7404                         DO_ASSERT(get_jenv_res == JNI_OK);
7405                 }
7406                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7407                 if (get_jenv_res == JNI_EDETACHED) {
7408                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7409                 }
7410                 FREE(j_calls);
7411         }
7412 }
7413 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
7414         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
7415         JNIEnv *env;
7416         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7417         if (get_jenv_res == JNI_EDETACHED) {
7418                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7419         } else {
7420                 DO_ASSERT(get_jenv_res == JNI_OK);
7421         }
7422         LDKCVec_TransactionZ txs_var = txs;
7423         jobjectArray txs_arr = NULL;
7424         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
7425         ;
7426         for (size_t i = 0; i < txs_var.datalen; i++) {
7427                 LDKTransaction txs_conv_8_var = txs_var.data[i];
7428                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
7429                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
7430                 Transaction_free(txs_conv_8_var);
7431                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
7432         }
7433         
7434         FREE(txs_var.data);
7435         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7436         CHECK(obj != NULL);
7437         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
7438         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7439                 (*env)->ExceptionDescribe(env);
7440                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
7441         }
7442         if (get_jenv_res == JNI_EDETACHED) {
7443                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7444         }
7445 }
7446 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
7447         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
7448         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7449 }
7450 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
7451         jclass c = (*env)->GetObjectClass(env, o);
7452         CHECK(c != NULL);
7453         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
7454         atomic_init(&calls->refcnt, 1);
7455         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7456         calls->o = (*env)->NewWeakGlobalRef(env, o);
7457         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
7458         CHECK(calls->broadcast_transactions_meth != NULL);
7459
7460         LDKBroadcasterInterface ret = {
7461                 .this_arg = (void*) calls,
7462                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
7463                 .free = LDKBroadcasterInterface_JCalls_free,
7464         };
7465         return ret;
7466 }
7467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
7468         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
7469         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
7470         return tag_ptr(res_ptr, true);
7471 }
7472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
7473         void* this_arg_ptr = untag_ptr(this_arg);
7474         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7475         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
7476         LDKCVec_TransactionZ txs_constr;
7477         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
7478         if (txs_constr.datalen > 0)
7479                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
7480         else
7481                 txs_constr.data = NULL;
7482         for (size_t i = 0; i < txs_constr.datalen; i++) {
7483                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
7484                 LDKTransaction txs_conv_8_ref;
7485                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
7486                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
7487                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
7488                 txs_conv_8_ref.data_is_owned = true;
7489                 txs_constr.data[i] = txs_conv_8_ref;
7490         }
7491         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
7492 }
7493
7494 typedef struct LDKEntropySource_JCalls {
7495         atomic_size_t refcnt;
7496         JavaVM *vm;
7497         jweak o;
7498         jmethodID get_secure_random_bytes_meth;
7499 } LDKEntropySource_JCalls;
7500 static void LDKEntropySource_JCalls_free(void* this_arg) {
7501         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7502         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7503                 JNIEnv *env;
7504                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7505                 if (get_jenv_res == JNI_EDETACHED) {
7506                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7507                 } else {
7508                         DO_ASSERT(get_jenv_res == JNI_OK);
7509                 }
7510                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7511                 if (get_jenv_res == JNI_EDETACHED) {
7512                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7513                 }
7514                 FREE(j_calls);
7515         }
7516 }
7517 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
7518         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
7519         JNIEnv *env;
7520         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7521         if (get_jenv_res == JNI_EDETACHED) {
7522                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7523         } else {
7524                 DO_ASSERT(get_jenv_res == JNI_OK);
7525         }
7526         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7527         CHECK(obj != NULL);
7528         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
7529         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7530                 (*env)->ExceptionDescribe(env);
7531                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
7532         }
7533         LDKThirtyTwoBytes ret_ref;
7534         CHECK((*env)->GetArrayLength(env, ret) == 32);
7535         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7536         if (get_jenv_res == JNI_EDETACHED) {
7537                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7538         }
7539         return ret_ref;
7540 }
7541 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
7542         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
7543         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7544 }
7545 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
7546         jclass c = (*env)->GetObjectClass(env, o);
7547         CHECK(c != NULL);
7548         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
7549         atomic_init(&calls->refcnt, 1);
7550         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7551         calls->o = (*env)->NewWeakGlobalRef(env, o);
7552         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
7553         CHECK(calls->get_secure_random_bytes_meth != NULL);
7554
7555         LDKEntropySource ret = {
7556                 .this_arg = (void*) calls,
7557                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
7558                 .free = LDKEntropySource_JCalls_free,
7559         };
7560         return ret;
7561 }
7562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
7563         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
7564         *res_ptr = LDKEntropySource_init(env, clz, o);
7565         return tag_ptr(res_ptr, true);
7566 }
7567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
7568         void* this_arg_ptr = untag_ptr(this_arg);
7569         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7570         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
7571         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7572         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
7573         return ret_arr;
7574 }
7575
7576 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
7577 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
7578 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
7579 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
7580 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
7581 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
7582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
7583         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
7584                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
7585         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
7586         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
7587         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
7588         LDKUnsignedGossipMessage_ChannelUpdate_class =
7589                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
7590         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
7591         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
7592         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
7593         LDKUnsignedGossipMessage_NodeAnnouncement_class =
7594                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
7595         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
7596         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
7597         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
7598 }
7599 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7600         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
7601         switch(obj->tag) {
7602                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
7603                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
7604                         int64_t channel_announcement_ref = 0;
7605                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
7606                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
7607                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
7608                 }
7609                 case LDKUnsignedGossipMessage_ChannelUpdate: {
7610                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
7611                         int64_t channel_update_ref = 0;
7612                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
7613                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
7614                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
7615                 }
7616                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
7617                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
7618                         int64_t node_announcement_ref = 0;
7619                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
7620                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
7621                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
7622                 }
7623                 default: abort();
7624         }
7625 }
7626 typedef struct LDKNodeSigner_JCalls {
7627         atomic_size_t refcnt;
7628         JavaVM *vm;
7629         jweak o;
7630         jmethodID get_inbound_payment_key_material_meth;
7631         jmethodID get_node_id_meth;
7632         jmethodID ecdh_meth;
7633         jmethodID sign_invoice_meth;
7634         jmethodID sign_gossip_message_meth;
7635 } LDKNodeSigner_JCalls;
7636 static void LDKNodeSigner_JCalls_free(void* this_arg) {
7637         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7638         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7639                 JNIEnv *env;
7640                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7641                 if (get_jenv_res == JNI_EDETACHED) {
7642                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7643                 } else {
7644                         DO_ASSERT(get_jenv_res == JNI_OK);
7645                 }
7646                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7647                 if (get_jenv_res == JNI_EDETACHED) {
7648                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7649                 }
7650                 FREE(j_calls);
7651         }
7652 }
7653 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
7654         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7655         JNIEnv *env;
7656         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7657         if (get_jenv_res == JNI_EDETACHED) {
7658                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7659         } else {
7660                 DO_ASSERT(get_jenv_res == JNI_OK);
7661         }
7662         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7663         CHECK(obj != NULL);
7664         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
7665         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7666                 (*env)->ExceptionDescribe(env);
7667                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
7668         }
7669         LDKThirtyTwoBytes ret_ref;
7670         CHECK((*env)->GetArrayLength(env, ret) == 32);
7671         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7672         if (get_jenv_res == JNI_EDETACHED) {
7673                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7674         }
7675         return ret_ref;
7676 }
7677 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
7678         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7679         JNIEnv *env;
7680         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7681         if (get_jenv_res == JNI_EDETACHED) {
7682                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7683         } else {
7684                 DO_ASSERT(get_jenv_res == JNI_OK);
7685         }
7686         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7687         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7688         CHECK(obj != NULL);
7689         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
7690         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7691                 (*env)->ExceptionDescribe(env);
7692                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
7693         }
7694         void* ret_ptr = untag_ptr(ret);
7695         CHECK_ACCESS(ret_ptr);
7696         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
7697         FREE(untag_ptr(ret));
7698         if (get_jenv_res == JNI_EDETACHED) {
7699                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7700         }
7701         return ret_conv;
7702 }
7703 LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
7704         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7705         JNIEnv *env;
7706         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7707         if (get_jenv_res == JNI_EDETACHED) {
7708                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7709         } else {
7710                 DO_ASSERT(get_jenv_res == JNI_OK);
7711         }
7712         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7713         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
7714         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
7715         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
7716         *tweak_copy = tweak;
7717         int64_t tweak_ref = tag_ptr(tweak_copy, true);
7718         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7719         CHECK(obj != NULL);
7720         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
7721         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7722                 (*env)->ExceptionDescribe(env);
7723                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
7724         }
7725         void* ret_ptr = untag_ptr(ret);
7726         CHECK_ACCESS(ret_ptr);
7727         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
7728         FREE(untag_ptr(ret));
7729         if (get_jenv_res == JNI_EDETACHED) {
7730                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7731         }
7732         return ret_conv;
7733 }
7734 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
7735         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7736         JNIEnv *env;
7737         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7738         if (get_jenv_res == JNI_EDETACHED) {
7739                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7740         } else {
7741                 DO_ASSERT(get_jenv_res == JNI_OK);
7742         }
7743         LDKu8slice hrp_bytes_var = hrp_bytes;
7744         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
7745         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
7746         LDKCVec_U5Z invoice_data_var = invoice_data;
7747         jobjectArray invoice_data_arr = NULL;
7748         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
7749         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
7750         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
7751                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
7752                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
7753         }
7754         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
7755         FREE(invoice_data_var.data);
7756         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
7757         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7758         CHECK(obj != NULL);
7759         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
7760         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7761                 (*env)->ExceptionDescribe(env);
7762                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
7763         }
7764         void* ret_ptr = untag_ptr(ret);
7765         CHECK_ACCESS(ret_ptr);
7766         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
7767         FREE(untag_ptr(ret));
7768         if (get_jenv_res == JNI_EDETACHED) {
7769                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7770         }
7771         return ret_conv;
7772 }
7773 LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
7774         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
7775         JNIEnv *env;
7776         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7777         if (get_jenv_res == JNI_EDETACHED) {
7778                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7779         } else {
7780                 DO_ASSERT(get_jenv_res == JNI_OK);
7781         }
7782         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
7783         *msg_copy = msg;
7784         int64_t msg_ref = tag_ptr(msg_copy, true);
7785         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7786         CHECK(obj != NULL);
7787         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
7788         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7789                 (*env)->ExceptionDescribe(env);
7790                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
7791         }
7792         void* ret_ptr = untag_ptr(ret);
7793         CHECK_ACCESS(ret_ptr);
7794         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
7795         FREE(untag_ptr(ret));
7796         if (get_jenv_res == JNI_EDETACHED) {
7797                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7798         }
7799         return ret_conv;
7800 }
7801 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
7802         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
7803         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7804 }
7805 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
7806         jclass c = (*env)->GetObjectClass(env, o);
7807         CHECK(c != NULL);
7808         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
7809         atomic_init(&calls->refcnt, 1);
7810         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7811         calls->o = (*env)->NewWeakGlobalRef(env, o);
7812         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
7813         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
7814         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
7815         CHECK(calls->get_node_id_meth != NULL);
7816         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
7817         CHECK(calls->ecdh_meth != NULL);
7818         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
7819         CHECK(calls->sign_invoice_meth != NULL);
7820         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
7821         CHECK(calls->sign_gossip_message_meth != NULL);
7822
7823         LDKNodeSigner ret = {
7824                 .this_arg = (void*) calls,
7825                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
7826                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
7827                 .ecdh = ecdh_LDKNodeSigner_jcall,
7828                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
7829                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
7830                 .free = LDKNodeSigner_JCalls_free,
7831         };
7832         return ret;
7833 }
7834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
7835         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
7836         *res_ptr = LDKNodeSigner_init(env, clz, o);
7837         return tag_ptr(res_ptr, true);
7838 }
7839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
7840         void* this_arg_ptr = untag_ptr(this_arg);
7841         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7842         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7843         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7844         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
7845         return ret_arr;
7846 }
7847
7848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
7849         void* this_arg_ptr = untag_ptr(this_arg);
7850         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7851         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7852         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7853         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
7854         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
7855         return tag_ptr(ret_conv, true);
7856 }
7857
7858 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) {
7859         void* this_arg_ptr = untag_ptr(this_arg);
7860         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7861         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7862         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7863         LDKPublicKey other_key_ref;
7864         CHECK((*env)->GetArrayLength(env, other_key) == 33);
7865         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
7866         void* tweak_ptr = untag_ptr(tweak);
7867         CHECK_ACCESS(tweak_ptr);
7868         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
7869         tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak));
7870         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
7871         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
7872         return tag_ptr(ret_conv, true);
7873 }
7874
7875 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) {
7876         void* this_arg_ptr = untag_ptr(this_arg);
7877         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7878         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7879         LDKu8slice hrp_bytes_ref;
7880         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
7881         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
7882         LDKCVec_U5Z invoice_data_constr;
7883         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
7884         if (invoice_data_constr.datalen > 0)
7885                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
7886         else
7887                 invoice_data_constr.data = NULL;
7888         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
7889         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
7890                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
7891                 
7892                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
7893         }
7894         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
7895         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
7896         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
7897         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
7898         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
7899         return tag_ptr(ret_conv, true);
7900 }
7901
7902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
7903         void* this_arg_ptr = untag_ptr(this_arg);
7904         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7905         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
7906         void* msg_ptr = untag_ptr(msg);
7907         CHECK_ACCESS(msg_ptr);
7908         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
7909         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
7910         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7911         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
7912         return tag_ptr(ret_conv, true);
7913 }
7914
7915 typedef struct LDKSignerProvider_JCalls {
7916         atomic_size_t refcnt;
7917         JavaVM *vm;
7918         jweak o;
7919         jmethodID generate_channel_keys_id_meth;
7920         jmethodID derive_channel_signer_meth;
7921         jmethodID read_chan_signer_meth;
7922         jmethodID get_destination_script_meth;
7923         jmethodID get_shutdown_scriptpubkey_meth;
7924 } LDKSignerProvider_JCalls;
7925 static void LDKSignerProvider_JCalls_free(void* this_arg) {
7926         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7927         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7928                 JNIEnv *env;
7929                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7930                 if (get_jenv_res == JNI_EDETACHED) {
7931                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7932                 } else {
7933                         DO_ASSERT(get_jenv_res == JNI_OK);
7934                 }
7935                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7936                 if (get_jenv_res == JNI_EDETACHED) {
7937                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7938                 }
7939                 FREE(j_calls);
7940         }
7941 }
7942 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
7943         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7944         JNIEnv *env;
7945         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7946         if (get_jenv_res == JNI_EDETACHED) {
7947                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7948         } else {
7949                 DO_ASSERT(get_jenv_res == JNI_OK);
7950         }
7951         jboolean inbound_conv = inbound;
7952         int64_t channel_value_satoshis_conv = channel_value_satoshis;
7953         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
7954         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
7955         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7956         CHECK(obj != NULL);
7957         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
7958         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7959                 (*env)->ExceptionDescribe(env);
7960                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
7961         }
7962         LDKThirtyTwoBytes ret_ref;
7963         CHECK((*env)->GetArrayLength(env, ret) == 32);
7964         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
7965         if (get_jenv_res == JNI_EDETACHED) {
7966                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7967         }
7968         return ret_ref;
7969 }
7970 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
7971         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
7972         JNIEnv *env;
7973         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7974         if (get_jenv_res == JNI_EDETACHED) {
7975                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7976         } else {
7977                 DO_ASSERT(get_jenv_res == JNI_OK);
7978         }
7979         int64_t channel_value_satoshis_conv = channel_value_satoshis;
7980         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
7981         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
7982         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7983         CHECK(obj != NULL);
7984         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
7985         if (UNLIKELY((*env)->ExceptionCheck(env))) {
7986                 (*env)->ExceptionDescribe(env);
7987                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
7988         }
7989         void* ret_ptr = untag_ptr(ret);
7990         CHECK_ACCESS(ret_ptr);
7991         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
7992         FREE(untag_ptr(ret));
7993         if (get_jenv_res == JNI_EDETACHED) {
7994                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7995         }
7996         return ret_conv;
7997 }
7998 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
7999         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8000         JNIEnv *env;
8001         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8002         if (get_jenv_res == JNI_EDETACHED) {
8003                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8004         } else {
8005                 DO_ASSERT(get_jenv_res == JNI_OK);
8006         }
8007         LDKu8slice reader_var = reader;
8008         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
8009         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
8010         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8011         CHECK(obj != NULL);
8012         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
8013         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8014                 (*env)->ExceptionDescribe(env);
8015                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
8016         }
8017         void* ret_ptr = untag_ptr(ret);
8018         CHECK_ACCESS(ret_ptr);
8019         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
8020         FREE(untag_ptr(ret));
8021         if (get_jenv_res == JNI_EDETACHED) {
8022                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8023         }
8024         return ret_conv;
8025 }
8026 LDKCResult_ScriptNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
8027         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8028         JNIEnv *env;
8029         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8030         if (get_jenv_res == JNI_EDETACHED) {
8031                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8032         } else {
8033                 DO_ASSERT(get_jenv_res == JNI_OK);
8034         }
8035         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8036         CHECK(obj != NULL);
8037         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
8038         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8039                 (*env)->ExceptionDescribe(env);
8040                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
8041         }
8042         void* ret_ptr = untag_ptr(ret);
8043         CHECK_ACCESS(ret_ptr);
8044         LDKCResult_ScriptNoneZ ret_conv = *(LDKCResult_ScriptNoneZ*)(ret_ptr);
8045         FREE(untag_ptr(ret));
8046         if (get_jenv_res == JNI_EDETACHED) {
8047                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8048         }
8049         return ret_conv;
8050 }
8051 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
8052         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
8053         JNIEnv *env;
8054         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8055         if (get_jenv_res == JNI_EDETACHED) {
8056                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8057         } else {
8058                 DO_ASSERT(get_jenv_res == JNI_OK);
8059         }
8060         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8061         CHECK(obj != NULL);
8062         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
8063         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8064                 (*env)->ExceptionDescribe(env);
8065                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
8066         }
8067         void* ret_ptr = untag_ptr(ret);
8068         CHECK_ACCESS(ret_ptr);
8069         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
8070         FREE(untag_ptr(ret));
8071         if (get_jenv_res == JNI_EDETACHED) {
8072                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8073         }
8074         return ret_conv;
8075 }
8076 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
8077         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
8078         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8079 }
8080 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
8081         jclass c = (*env)->GetObjectClass(env, o);
8082         CHECK(c != NULL);
8083         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
8084         atomic_init(&calls->refcnt, 1);
8085         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8086         calls->o = (*env)->NewWeakGlobalRef(env, o);
8087         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
8088         CHECK(calls->generate_channel_keys_id_meth != NULL);
8089         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
8090         CHECK(calls->derive_channel_signer_meth != NULL);
8091         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
8092         CHECK(calls->read_chan_signer_meth != NULL);
8093         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
8094         CHECK(calls->get_destination_script_meth != NULL);
8095         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
8096         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
8097
8098         LDKSignerProvider ret = {
8099                 .this_arg = (void*) calls,
8100                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
8101                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
8102                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
8103                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
8104                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
8105                 .free = LDKSignerProvider_JCalls_free,
8106         };
8107         return ret;
8108 }
8109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
8110         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
8111         *res_ptr = LDKSignerProvider_init(env, clz, o);
8112         return tag_ptr(res_ptr, true);
8113 }
8114 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) {
8115         void* this_arg_ptr = untag_ptr(this_arg);
8116         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8117         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8118         LDKU128 user_channel_id_ref;
8119         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
8120         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
8121         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8122         (*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);
8123         return ret_arr;
8124 }
8125
8126 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) {
8127         void* this_arg_ptr = untag_ptr(this_arg);
8128         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8129         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8130         LDKThirtyTwoBytes channel_keys_id_ref;
8131         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
8132         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
8133         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
8134         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
8135         return tag_ptr(ret_ret, true);
8136 }
8137
8138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
8139         void* this_arg_ptr = untag_ptr(this_arg);
8140         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8141         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8142         LDKu8slice reader_ref;
8143         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
8144         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
8145         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
8146         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
8147         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
8148         return tag_ptr(ret_conv, true);
8149 }
8150
8151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
8152         void* this_arg_ptr = untag_ptr(this_arg);
8153         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8154         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8155         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
8156         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
8157         return tag_ptr(ret_conv, true);
8158 }
8159
8160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
8161         void* this_arg_ptr = untag_ptr(this_arg);
8162         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8163         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
8164         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
8165         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
8166         return tag_ptr(ret_conv, true);
8167 }
8168
8169 typedef struct LDKFeeEstimator_JCalls {
8170         atomic_size_t refcnt;
8171         JavaVM *vm;
8172         jweak o;
8173         jmethodID get_est_sat_per_1000_weight_meth;
8174 } LDKFeeEstimator_JCalls;
8175 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
8176         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8177         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8178                 JNIEnv *env;
8179                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8180                 if (get_jenv_res == JNI_EDETACHED) {
8181                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8182                 } else {
8183                         DO_ASSERT(get_jenv_res == JNI_OK);
8184                 }
8185                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8186                 if (get_jenv_res == JNI_EDETACHED) {
8187                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8188                 }
8189                 FREE(j_calls);
8190         }
8191 }
8192 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
8193         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
8194         JNIEnv *env;
8195         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8196         if (get_jenv_res == JNI_EDETACHED) {
8197                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8198         } else {
8199                 DO_ASSERT(get_jenv_res == JNI_OK);
8200         }
8201         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
8202         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8203         CHECK(obj != NULL);
8204         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
8205         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8206                 (*env)->ExceptionDescribe(env);
8207                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
8208         }
8209         if (get_jenv_res == JNI_EDETACHED) {
8210                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8211         }
8212         return ret;
8213 }
8214 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
8215         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
8216         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8217 }
8218 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
8219         jclass c = (*env)->GetObjectClass(env, o);
8220         CHECK(c != NULL);
8221         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
8222         atomic_init(&calls->refcnt, 1);
8223         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8224         calls->o = (*env)->NewWeakGlobalRef(env, o);
8225         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
8226         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
8227
8228         LDKFeeEstimator ret = {
8229                 .this_arg = (void*) calls,
8230                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
8231                 .free = LDKFeeEstimator_JCalls_free,
8232         };
8233         return ret;
8234 }
8235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
8236         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
8237         *res_ptr = LDKFeeEstimator_init(env, clz, o);
8238         return tag_ptr(res_ptr, true);
8239 }
8240 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) {
8241         void* this_arg_ptr = untag_ptr(this_arg);
8242         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8243         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
8244         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
8245         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
8246         return ret_conv;
8247 }
8248
8249 typedef struct LDKRouter_JCalls {
8250         atomic_size_t refcnt;
8251         JavaVM *vm;
8252         jweak o;
8253         jmethodID find_route_meth;
8254         jmethodID find_route_with_id_meth;
8255 } LDKRouter_JCalls;
8256 static void LDKRouter_JCalls_free(void* this_arg) {
8257         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8258         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8259                 JNIEnv *env;
8260                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8261                 if (get_jenv_res == JNI_EDETACHED) {
8262                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8263                 } else {
8264                         DO_ASSERT(get_jenv_res == JNI_OK);
8265                 }
8266                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8267                 if (get_jenv_res == JNI_EDETACHED) {
8268                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8269                 }
8270                 FREE(j_calls);
8271         }
8272 }
8273 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
8274         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8275         JNIEnv *env;
8276         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8277         if (get_jenv_res == JNI_EDETACHED) {
8278                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8279         } else {
8280                 DO_ASSERT(get_jenv_res == JNI_OK);
8281         }
8282         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8283         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8284         LDKRouteParameters route_params_var = *route_params;
8285         int64_t route_params_ref = 0;
8286         route_params_var = RouteParameters_clone(&route_params_var);
8287         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8288         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8289         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8290         int64_tArray first_hops_arr = NULL;
8291         if (first_hops != NULL) {
8292                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8293                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8294                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8295                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8296                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8297                         int64_t first_hops_conv_16_ref = 0;
8298                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8299                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8300                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8301                 }
8302                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8303         }
8304         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8305         int64_t inflight_htlcs_ref = 0;
8306         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8307         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8308         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8309         CHECK(obj != NULL);
8310         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
8311         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8312                 (*env)->ExceptionDescribe(env);
8313                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
8314         }
8315         void* ret_ptr = untag_ptr(ret);
8316         CHECK_ACCESS(ret_ptr);
8317         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8318         FREE(untag_ptr(ret));
8319         if (get_jenv_res == JNI_EDETACHED) {
8320                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8321         }
8322         return ret_conv;
8323 }
8324 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) {
8325         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
8326         JNIEnv *env;
8327         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8328         if (get_jenv_res == JNI_EDETACHED) {
8329                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8330         } else {
8331                 DO_ASSERT(get_jenv_res == JNI_OK);
8332         }
8333         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
8334         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
8335         LDKRouteParameters route_params_var = *route_params;
8336         int64_t route_params_ref = 0;
8337         route_params_var = RouteParameters_clone(&route_params_var);
8338         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
8339         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
8340         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
8341         int64_tArray first_hops_arr = NULL;
8342         if (first_hops != NULL) {
8343                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
8344                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
8345                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
8346                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
8347                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
8348                         int64_t first_hops_conv_16_ref = 0;
8349                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
8350                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
8351                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
8352                 }
8353                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
8354         }
8355         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
8356         int64_t inflight_htlcs_ref = 0;
8357         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
8358         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
8359         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
8360         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
8361         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
8362         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
8363         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8364         CHECK(obj != NULL);
8365         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);
8366         if (UNLIKELY((*env)->ExceptionCheck(env))) {
8367                 (*env)->ExceptionDescribe(env);
8368                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
8369         }
8370         void* ret_ptr = untag_ptr(ret);
8371         CHECK_ACCESS(ret_ptr);
8372         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
8373         FREE(untag_ptr(ret));
8374         if (get_jenv_res == JNI_EDETACHED) {
8375                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8376         }
8377         return ret_conv;
8378 }
8379 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
8380         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
8381         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8382 }
8383 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
8384         jclass c = (*env)->GetObjectClass(env, o);
8385         CHECK(c != NULL);
8386         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
8387         atomic_init(&calls->refcnt, 1);
8388         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8389         calls->o = (*env)->NewWeakGlobalRef(env, o);
8390         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
8391         CHECK(calls->find_route_meth != NULL);
8392         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
8393         CHECK(calls->find_route_with_id_meth != NULL);
8394
8395         LDKRouter ret = {
8396                 .this_arg = (void*) calls,
8397                 .find_route = find_route_LDKRouter_jcall,
8398                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
8399                 .free = LDKRouter_JCalls_free,
8400         };
8401         return ret;
8402 }
8403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
8404         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
8405         *res_ptr = LDKRouter_init(env, clz, o);
8406         return tag_ptr(res_ptr, true);
8407 }
8408 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) {
8409         void* this_arg_ptr = untag_ptr(this_arg);
8410         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8411         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8412         LDKPublicKey payer_ref;
8413         CHECK((*env)->GetArrayLength(env, payer) == 33);
8414         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8415         LDKRouteParameters route_params_conv;
8416         route_params_conv.inner = untag_ptr(route_params);
8417         route_params_conv.is_owned = ptr_is_owned(route_params);
8418         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8419         route_params_conv.is_owned = false;
8420         LDKCVec_ChannelDetailsZ first_hops_constr;
8421         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8422         if (first_hops != NULL) {
8423                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8424                 if (first_hops_constr.datalen > 0)
8425                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8426                 else
8427                         first_hops_constr.data = NULL;
8428                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8429                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8430                         int64_t first_hops_conv_16 = first_hops_vals[q];
8431                         LDKChannelDetails first_hops_conv_16_conv;
8432                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8433                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8434                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8435                         first_hops_conv_16_conv.is_owned = false;
8436                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8437                 }
8438                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8439                 first_hops_ptr = &first_hops_constr;
8440         }
8441         LDKInFlightHtlcs inflight_htlcs_conv;
8442         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8443         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8444         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8445         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
8446         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8447         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
8448         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8449         return tag_ptr(ret_conv, true);
8450 }
8451
8452 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) {
8453         void* this_arg_ptr = untag_ptr(this_arg);
8454         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8455         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
8456         LDKPublicKey payer_ref;
8457         CHECK((*env)->GetArrayLength(env, payer) == 33);
8458         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
8459         LDKRouteParameters route_params_conv;
8460         route_params_conv.inner = untag_ptr(route_params);
8461         route_params_conv.is_owned = ptr_is_owned(route_params);
8462         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
8463         route_params_conv.is_owned = false;
8464         LDKCVec_ChannelDetailsZ first_hops_constr;
8465         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
8466         if (first_hops != NULL) {
8467                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
8468                 if (first_hops_constr.datalen > 0)
8469                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
8470                 else
8471                         first_hops_constr.data = NULL;
8472                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
8473                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
8474                         int64_t first_hops_conv_16 = first_hops_vals[q];
8475                         LDKChannelDetails first_hops_conv_16_conv;
8476                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
8477                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
8478                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
8479                         first_hops_conv_16_conv.is_owned = false;
8480                         first_hops_constr.data[q] = first_hops_conv_16_conv;
8481                 }
8482                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
8483                 first_hops_ptr = &first_hops_constr;
8484         }
8485         LDKInFlightHtlcs inflight_htlcs_conv;
8486         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
8487         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
8488         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
8489         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
8490         LDKThirtyTwoBytes _payment_hash_ref;
8491         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
8492         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
8493         LDKThirtyTwoBytes _payment_id_ref;
8494         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
8495         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
8496         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8497         *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);
8498         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
8499         return tag_ptr(ret_conv, true);
8500 }
8501
8502 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
8503         return ThirtyTwoBytes_clone(&owner->a);
8504 }
8505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8506         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
8507         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8508         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
8509         return ret_arr;
8510 }
8511
8512 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
8513         LDKChannelManager ret = owner->b;
8514         ret.is_owned = false;
8515         return ret;
8516 }
8517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8518         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
8519         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
8520         int64_t ret_ref = 0;
8521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8523         return ret_ref;
8524 }
8525
8526 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8527 CHECK(owner->result_ok);
8528         return &*owner->contents.result;
8529 }
8530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8531         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8532         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
8533         return ret_ret;
8534 }
8535
8536 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
8537 CHECK(!owner->result_ok);
8538         return DecodeError_clone(&*owner->contents.err);
8539 }
8540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8541         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
8542         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8543         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
8544         int64_t ret_ref = tag_ptr(ret_copy, true);
8545         return ret_ref;
8546 }
8547
8548 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
8549 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
8550 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
8551 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
8552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
8553         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
8554                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
8555         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
8556         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
8557         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
8558         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
8559                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
8560         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
8561         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
8562         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
8563 }
8564 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8565         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
8566         switch(obj->tag) {
8567                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
8568                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
8569                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
8570                 }
8571                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
8572                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
8573                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
8574                 }
8575                 default: abort();
8576         }
8577 }
8578 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8579 CHECK(owner->result_ok);
8580         return MaxDustHTLCExposure_clone(&*owner->contents.result);
8581 }
8582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8583         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
8584         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
8585         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
8586         int64_t ret_ref = tag_ptr(ret_copy, true);
8587         return ret_ref;
8588 }
8589
8590 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
8591 CHECK(!owner->result_ok);
8592         return DecodeError_clone(&*owner->contents.err);
8593 }
8594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8595         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
8596         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8597         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
8598         int64_t ret_ref = tag_ptr(ret_copy, true);
8599         return ret_ref;
8600 }
8601
8602 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8603         LDKChannelConfig ret = *owner->contents.result;
8604         ret.is_owned = false;
8605         return ret;
8606 }
8607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8608         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8609         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
8610         int64_t ret_ref = 0;
8611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8613         return ret_ref;
8614 }
8615
8616 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
8617 CHECK(!owner->result_ok);
8618         return DecodeError_clone(&*owner->contents.err);
8619 }
8620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8621         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
8622         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8623         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
8624         int64_t ret_ref = tag_ptr(ret_copy, true);
8625         return ret_ref;
8626 }
8627
8628 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
8629 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
8630 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
8631 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
8632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
8633         LDKCOption_MaxDustHTLCExposureZ_Some_class =
8634                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
8635         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
8636         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
8637         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
8638         LDKCOption_MaxDustHTLCExposureZ_None_class =
8639                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
8640         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
8641         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
8642         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
8643 }
8644 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8645         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
8646         switch(obj->tag) {
8647                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
8648                         int64_t some_ref = tag_ptr(&obj->some, false);
8649                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
8650                 }
8651                 case LDKCOption_MaxDustHTLCExposureZ_None: {
8652                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
8653                 }
8654                 default: abort();
8655         }
8656 }
8657 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
8658 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
8659 static jclass LDKCOption_APIErrorZ_None_class = NULL;
8660 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
8661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
8662         LDKCOption_APIErrorZ_Some_class =
8663                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
8664         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
8665         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
8666         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
8667         LDKCOption_APIErrorZ_None_class =
8668                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
8669         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
8670         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
8671         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
8672 }
8673 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8674         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
8675         switch(obj->tag) {
8676                 case LDKCOption_APIErrorZ_Some: {
8677                         int64_t some_ref = tag_ptr(&obj->some, false);
8678                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
8679                 }
8680                 case LDKCOption_APIErrorZ_None: {
8681                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
8682                 }
8683                 default: abort();
8684         }
8685 }
8686 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8687 CHECK(owner->result_ok);
8688         return COption_APIErrorZ_clone(&*owner->contents.result);
8689 }
8690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8691         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8692         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
8693         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
8694         int64_t ret_ref = tag_ptr(ret_copy, true);
8695         return ret_ref;
8696 }
8697
8698 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
8699 CHECK(!owner->result_ok);
8700         return DecodeError_clone(&*owner->contents.err);
8701 }
8702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8703         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
8704         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8705         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
8706         int64_t ret_ref = tag_ptr(ret_copy, true);
8707         return ret_ref;
8708 }
8709
8710 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8711         LDKChannelMonitorUpdate ret = *owner->contents.result;
8712         ret.is_owned = false;
8713         return ret;
8714 }
8715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8716         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8717         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
8718         int64_t ret_ref = 0;
8719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8721         return ret_ref;
8722 }
8723
8724 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
8725 CHECK(!owner->result_ok);
8726         return DecodeError_clone(&*owner->contents.err);
8727 }
8728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8729         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
8730         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8731         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
8732         int64_t ret_ref = tag_ptr(ret_copy, true);
8733         return ret_ref;
8734 }
8735
8736 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
8737 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
8738 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
8739 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
8740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
8741         LDKCOption_MonitorEventZ_Some_class =
8742                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
8743         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
8744         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
8745         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
8746         LDKCOption_MonitorEventZ_None_class =
8747                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
8748         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
8749         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
8750         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
8751 }
8752 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8753         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
8754         switch(obj->tag) {
8755                 case LDKCOption_MonitorEventZ_Some: {
8756                         int64_t some_ref = tag_ptr(&obj->some, false);
8757                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
8758                 }
8759                 case LDKCOption_MonitorEventZ_None: {
8760                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
8761                 }
8762                 default: abort();
8763         }
8764 }
8765 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8766 CHECK(owner->result_ok);
8767         return COption_MonitorEventZ_clone(&*owner->contents.result);
8768 }
8769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8770         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8771         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
8772         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
8773         int64_t ret_ref = tag_ptr(ret_copy, true);
8774         return ret_ref;
8775 }
8776
8777 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
8778 CHECK(!owner->result_ok);
8779         return DecodeError_clone(&*owner->contents.err);
8780 }
8781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8782         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
8783         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8784         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
8785         int64_t ret_ref = tag_ptr(ret_copy, true);
8786         return ret_ref;
8787 }
8788
8789 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8790         LDKHTLCUpdate ret = *owner->contents.result;
8791         ret.is_owned = false;
8792         return ret;
8793 }
8794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8795         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8796         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
8797         int64_t ret_ref = 0;
8798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8800         return ret_ref;
8801 }
8802
8803 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
8804 CHECK(!owner->result_ok);
8805         return DecodeError_clone(&*owner->contents.err);
8806 }
8807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8808         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
8809         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8810         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
8811         int64_t ret_ref = tag_ptr(ret_copy, true);
8812         return ret_ref;
8813 }
8814
8815 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8816         LDKOutPoint ret = owner->a;
8817         ret.is_owned = false;
8818         return ret;
8819 }
8820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8821         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
8822         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
8823         int64_t ret_ref = 0;
8824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8826         return ret_ref;
8827 }
8828
8829 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
8830         return CVec_u8Z_clone(&owner->b);
8831 }
8832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8833         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
8834         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
8835         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8836         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8837         CVec_u8Z_free(ret_var);
8838         return ret_arr;
8839 }
8840
8841 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8842         return owner->a;
8843 }
8844 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8845         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
8846         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
8847         return ret_conv;
8848 }
8849
8850 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
8851         return CVec_u8Z_clone(&owner->b);
8852 }
8853 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8854         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
8855         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
8856         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
8857         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
8858         CVec_u8Z_free(ret_var);
8859         return ret_arr;
8860 }
8861
8862 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
8863         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
8864         for (size_t i = 0; i < ret.datalen; i++) {
8865                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
8866         }
8867         return ret;
8868 }
8869 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8870         return ThirtyTwoBytes_clone(&owner->a);
8871 }
8872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8873         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
8874         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8875         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
8876         return ret_arr;
8877 }
8878
8879 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
8880         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
8881 }
8882 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8883         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
8884         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
8885         int64_tArray ret_arr = NULL;
8886         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8887         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8888         for (size_t v = 0; v < ret_var.datalen; v++) {
8889                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
8890                 *ret_conv_21_conv = ret_var.data[v];
8891                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
8892         }
8893         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8894         FREE(ret_var.data);
8895         return ret_arr;
8896 }
8897
8898 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
8899         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 };
8900         for (size_t i = 0; i < ret.datalen; i++) {
8901                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
8902         }
8903         return ret;
8904 }
8905 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8906         return owner->a;
8907 }
8908 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8909         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8910         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8911         return ret_conv;
8912 }
8913
8914 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8915         return TxOut_clone(&owner->b);
8916 }
8917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8918         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8919         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8920         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8921         return tag_ptr(ret_ref, true);
8922 }
8923
8924 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8925         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8926         for (size_t i = 0; i < ret.datalen; i++) {
8927                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8928         }
8929         return ret;
8930 }
8931 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8932         return ThirtyTwoBytes_clone(&owner->a);
8933 }
8934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8935         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8936         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8937         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
8938         return ret_arr;
8939 }
8940
8941 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8942         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8943 }
8944 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8945         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8946         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8947         int64_tArray ret_arr = NULL;
8948         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8949         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8950         for (size_t u = 0; u < ret_var.datalen; u++) {
8951                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8952                 *ret_conv_20_conv = ret_var.data[u];
8953                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
8954         }
8955         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8956         FREE(ret_var.data);
8957         return ret_arr;
8958 }
8959
8960 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
8961         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 };
8962         for (size_t i = 0; i < ret.datalen; i++) {
8963                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8964         }
8965         return ret;
8966 }
8967 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
8968 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
8969 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
8970 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
8971 static jclass LDKBalance_ContentiousClaimable_class = NULL;
8972 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
8973 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
8974 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
8975 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
8976 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
8977 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
8978 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
8979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
8980         LDKBalance_ClaimableOnChannelClose_class =
8981                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
8982         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
8983         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
8984         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
8985         LDKBalance_ClaimableAwaitingConfirmations_class =
8986                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
8987         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
8988         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
8989         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
8990         LDKBalance_ContentiousClaimable_class =
8991                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
8992         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
8993         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
8994         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
8995         LDKBalance_MaybeTimeoutClaimableHTLC_class =
8996                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
8997         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
8998         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
8999         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
9000         LDKBalance_MaybePreimageClaimableHTLC_class =
9001                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
9002         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
9003         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
9004         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
9005         LDKBalance_CounterpartyRevokedOutputClaimable_class =
9006                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
9007         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
9008         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
9009         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
9010 }
9011 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9012         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
9013         switch(obj->tag) {
9014                 case LDKBalance_ClaimableOnChannelClose: {
9015                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
9016                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
9017                 }
9018                 case LDKBalance_ClaimableAwaitingConfirmations: {
9019                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
9020                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
9021                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
9022                 }
9023                 case LDKBalance_ContentiousClaimable: {
9024                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
9025                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
9026                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9027                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
9028                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
9029                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
9030                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
9031                 }
9032                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
9033                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
9034                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
9035                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9036                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
9037                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
9038                 }
9039                 case LDKBalance_MaybePreimageClaimableHTLC: {
9040                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
9041                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
9042                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
9043                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
9044                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
9045                 }
9046                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
9047                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
9048                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
9049                 }
9050                 default: abort();
9051         }
9052 }
9053 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
9054         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
9055         for (size_t i = 0; i < ret.datalen; i++) {
9056                 ret.data[i] = Balance_clone(&orig->data[i]);
9057         }
9058         return ret;
9059 }
9060 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
9061         return ThirtyTwoBytes_clone(&owner->a);
9062 }
9063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9064         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
9065         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9066         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
9067         return ret_arr;
9068 }
9069
9070 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
9071         LDKChannelMonitor ret = owner->b;
9072         ret.is_owned = false;
9073         return ret;
9074 }
9075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9076         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
9077         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
9078         int64_t ret_ref = 0;
9079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9081         return ret_ref;
9082 }
9083
9084 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9085 CHECK(owner->result_ok);
9086         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
9087 }
9088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9089         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9090         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
9091         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
9092         return tag_ptr(ret_conv, true);
9093 }
9094
9095 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
9096 CHECK(!owner->result_ok);
9097         return DecodeError_clone(&*owner->contents.err);
9098 }
9099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9100         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
9101         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9102         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
9103         int64_t ret_ref = tag_ptr(ret_copy, true);
9104         return ret_ref;
9105 }
9106
9107 typedef struct LDKType_JCalls {
9108         atomic_size_t refcnt;
9109         JavaVM *vm;
9110         jweak o;
9111         jmethodID type_id_meth;
9112         jmethodID debug_str_meth;
9113         jmethodID write_meth;
9114 } LDKType_JCalls;
9115 static void LDKType_JCalls_free(void* this_arg) {
9116         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9117         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9118                 JNIEnv *env;
9119                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9120                 if (get_jenv_res == JNI_EDETACHED) {
9121                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9122                 } else {
9123                         DO_ASSERT(get_jenv_res == JNI_OK);
9124                 }
9125                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9126                 if (get_jenv_res == JNI_EDETACHED) {
9127                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9128                 }
9129                 FREE(j_calls);
9130         }
9131 }
9132 uint16_t type_id_LDKType_jcall(const void* this_arg) {
9133         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9134         JNIEnv *env;
9135         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9136         if (get_jenv_res == JNI_EDETACHED) {
9137                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9138         } else {
9139                 DO_ASSERT(get_jenv_res == JNI_OK);
9140         }
9141         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9142         CHECK(obj != NULL);
9143         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
9144         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9145                 (*env)->ExceptionDescribe(env);
9146                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
9147         }
9148         if (get_jenv_res == JNI_EDETACHED) {
9149                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9150         }
9151         return ret;
9152 }
9153 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
9154         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9155         JNIEnv *env;
9156         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9157         if (get_jenv_res == JNI_EDETACHED) {
9158                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9159         } else {
9160                 DO_ASSERT(get_jenv_res == JNI_OK);
9161         }
9162         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9163         CHECK(obj != NULL);
9164         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
9165         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9166                 (*env)->ExceptionDescribe(env);
9167                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
9168         }
9169         LDKStr ret_conv = java_to_owned_str(env, ret);
9170         if (get_jenv_res == JNI_EDETACHED) {
9171                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9172         }
9173         return ret_conv;
9174 }
9175 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
9176         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
9177         JNIEnv *env;
9178         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9179         if (get_jenv_res == JNI_EDETACHED) {
9180                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9181         } else {
9182                 DO_ASSERT(get_jenv_res == JNI_OK);
9183         }
9184         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9185         CHECK(obj != NULL);
9186         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9187         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9188                 (*env)->ExceptionDescribe(env);
9189                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
9190         }
9191         LDKCVec_u8Z ret_ref;
9192         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9193         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9194         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9195         if (get_jenv_res == JNI_EDETACHED) {
9196                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9197         }
9198         return ret_ref;
9199 }
9200 static void LDKType_JCalls_cloned(LDKType* new_obj) {
9201         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
9202         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9203 }
9204 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
9205         jclass c = (*env)->GetObjectClass(env, o);
9206         CHECK(c != NULL);
9207         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
9208         atomic_init(&calls->refcnt, 1);
9209         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9210         calls->o = (*env)->NewWeakGlobalRef(env, o);
9211         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
9212         CHECK(calls->type_id_meth != NULL);
9213         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
9214         CHECK(calls->debug_str_meth != NULL);
9215         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9216         CHECK(calls->write_meth != NULL);
9217
9218         LDKType ret = {
9219                 .this_arg = (void*) calls,
9220                 .type_id = type_id_LDKType_jcall,
9221                 .debug_str = debug_str_LDKType_jcall,
9222                 .write = write_LDKType_jcall,
9223                 .cloned = LDKType_JCalls_cloned,
9224                 .free = LDKType_JCalls_free,
9225         };
9226         return ret;
9227 }
9228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
9229         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
9230         *res_ptr = LDKType_init(env, clz, o);
9231         return tag_ptr(res_ptr, true);
9232 }
9233 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9234         void* this_arg_ptr = untag_ptr(this_arg);
9235         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9236         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9237         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
9238         return ret_conv;
9239 }
9240
9241 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
9242         void* this_arg_ptr = untag_ptr(this_arg);
9243         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9244         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9245         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
9246         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9247         Str_free(ret_str);
9248         return ret_conv;
9249 }
9250
9251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9252         void* this_arg_ptr = untag_ptr(this_arg);
9253         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9254         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
9255         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9256         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9257         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9258         CVec_u8Z_free(ret_var);
9259         return ret_arr;
9260 }
9261
9262 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9263         return owner->a;
9264 }
9265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9266         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9267         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9268         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
9269         return ret_arr;
9270 }
9271
9272 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
9273         return Type_clone(&owner->b);
9274 }
9275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9276         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
9277         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
9278         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
9279         return tag_ptr(ret_ret, true);
9280 }
9281
9282 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
9283         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
9284         for (size_t i = 0; i < ret.datalen; i++) {
9285                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
9286         }
9287         return ret;
9288 }
9289 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
9290 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
9291 static jclass LDKOffersMessage_Invoice_class = NULL;
9292 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
9293 static jclass LDKOffersMessage_InvoiceError_class = NULL;
9294 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
9295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
9296         LDKOffersMessage_InvoiceRequest_class =
9297                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
9298         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
9299         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
9300         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
9301         LDKOffersMessage_Invoice_class =
9302                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
9303         CHECK(LDKOffersMessage_Invoice_class != NULL);
9304         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
9305         CHECK(LDKOffersMessage_Invoice_meth != NULL);
9306         LDKOffersMessage_InvoiceError_class =
9307                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
9308         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
9309         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
9310         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
9311 }
9312 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9313         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
9314         switch(obj->tag) {
9315                 case LDKOffersMessage_InvoiceRequest: {
9316                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
9317                         int64_t invoice_request_ref = 0;
9318                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
9319                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
9320                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
9321                 }
9322                 case LDKOffersMessage_Invoice: {
9323                         LDKBolt12Invoice invoice_var = obj->invoice;
9324                         int64_t invoice_ref = 0;
9325                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
9326                         invoice_ref = tag_ptr(invoice_var.inner, false);
9327                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
9328                 }
9329                 case LDKOffersMessage_InvoiceError: {
9330                         LDKInvoiceError invoice_error_var = obj->invoice_error;
9331                         int64_t invoice_error_ref = 0;
9332                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
9333                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
9334                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
9335                 }
9336                 default: abort();
9337         }
9338 }
9339 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
9340 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
9341 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
9342 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
9343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
9344         LDKCOption_OffersMessageZ_Some_class =
9345                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
9346         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
9347         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
9348         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
9349         LDKCOption_OffersMessageZ_None_class =
9350                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
9351         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
9352         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
9353         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
9354 }
9355 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9356         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
9357         switch(obj->tag) {
9358                 case LDKCOption_OffersMessageZ_Some: {
9359                         int64_t some_ref = tag_ptr(&obj->some, false);
9360                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
9361                 }
9362                 case LDKCOption_OffersMessageZ_None: {
9363                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
9364                 }
9365                 default: abort();
9366         }
9367 }
9368 typedef struct LDKCustomOnionMessageContents_JCalls {
9369         atomic_size_t refcnt;
9370         JavaVM *vm;
9371         jweak o;
9372         jmethodID tlv_type_meth;
9373         jmethodID write_meth;
9374 } LDKCustomOnionMessageContents_JCalls;
9375 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
9376         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9377         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9378                 JNIEnv *env;
9379                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9380                 if (get_jenv_res == JNI_EDETACHED) {
9381                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9382                 } else {
9383                         DO_ASSERT(get_jenv_res == JNI_OK);
9384                 }
9385                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9386                 if (get_jenv_res == JNI_EDETACHED) {
9387                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9388                 }
9389                 FREE(j_calls);
9390         }
9391 }
9392 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9393         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9394         JNIEnv *env;
9395         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9396         if (get_jenv_res == JNI_EDETACHED) {
9397                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9398         } else {
9399                 DO_ASSERT(get_jenv_res == JNI_OK);
9400         }
9401         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9402         CHECK(obj != NULL);
9403         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
9404         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9405                 (*env)->ExceptionDescribe(env);
9406                 (*env)->FatalError(env, "A call to tlv_type in LDKCustomOnionMessageContents from rust threw an exception.");
9407         }
9408         if (get_jenv_res == JNI_EDETACHED) {
9409                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9410         }
9411         return ret;
9412 }
9413 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
9414         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
9415         JNIEnv *env;
9416         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9417         if (get_jenv_res == JNI_EDETACHED) {
9418                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9419         } else {
9420                 DO_ASSERT(get_jenv_res == JNI_OK);
9421         }
9422         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9423         CHECK(obj != NULL);
9424         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
9425         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9426                 (*env)->ExceptionDescribe(env);
9427                 (*env)->FatalError(env, "A call to write in LDKCustomOnionMessageContents from rust threw an exception.");
9428         }
9429         LDKCVec_u8Z ret_ref;
9430         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
9431         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
9432         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
9433         if (get_jenv_res == JNI_EDETACHED) {
9434                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9435         }
9436         return ret_ref;
9437 }
9438 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
9439         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
9440         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9441 }
9442 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
9443         jclass c = (*env)->GetObjectClass(env, o);
9444         CHECK(c != NULL);
9445         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
9446         atomic_init(&calls->refcnt, 1);
9447         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9448         calls->o = (*env)->NewWeakGlobalRef(env, o);
9449         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
9450         CHECK(calls->tlv_type_meth != NULL);
9451         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
9452         CHECK(calls->write_meth != NULL);
9453
9454         LDKCustomOnionMessageContents ret = {
9455                 .this_arg = (void*) calls,
9456                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
9457                 .write = write_LDKCustomOnionMessageContents_jcall,
9458                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
9459                 .free = LDKCustomOnionMessageContents_JCalls_free,
9460         };
9461         return ret;
9462 }
9463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
9464         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9465         *res_ptr = LDKCustomOnionMessageContents_init(env, clz, o);
9466         return tag_ptr(res_ptr, true);
9467 }
9468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
9469         void* this_arg_ptr = untag_ptr(this_arg);
9470         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9471         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9472         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
9473         return ret_conv;
9474 }
9475
9476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
9477         void* this_arg_ptr = untag_ptr(this_arg);
9478         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9479         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
9480         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
9481         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9482         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9483         CVec_u8Z_free(ret_var);
9484         return ret_arr;
9485 }
9486
9487 static jclass LDKCOption_CustomOnionMessageContentsZ_Some_class = NULL;
9488 static jmethodID LDKCOption_CustomOnionMessageContentsZ_Some_meth = NULL;
9489 static jclass LDKCOption_CustomOnionMessageContentsZ_None_class = NULL;
9490 static jmethodID LDKCOption_CustomOnionMessageContentsZ_None_meth = NULL;
9491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CustomOnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
9492         LDKCOption_CustomOnionMessageContentsZ_Some_class =
9493                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$Some"));
9494         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_class != NULL);
9495         LDKCOption_CustomOnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, "<init>", "(J)V");
9496         CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_meth != NULL);
9497         LDKCOption_CustomOnionMessageContentsZ_None_class =
9498                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$None"));
9499         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_class != NULL);
9500         LDKCOption_CustomOnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_None_class, "<init>", "()V");
9501         CHECK(LDKCOption_CustomOnionMessageContentsZ_None_meth != NULL);
9502 }
9503 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CustomOnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9504         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
9505         switch(obj->tag) {
9506                 case LDKCOption_CustomOnionMessageContentsZ_Some: {
9507                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
9508                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
9509                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, LDKCOption_CustomOnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
9510                 }
9511                 case LDKCOption_CustomOnionMessageContentsZ_None: {
9512                         return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_None_class, LDKCOption_CustomOnionMessageContentsZ_None_meth);
9513                 }
9514                 default: abort();
9515         }
9516 }
9517 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9518 CHECK(owner->result_ok);
9519         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
9520 }
9521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9522         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9523         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
9524         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
9525         int64_t ret_ref = tag_ptr(ret_copy, true);
9526         return ret_ref;
9527 }
9528
9529 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
9530 CHECK(!owner->result_ok);
9531         return DecodeError_clone(&*owner->contents.err);
9532 }
9533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9534         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
9535         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9536         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
9537         int64_t ret_ref = tag_ptr(ret_copy, true);
9538         return ret_ref;
9539 }
9540
9541 static jclass LDKCOption_TypeZ_Some_class = NULL;
9542 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
9543 static jclass LDKCOption_TypeZ_None_class = NULL;
9544 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
9545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
9546         LDKCOption_TypeZ_Some_class =
9547                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
9548         CHECK(LDKCOption_TypeZ_Some_class != NULL);
9549         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
9550         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
9551         LDKCOption_TypeZ_None_class =
9552                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
9553         CHECK(LDKCOption_TypeZ_None_class != NULL);
9554         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
9555         CHECK(LDKCOption_TypeZ_None_meth != NULL);
9556 }
9557 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9558         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
9559         switch(obj->tag) {
9560                 case LDKCOption_TypeZ_Some: {
9561                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
9562                         *some_ret = Type_clone(&obj->some);
9563                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
9564                 }
9565                 case LDKCOption_TypeZ_None: {
9566                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
9567                 }
9568                 default: abort();
9569         }
9570 }
9571 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
9572 CHECK(owner->result_ok);
9573         return COption_TypeZ_clone(&*owner->contents.result);
9574 }
9575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9576         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
9577         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
9578         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
9579         int64_t ret_ref = tag_ptr(ret_copy, true);
9580         return ret_ref;
9581 }
9582
9583 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
9584 CHECK(!owner->result_ok);
9585         return DecodeError_clone(&*owner->contents.err);
9586 }
9587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9588         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
9589         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9590         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
9591         int64_t ret_ref = tag_ptr(ret_copy, true);
9592         return ret_ref;
9593 }
9594
9595 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
9596 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
9597 static jclass LDKCOption_NetAddressZ_None_class = NULL;
9598 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
9599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
9600         LDKCOption_NetAddressZ_Some_class =
9601                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
9602         CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
9603         LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
9604         CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
9605         LDKCOption_NetAddressZ_None_class =
9606                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
9607         CHECK(LDKCOption_NetAddressZ_None_class != NULL);
9608         LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
9609         CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
9610 }
9611 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9612         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
9613         switch(obj->tag) {
9614                 case LDKCOption_NetAddressZ_Some: {
9615                         int64_t some_ref = tag_ptr(&obj->some, false);
9616                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
9617                 }
9618                 case LDKCOption_NetAddressZ_None: {
9619                         return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
9620                 }
9621                 default: abort();
9622         }
9623 }
9624 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
9625         return owner->a;
9626 }
9627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
9628         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
9629         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
9630         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form);
9631         return ret_arr;
9632 }
9633
9634 static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
9635         return COption_NetAddressZ_clone(&owner->b);
9636 }
9637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
9638         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
9639         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
9640         *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv);
9641         int64_t ret_ref = tag_ptr(ret_copy, true);
9642         return ret_ref;
9643 }
9644
9645 static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) {
9646         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen };
9647         for (size_t i = 0; i < ret.datalen; i++) {
9648                 ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]);
9649         }
9650         return ret;
9651 }
9652 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
9653 CHECK(owner->result_ok);
9654         return CVec_u8Z_clone(&*owner->contents.result);
9655 }
9656 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9657         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
9658         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
9659         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
9660         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
9661         CVec_u8Z_free(ret_var);
9662         return ret_arr;
9663 }
9664
9665 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
9666         LDKPeerHandleError ret = *owner->contents.err;
9667         ret.is_owned = false;
9668         return ret;
9669 }
9670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9671         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
9672         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
9673         int64_t ret_ref = 0;
9674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9676         return ret_ref;
9677 }
9678
9679 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
9680 CHECK(owner->result_ok);
9681         return *owner->contents.result;
9682 }
9683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9684         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
9685         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
9686 }
9687
9688 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
9689         LDKPeerHandleError ret = *owner->contents.err;
9690         ret.is_owned = false;
9691         return ret;
9692 }
9693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9694         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
9695         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
9696         int64_t ret_ref = 0;
9697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9699         return ret_ref;
9700 }
9701
9702 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9703 CHECK(owner->result_ok);
9704         return *owner->contents.result;
9705 }
9706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9707         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9708         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
9709         return ret_conv;
9710 }
9711
9712 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
9713         LDKPeerHandleError ret = *owner->contents.err;
9714         ret.is_owned = false;
9715         return ret;
9716 }
9717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9718         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
9719         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
9720         int64_t ret_ref = 0;
9721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9723         return ret_ref;
9724 }
9725
9726 static jclass LDKGraphSyncError_DecodeError_class = NULL;
9727 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
9728 static jclass LDKGraphSyncError_LightningError_class = NULL;
9729 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
9730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
9731         LDKGraphSyncError_DecodeError_class =
9732                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
9733         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
9734         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
9735         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
9736         LDKGraphSyncError_LightningError_class =
9737                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
9738         CHECK(LDKGraphSyncError_LightningError_class != NULL);
9739         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
9740         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
9741 }
9742 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9743         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
9744         switch(obj->tag) {
9745                 case LDKGraphSyncError_DecodeError: {
9746                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
9747                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
9748                 }
9749                 case LDKGraphSyncError_LightningError: {
9750                         LDKLightningError lightning_error_var = obj->lightning_error;
9751                         int64_t lightning_error_ref = 0;
9752                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
9753                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
9754                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
9755                 }
9756                 default: abort();
9757         }
9758 }
9759 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
9760 CHECK(owner->result_ok);
9761         return *owner->contents.result;
9762 }
9763 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9764         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
9765         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
9766         return ret_conv;
9767 }
9768
9769 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
9770 CHECK(!owner->result_ok);
9771         return GraphSyncError_clone(&*owner->contents.err);
9772 }
9773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9774         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
9775         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
9776         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
9777         int64_t ret_ref = tag_ptr(ret_copy, true);
9778         return ret_ref;
9779 }
9780
9781 static jclass LDKCOption_KeyPairZ_Some_class = NULL;
9782 static jmethodID LDKCOption_KeyPairZ_Some_meth = NULL;
9783 static jclass LDKCOption_KeyPairZ_None_class = NULL;
9784 static jmethodID LDKCOption_KeyPairZ_None_meth = NULL;
9785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1KeyPairZ_init (JNIEnv *env, jclass clz) {
9786         LDKCOption_KeyPairZ_Some_class =
9787                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_KeyPairZ$Some"));
9788         CHECK(LDKCOption_KeyPairZ_Some_class != NULL);
9789         LDKCOption_KeyPairZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_KeyPairZ_Some_class, "<init>", "([B)V");
9790         CHECK(LDKCOption_KeyPairZ_Some_meth != NULL);
9791         LDKCOption_KeyPairZ_None_class =
9792                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_KeyPairZ$None"));
9793         CHECK(LDKCOption_KeyPairZ_None_class != NULL);
9794         LDKCOption_KeyPairZ_None_meth = (*env)->GetMethodID(env, LDKCOption_KeyPairZ_None_class, "<init>", "()V");
9795         CHECK(LDKCOption_KeyPairZ_None_meth != NULL);
9796 }
9797 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1KeyPairZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9798         LDKCOption_KeyPairZ *obj = (LDKCOption_KeyPairZ*)untag_ptr(ptr);
9799         switch(obj->tag) {
9800                 case LDKCOption_KeyPairZ_Some: {
9801                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
9802                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
9803                         return (*env)->NewObject(env, LDKCOption_KeyPairZ_Some_class, LDKCOption_KeyPairZ_Some_meth, some_arr);
9804                 }
9805                 case LDKCOption_KeyPairZ_None: {
9806                         return (*env)->NewObject(env, LDKCOption_KeyPairZ_None_class, LDKCOption_KeyPairZ_None_meth);
9807                 }
9808                 default: abort();
9809         }
9810 }
9811 static inline struct LDKCOption_KeyPairZ CResult_COption_KeyPairZNoneZ_get_ok(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR owner){
9812 CHECK(owner->result_ok);
9813         return COption_KeyPairZ_clone(&*owner->contents.result);
9814 }
9815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9816         LDKCResult_COption_KeyPairZNoneZ* owner_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(owner);
9817         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
9818         *ret_copy = CResult_COption_KeyPairZNoneZ_get_ok(owner_conv);
9819         int64_t ret_ref = tag_ptr(ret_copy, true);
9820         return ret_ref;
9821 }
9822
9823 static inline void CResult_COption_KeyPairZNoneZ_get_err(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR owner){
9824 CHECK(!owner->result_ok);
9825         return *owner->contents.err;
9826 }
9827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9828         LDKCResult_COption_KeyPairZNoneZ* owner_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(owner);
9829         CResult_COption_KeyPairZNoneZ_get_err(owner_conv);
9830 }
9831
9832 static jclass LDKCOption_ScriptZ_Some_class = NULL;
9833 static jmethodID LDKCOption_ScriptZ_Some_meth = NULL;
9834 static jclass LDKCOption_ScriptZ_None_class = NULL;
9835 static jmethodID LDKCOption_ScriptZ_None_meth = NULL;
9836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ScriptZ_init (JNIEnv *env, jclass clz) {
9837         LDKCOption_ScriptZ_Some_class =
9838                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScriptZ$Some"));
9839         CHECK(LDKCOption_ScriptZ_Some_class != NULL);
9840         LDKCOption_ScriptZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ScriptZ_Some_class, "<init>", "([B)V");
9841         CHECK(LDKCOption_ScriptZ_Some_meth != NULL);
9842         LDKCOption_ScriptZ_None_class =
9843                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ScriptZ$None"));
9844         CHECK(LDKCOption_ScriptZ_None_class != NULL);
9845         LDKCOption_ScriptZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ScriptZ_None_class, "<init>", "()V");
9846         CHECK(LDKCOption_ScriptZ_None_meth != NULL);
9847 }
9848 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ScriptZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9849         LDKCOption_ScriptZ *obj = (LDKCOption_ScriptZ*)untag_ptr(ptr);
9850         switch(obj->tag) {
9851                 case LDKCOption_ScriptZ_Some: {
9852                         LDKCVec_u8Z some_var = obj->some;
9853                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
9854                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
9855                         return (*env)->NewObject(env, LDKCOption_ScriptZ_Some_class, LDKCOption_ScriptZ_Some_meth, some_arr);
9856                 }
9857                 case LDKCOption_ScriptZ_None: {
9858                         return (*env)->NewObject(env, LDKCOption_ScriptZ_None_class, LDKCOption_ScriptZ_None_meth);
9859                 }
9860                 default: abort();
9861         }
9862 }
9863 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
9864         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
9865         for (size_t i = 0; i < ret.datalen; i++) {
9866                 ret.data[i] = Witness_clone(&orig->data[i]);
9867         }
9868         return ret;
9869 }
9870 static jclass LDKCOption_i64Z_Some_class = NULL;
9871 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
9872 static jclass LDKCOption_i64Z_None_class = NULL;
9873 static jmethodID LDKCOption_i64Z_None_meth = NULL;
9874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
9875         LDKCOption_i64Z_Some_class =
9876                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
9877         CHECK(LDKCOption_i64Z_Some_class != NULL);
9878         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
9879         CHECK(LDKCOption_i64Z_Some_meth != NULL);
9880         LDKCOption_i64Z_None_class =
9881                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
9882         CHECK(LDKCOption_i64Z_None_class != NULL);
9883         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
9884         CHECK(LDKCOption_i64Z_None_meth != NULL);
9885 }
9886 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9887         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
9888         switch(obj->tag) {
9889                 case LDKCOption_i64Z_Some: {
9890                         int64_t some_conv = obj->some;
9891                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
9892                 }
9893                 case LDKCOption_i64Z_None: {
9894                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
9895                 }
9896                 default: abort();
9897         }
9898 }
9899 static jclass LDKCOption_TxidZ_Some_class = NULL;
9900 static jmethodID LDKCOption_TxidZ_Some_meth = NULL;
9901 static jclass LDKCOption_TxidZ_None_class = NULL;
9902 static jmethodID LDKCOption_TxidZ_None_meth = NULL;
9903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxidZ_init (JNIEnv *env, jclass clz) {
9904         LDKCOption_TxidZ_Some_class =
9905                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxidZ$Some"));
9906         CHECK(LDKCOption_TxidZ_Some_class != NULL);
9907         LDKCOption_TxidZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxidZ_Some_class, "<init>", "([B)V");
9908         CHECK(LDKCOption_TxidZ_Some_meth != NULL);
9909         LDKCOption_TxidZ_None_class =
9910                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxidZ$None"));
9911         CHECK(LDKCOption_TxidZ_None_class != NULL);
9912         LDKCOption_TxidZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxidZ_None_class, "<init>", "()V");
9913         CHECK(LDKCOption_TxidZ_None_meth != NULL);
9914 }
9915 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxidZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9916         LDKCOption_TxidZ *obj = (LDKCOption_TxidZ*)untag_ptr(ptr);
9917         switch(obj->tag) {
9918                 case LDKCOption_TxidZ_Some: {
9919                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
9920                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
9921                         return (*env)->NewObject(env, LDKCOption_TxidZ_Some_class, LDKCOption_TxidZ_Some_meth, some_arr);
9922                 }
9923                 case LDKCOption_TxidZ_None: {
9924                         return (*env)->NewObject(env, LDKCOption_TxidZ_None_class, LDKCOption_TxidZ_None_meth);
9925                 }
9926                 default: abort();
9927         }
9928 }
9929 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
9930 CHECK(owner->result_ok);
9931         return NetAddress_clone(&*owner->contents.result);
9932 }
9933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9934         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
9935         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9936         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
9937         int64_t ret_ref = tag_ptr(ret_copy, true);
9938         return ret_ref;
9939 }
9940
9941 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
9942 CHECK(!owner->result_ok);
9943         return DecodeError_clone(&*owner->contents.err);
9944 }
9945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9946         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
9947         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9948         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
9949         int64_t ret_ref = tag_ptr(ret_copy, true);
9950         return ret_ref;
9951 }
9952
9953 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
9954         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
9955         for (size_t i = 0; i < ret.datalen; i++) {
9956                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
9957         }
9958         return ret;
9959 }
9960 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
9961         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
9962         for (size_t i = 0; i < ret.datalen; i++) {
9963                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
9964         }
9965         return ret;
9966 }
9967 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
9968         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
9969         for (size_t i = 0; i < ret.datalen; i++) {
9970                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
9971         }
9972         return ret;
9973 }
9974 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
9975         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
9976         for (size_t i = 0; i < ret.datalen; i++) {
9977                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
9978         }
9979         return ret;
9980 }
9981 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9982         LDKAcceptChannel ret = *owner->contents.result;
9983         ret.is_owned = false;
9984         return ret;
9985 }
9986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9987         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
9988         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
9989         int64_t ret_ref = 0;
9990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9992         return ret_ref;
9993 }
9994
9995 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
9996 CHECK(!owner->result_ok);
9997         return DecodeError_clone(&*owner->contents.err);
9998 }
9999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10000         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
10001         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10002         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
10003         int64_t ret_ref = tag_ptr(ret_copy, true);
10004         return ret_ref;
10005 }
10006
10007 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10008         LDKAcceptChannelV2 ret = *owner->contents.result;
10009         ret.is_owned = false;
10010         return ret;
10011 }
10012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10013         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10014         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
10015         int64_t ret_ref = 0;
10016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10018         return ret_ref;
10019 }
10020
10021 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
10022 CHECK(!owner->result_ok);
10023         return DecodeError_clone(&*owner->contents.err);
10024 }
10025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10026         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
10027         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10028         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
10029         int64_t ret_ref = tag_ptr(ret_copy, true);
10030         return ret_ref;
10031 }
10032
10033 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10034         LDKTxAddInput ret = *owner->contents.result;
10035         ret.is_owned = false;
10036         return ret;
10037 }
10038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10039         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10040         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
10041         int64_t ret_ref = 0;
10042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10044         return ret_ref;
10045 }
10046
10047 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
10048 CHECK(!owner->result_ok);
10049         return DecodeError_clone(&*owner->contents.err);
10050 }
10051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10052         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
10053         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10054         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
10055         int64_t ret_ref = tag_ptr(ret_copy, true);
10056         return ret_ref;
10057 }
10058
10059 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10060         LDKTxAddOutput ret = *owner->contents.result;
10061         ret.is_owned = false;
10062         return ret;
10063 }
10064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10065         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10066         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
10067         int64_t ret_ref = 0;
10068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10070         return ret_ref;
10071 }
10072
10073 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
10074 CHECK(!owner->result_ok);
10075         return DecodeError_clone(&*owner->contents.err);
10076 }
10077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10078         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
10079         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10080         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
10081         int64_t ret_ref = tag_ptr(ret_copy, true);
10082         return ret_ref;
10083 }
10084
10085 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10086         LDKTxRemoveInput ret = *owner->contents.result;
10087         ret.is_owned = false;
10088         return ret;
10089 }
10090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10091         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10092         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
10093         int64_t ret_ref = 0;
10094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10096         return ret_ref;
10097 }
10098
10099 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
10100 CHECK(!owner->result_ok);
10101         return DecodeError_clone(&*owner->contents.err);
10102 }
10103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10104         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
10105         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10106         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
10107         int64_t ret_ref = tag_ptr(ret_copy, true);
10108         return ret_ref;
10109 }
10110
10111 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10112         LDKTxRemoveOutput ret = *owner->contents.result;
10113         ret.is_owned = false;
10114         return ret;
10115 }
10116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10117         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10118         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
10119         int64_t ret_ref = 0;
10120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10122         return ret_ref;
10123 }
10124
10125 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
10126 CHECK(!owner->result_ok);
10127         return DecodeError_clone(&*owner->contents.err);
10128 }
10129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10130         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
10131         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10132         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
10133         int64_t ret_ref = tag_ptr(ret_copy, true);
10134         return ret_ref;
10135 }
10136
10137 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10138         LDKTxComplete ret = *owner->contents.result;
10139         ret.is_owned = false;
10140         return ret;
10141 }
10142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10143         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10144         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
10145         int64_t ret_ref = 0;
10146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10148         return ret_ref;
10149 }
10150
10151 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
10152 CHECK(!owner->result_ok);
10153         return DecodeError_clone(&*owner->contents.err);
10154 }
10155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10156         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
10157         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10158         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
10159         int64_t ret_ref = tag_ptr(ret_copy, true);
10160         return ret_ref;
10161 }
10162
10163 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10164         LDKTxSignatures ret = *owner->contents.result;
10165         ret.is_owned = false;
10166         return ret;
10167 }
10168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10169         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10170         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
10171         int64_t ret_ref = 0;
10172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10174         return ret_ref;
10175 }
10176
10177 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
10178 CHECK(!owner->result_ok);
10179         return DecodeError_clone(&*owner->contents.err);
10180 }
10181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10182         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
10183         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10184         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
10185         int64_t ret_ref = tag_ptr(ret_copy, true);
10186         return ret_ref;
10187 }
10188
10189 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10190         LDKTxInitRbf ret = *owner->contents.result;
10191         ret.is_owned = false;
10192         return ret;
10193 }
10194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10195         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10196         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
10197         int64_t ret_ref = 0;
10198         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10199         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10200         return ret_ref;
10201 }
10202
10203 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
10204 CHECK(!owner->result_ok);
10205         return DecodeError_clone(&*owner->contents.err);
10206 }
10207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10208         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
10209         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10210         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
10211         int64_t ret_ref = tag_ptr(ret_copy, true);
10212         return ret_ref;
10213 }
10214
10215 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10216         LDKTxAckRbf ret = *owner->contents.result;
10217         ret.is_owned = false;
10218         return ret;
10219 }
10220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10221         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10222         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
10223         int64_t ret_ref = 0;
10224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10226         return ret_ref;
10227 }
10228
10229 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
10230 CHECK(!owner->result_ok);
10231         return DecodeError_clone(&*owner->contents.err);
10232 }
10233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10234         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
10235         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10236         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
10237         int64_t ret_ref = tag_ptr(ret_copy, true);
10238         return ret_ref;
10239 }
10240
10241 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10242         LDKTxAbort ret = *owner->contents.result;
10243         ret.is_owned = false;
10244         return ret;
10245 }
10246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10247         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10248         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
10249         int64_t ret_ref = 0;
10250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10252         return ret_ref;
10253 }
10254
10255 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
10256 CHECK(!owner->result_ok);
10257         return DecodeError_clone(&*owner->contents.err);
10258 }
10259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10260         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
10261         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10262         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
10263         int64_t ret_ref = tag_ptr(ret_copy, true);
10264         return ret_ref;
10265 }
10266
10267 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10268         LDKAnnouncementSignatures ret = *owner->contents.result;
10269         ret.is_owned = false;
10270         return ret;
10271 }
10272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10273         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10274         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
10275         int64_t ret_ref = 0;
10276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10278         return ret_ref;
10279 }
10280
10281 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
10282 CHECK(!owner->result_ok);
10283         return DecodeError_clone(&*owner->contents.err);
10284 }
10285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10286         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
10287         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10288         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
10289         int64_t ret_ref = tag_ptr(ret_copy, true);
10290         return ret_ref;
10291 }
10292
10293 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10294         LDKChannelReestablish ret = *owner->contents.result;
10295         ret.is_owned = false;
10296         return ret;
10297 }
10298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10299         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10300         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
10301         int64_t ret_ref = 0;
10302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10304         return ret_ref;
10305 }
10306
10307 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
10308 CHECK(!owner->result_ok);
10309         return DecodeError_clone(&*owner->contents.err);
10310 }
10311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10312         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
10313         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10314         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
10315         int64_t ret_ref = tag_ptr(ret_copy, true);
10316         return ret_ref;
10317 }
10318
10319 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10320         LDKClosingSigned ret = *owner->contents.result;
10321         ret.is_owned = false;
10322         return ret;
10323 }
10324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10325         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10326         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
10327         int64_t ret_ref = 0;
10328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10330         return ret_ref;
10331 }
10332
10333 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
10334 CHECK(!owner->result_ok);
10335         return DecodeError_clone(&*owner->contents.err);
10336 }
10337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10338         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
10339         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10340         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
10341         int64_t ret_ref = tag_ptr(ret_copy, true);
10342         return ret_ref;
10343 }
10344
10345 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10346         LDKClosingSignedFeeRange ret = *owner->contents.result;
10347         ret.is_owned = false;
10348         return ret;
10349 }
10350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10351         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10352         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
10353         int64_t ret_ref = 0;
10354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10356         return ret_ref;
10357 }
10358
10359 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
10360 CHECK(!owner->result_ok);
10361         return DecodeError_clone(&*owner->contents.err);
10362 }
10363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10364         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
10365         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10366         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
10367         int64_t ret_ref = tag_ptr(ret_copy, true);
10368         return ret_ref;
10369 }
10370
10371 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10372         LDKCommitmentSigned ret = *owner->contents.result;
10373         ret.is_owned = false;
10374         return ret;
10375 }
10376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10377         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10378         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
10379         int64_t ret_ref = 0;
10380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10382         return ret_ref;
10383 }
10384
10385 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
10386 CHECK(!owner->result_ok);
10387         return DecodeError_clone(&*owner->contents.err);
10388 }
10389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10390         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
10391         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10392         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
10393         int64_t ret_ref = tag_ptr(ret_copy, true);
10394         return ret_ref;
10395 }
10396
10397 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10398         LDKFundingCreated ret = *owner->contents.result;
10399         ret.is_owned = false;
10400         return ret;
10401 }
10402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10403         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10404         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
10405         int64_t ret_ref = 0;
10406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10408         return ret_ref;
10409 }
10410
10411 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
10412 CHECK(!owner->result_ok);
10413         return DecodeError_clone(&*owner->contents.err);
10414 }
10415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10416         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
10417         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10418         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
10419         int64_t ret_ref = tag_ptr(ret_copy, true);
10420         return ret_ref;
10421 }
10422
10423 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10424         LDKFundingSigned ret = *owner->contents.result;
10425         ret.is_owned = false;
10426         return ret;
10427 }
10428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10429         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10430         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
10431         int64_t ret_ref = 0;
10432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10434         return ret_ref;
10435 }
10436
10437 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
10438 CHECK(!owner->result_ok);
10439         return DecodeError_clone(&*owner->contents.err);
10440 }
10441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10442         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
10443         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10444         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
10445         int64_t ret_ref = tag_ptr(ret_copy, true);
10446         return ret_ref;
10447 }
10448
10449 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10450         LDKChannelReady ret = *owner->contents.result;
10451         ret.is_owned = false;
10452         return ret;
10453 }
10454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10455         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10456         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
10457         int64_t ret_ref = 0;
10458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10460         return ret_ref;
10461 }
10462
10463 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
10464 CHECK(!owner->result_ok);
10465         return DecodeError_clone(&*owner->contents.err);
10466 }
10467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10468         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
10469         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10470         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
10471         int64_t ret_ref = tag_ptr(ret_copy, true);
10472         return ret_ref;
10473 }
10474
10475 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10476         LDKInit ret = *owner->contents.result;
10477         ret.is_owned = false;
10478         return ret;
10479 }
10480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10481         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10482         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
10483         int64_t ret_ref = 0;
10484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10486         return ret_ref;
10487 }
10488
10489 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
10490 CHECK(!owner->result_ok);
10491         return DecodeError_clone(&*owner->contents.err);
10492 }
10493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10494         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
10495         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10496         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
10497         int64_t ret_ref = tag_ptr(ret_copy, true);
10498         return ret_ref;
10499 }
10500
10501 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10502         LDKOpenChannel ret = *owner->contents.result;
10503         ret.is_owned = false;
10504         return ret;
10505 }
10506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10507         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10508         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
10509         int64_t ret_ref = 0;
10510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10512         return ret_ref;
10513 }
10514
10515 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
10516 CHECK(!owner->result_ok);
10517         return DecodeError_clone(&*owner->contents.err);
10518 }
10519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10520         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
10521         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10522         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
10523         int64_t ret_ref = tag_ptr(ret_copy, true);
10524         return ret_ref;
10525 }
10526
10527 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
10528         LDKOpenChannelV2 ret = *owner->contents.result;
10529         ret.is_owned = false;
10530         return ret;
10531 }
10532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10533         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
10534         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
10535         int64_t ret_ref = 0;
10536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10538         return ret_ref;
10539 }
10540
10541 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
10542 CHECK(!owner->result_ok);
10543         return DecodeError_clone(&*owner->contents.err);
10544 }
10545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10546         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
10547         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10548         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
10549         int64_t ret_ref = tag_ptr(ret_copy, true);
10550         return ret_ref;
10551 }
10552
10553 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10554         LDKRevokeAndACK ret = *owner->contents.result;
10555         ret.is_owned = false;
10556         return ret;
10557 }
10558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10559         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10560         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
10561         int64_t ret_ref = 0;
10562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10564         return ret_ref;
10565 }
10566
10567 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
10568 CHECK(!owner->result_ok);
10569         return DecodeError_clone(&*owner->contents.err);
10570 }
10571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10572         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
10573         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10574         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
10575         int64_t ret_ref = tag_ptr(ret_copy, true);
10576         return ret_ref;
10577 }
10578
10579 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10580         LDKShutdown ret = *owner->contents.result;
10581         ret.is_owned = false;
10582         return ret;
10583 }
10584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10585         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10586         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
10587         int64_t ret_ref = 0;
10588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10590         return ret_ref;
10591 }
10592
10593 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
10594 CHECK(!owner->result_ok);
10595         return DecodeError_clone(&*owner->contents.err);
10596 }
10597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10598         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
10599         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10600         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
10601         int64_t ret_ref = tag_ptr(ret_copy, true);
10602         return ret_ref;
10603 }
10604
10605 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10606         LDKUpdateFailHTLC ret = *owner->contents.result;
10607         ret.is_owned = false;
10608         return ret;
10609 }
10610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10611         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10612         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
10613         int64_t ret_ref = 0;
10614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10616         return ret_ref;
10617 }
10618
10619 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
10620 CHECK(!owner->result_ok);
10621         return DecodeError_clone(&*owner->contents.err);
10622 }
10623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10624         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
10625         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10626         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
10627         int64_t ret_ref = tag_ptr(ret_copy, true);
10628         return ret_ref;
10629 }
10630
10631 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10632         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
10633         ret.is_owned = false;
10634         return ret;
10635 }
10636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10637         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10638         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
10639         int64_t ret_ref = 0;
10640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10642         return ret_ref;
10643 }
10644
10645 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
10646 CHECK(!owner->result_ok);
10647         return DecodeError_clone(&*owner->contents.err);
10648 }
10649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10650         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
10651         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10652         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
10653         int64_t ret_ref = tag_ptr(ret_copy, true);
10654         return ret_ref;
10655 }
10656
10657 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10658         LDKUpdateFee ret = *owner->contents.result;
10659         ret.is_owned = false;
10660         return ret;
10661 }
10662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10663         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10664         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
10665         int64_t ret_ref = 0;
10666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10668         return ret_ref;
10669 }
10670
10671 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
10672 CHECK(!owner->result_ok);
10673         return DecodeError_clone(&*owner->contents.err);
10674 }
10675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10676         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
10677         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10678         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
10679         int64_t ret_ref = tag_ptr(ret_copy, true);
10680         return ret_ref;
10681 }
10682
10683 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10684         LDKUpdateFulfillHTLC ret = *owner->contents.result;
10685         ret.is_owned = false;
10686         return ret;
10687 }
10688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10689         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10690         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
10691         int64_t ret_ref = 0;
10692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10694         return ret_ref;
10695 }
10696
10697 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
10698 CHECK(!owner->result_ok);
10699         return DecodeError_clone(&*owner->contents.err);
10700 }
10701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10702         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
10703         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10704         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
10705         int64_t ret_ref = tag_ptr(ret_copy, true);
10706         return ret_ref;
10707 }
10708
10709 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10710         LDKUpdateAddHTLC ret = *owner->contents.result;
10711         ret.is_owned = false;
10712         return ret;
10713 }
10714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10715         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10716         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
10717         int64_t ret_ref = 0;
10718         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10719         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10720         return ret_ref;
10721 }
10722
10723 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
10724 CHECK(!owner->result_ok);
10725         return DecodeError_clone(&*owner->contents.err);
10726 }
10727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10728         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
10729         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10730         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
10731         int64_t ret_ref = tag_ptr(ret_copy, true);
10732         return ret_ref;
10733 }
10734
10735 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10736         LDKOnionMessage ret = *owner->contents.result;
10737         ret.is_owned = false;
10738         return ret;
10739 }
10740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10741         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10742         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
10743         int64_t ret_ref = 0;
10744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10746         return ret_ref;
10747 }
10748
10749 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
10750 CHECK(!owner->result_ok);
10751         return DecodeError_clone(&*owner->contents.err);
10752 }
10753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10754         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
10755         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10756         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
10757         int64_t ret_ref = tag_ptr(ret_copy, true);
10758         return ret_ref;
10759 }
10760
10761 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
10762         LDKPing ret = *owner->contents.result;
10763         ret.is_owned = false;
10764         return ret;
10765 }
10766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10767         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
10768         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
10769         int64_t ret_ref = 0;
10770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10772         return ret_ref;
10773 }
10774
10775 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
10776 CHECK(!owner->result_ok);
10777         return DecodeError_clone(&*owner->contents.err);
10778 }
10779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10780         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
10781         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10782         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
10783         int64_t ret_ref = tag_ptr(ret_copy, true);
10784         return ret_ref;
10785 }
10786
10787 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
10788         LDKPong ret = *owner->contents.result;
10789         ret.is_owned = false;
10790         return ret;
10791 }
10792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10793         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
10794         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
10795         int64_t ret_ref = 0;
10796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10798         return ret_ref;
10799 }
10800
10801 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
10802 CHECK(!owner->result_ok);
10803         return DecodeError_clone(&*owner->contents.err);
10804 }
10805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10806         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
10807         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10808         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
10809         int64_t ret_ref = tag_ptr(ret_copy, true);
10810         return ret_ref;
10811 }
10812
10813 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10814         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
10815         ret.is_owned = false;
10816         return ret;
10817 }
10818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10819         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10820         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
10821         int64_t ret_ref = 0;
10822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10824         return ret_ref;
10825 }
10826
10827 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10828 CHECK(!owner->result_ok);
10829         return DecodeError_clone(&*owner->contents.err);
10830 }
10831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10832         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10833         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10834         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
10835         int64_t ret_ref = tag_ptr(ret_copy, true);
10836         return ret_ref;
10837 }
10838
10839 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10840         LDKChannelAnnouncement ret = *owner->contents.result;
10841         ret.is_owned = false;
10842         return ret;
10843 }
10844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10845         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10846         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
10847         int64_t ret_ref = 0;
10848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10850         return ret_ref;
10851 }
10852
10853 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10854 CHECK(!owner->result_ok);
10855         return DecodeError_clone(&*owner->contents.err);
10856 }
10857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10858         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
10859         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10860         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
10861         int64_t ret_ref = tag_ptr(ret_copy, true);
10862         return ret_ref;
10863 }
10864
10865 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10866         LDKUnsignedChannelUpdate ret = *owner->contents.result;
10867         ret.is_owned = false;
10868         return ret;
10869 }
10870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10871         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10872         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
10873         int64_t ret_ref = 0;
10874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10876         return ret_ref;
10877 }
10878
10879 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10880 CHECK(!owner->result_ok);
10881         return DecodeError_clone(&*owner->contents.err);
10882 }
10883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10884         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10885         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10886         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
10887         int64_t ret_ref = tag_ptr(ret_copy, true);
10888         return ret_ref;
10889 }
10890
10891 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10892         LDKChannelUpdate ret = *owner->contents.result;
10893         ret.is_owned = false;
10894         return ret;
10895 }
10896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10897         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10898         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
10899         int64_t ret_ref = 0;
10900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10902         return ret_ref;
10903 }
10904
10905 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
10906 CHECK(!owner->result_ok);
10907         return DecodeError_clone(&*owner->contents.err);
10908 }
10909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10910         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
10911         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10912         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
10913         int64_t ret_ref = tag_ptr(ret_copy, true);
10914         return ret_ref;
10915 }
10916
10917 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
10918         LDKErrorMessage ret = *owner->contents.result;
10919         ret.is_owned = false;
10920         return ret;
10921 }
10922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10923         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
10924         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
10925         int64_t ret_ref = 0;
10926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10928         return ret_ref;
10929 }
10930
10931 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
10932 CHECK(!owner->result_ok);
10933         return DecodeError_clone(&*owner->contents.err);
10934 }
10935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10936         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
10937         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10938         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
10939         int64_t ret_ref = tag_ptr(ret_copy, true);
10940         return ret_ref;
10941 }
10942
10943 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
10944         LDKWarningMessage ret = *owner->contents.result;
10945         ret.is_owned = false;
10946         return ret;
10947 }
10948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10949         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
10950         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
10951         int64_t ret_ref = 0;
10952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10954         return ret_ref;
10955 }
10956
10957 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
10958 CHECK(!owner->result_ok);
10959         return DecodeError_clone(&*owner->contents.err);
10960 }
10961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10962         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
10963         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10964         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
10965         int64_t ret_ref = tag_ptr(ret_copy, true);
10966         return ret_ref;
10967 }
10968
10969 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10970         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
10971         ret.is_owned = false;
10972         return ret;
10973 }
10974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10975         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10976         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
10977         int64_t ret_ref = 0;
10978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10980         return ret_ref;
10981 }
10982
10983 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10984 CHECK(!owner->result_ok);
10985         return DecodeError_clone(&*owner->contents.err);
10986 }
10987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10988         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
10989         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10990         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
10991         int64_t ret_ref = tag_ptr(ret_copy, true);
10992         return ret_ref;
10993 }
10994
10995 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
10996         LDKNodeAnnouncement ret = *owner->contents.result;
10997         ret.is_owned = false;
10998         return ret;
10999 }
11000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11001         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11002         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
11003         int64_t ret_ref = 0;
11004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11006         return ret_ref;
11007 }
11008
11009 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
11010 CHECK(!owner->result_ok);
11011         return DecodeError_clone(&*owner->contents.err);
11012 }
11013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11014         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
11015         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11016         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
11017         int64_t ret_ref = tag_ptr(ret_copy, true);
11018         return ret_ref;
11019 }
11020
11021 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11022         LDKQueryShortChannelIds ret = *owner->contents.result;
11023         ret.is_owned = false;
11024         return ret;
11025 }
11026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11027         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11028         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
11029         int64_t ret_ref = 0;
11030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11032         return ret_ref;
11033 }
11034
11035 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
11036 CHECK(!owner->result_ok);
11037         return DecodeError_clone(&*owner->contents.err);
11038 }
11039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11040         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
11041         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11042         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
11043         int64_t ret_ref = tag_ptr(ret_copy, true);
11044         return ret_ref;
11045 }
11046
11047 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11048         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
11049         ret.is_owned = false;
11050         return ret;
11051 }
11052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11053         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11054         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
11055         int64_t ret_ref = 0;
11056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11058         return ret_ref;
11059 }
11060
11061 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
11062 CHECK(!owner->result_ok);
11063         return DecodeError_clone(&*owner->contents.err);
11064 }
11065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11066         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
11067         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11068         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
11069         int64_t ret_ref = tag_ptr(ret_copy, true);
11070         return ret_ref;
11071 }
11072
11073 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11074         LDKQueryChannelRange ret = *owner->contents.result;
11075         ret.is_owned = false;
11076         return ret;
11077 }
11078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11079         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11080         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
11081         int64_t ret_ref = 0;
11082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11084         return ret_ref;
11085 }
11086
11087 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11088 CHECK(!owner->result_ok);
11089         return DecodeError_clone(&*owner->contents.err);
11090 }
11091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11092         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
11093         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11094         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
11095         int64_t ret_ref = tag_ptr(ret_copy, true);
11096         return ret_ref;
11097 }
11098
11099 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11100         LDKReplyChannelRange ret = *owner->contents.result;
11101         ret.is_owned = false;
11102         return ret;
11103 }
11104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11105         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11106         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
11107         int64_t ret_ref = 0;
11108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11110         return ret_ref;
11111 }
11112
11113 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
11114 CHECK(!owner->result_ok);
11115         return DecodeError_clone(&*owner->contents.err);
11116 }
11117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11118         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
11119         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11120         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
11121         int64_t ret_ref = tag_ptr(ret_copy, true);
11122         return ret_ref;
11123 }
11124
11125 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11126         LDKGossipTimestampFilter ret = *owner->contents.result;
11127         ret.is_owned = false;
11128         return ret;
11129 }
11130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11131         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11132         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
11133         int64_t ret_ref = 0;
11134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11136         return ret_ref;
11137 }
11138
11139 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
11140 CHECK(!owner->result_ok);
11141         return DecodeError_clone(&*owner->contents.err);
11142 }
11143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11144         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
11145         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11146         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
11147         int64_t ret_ref = tag_ptr(ret_copy, true);
11148         return ret_ref;
11149 }
11150
11151 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
11152         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
11153         for (size_t i = 0; i < ret.datalen; i++) {
11154                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
11155         }
11156         return ret;
11157 }
11158 static jclass LDKSignOrCreationError_SignError_class = NULL;
11159 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
11160 static jclass LDKSignOrCreationError_CreationError_class = NULL;
11161 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
11162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
11163         LDKSignOrCreationError_SignError_class =
11164                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
11165         CHECK(LDKSignOrCreationError_SignError_class != NULL);
11166         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
11167         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
11168         LDKSignOrCreationError_CreationError_class =
11169                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
11170         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
11171         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
11172         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
11173 }
11174 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11175         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
11176         switch(obj->tag) {
11177                 case LDKSignOrCreationError_SignError: {
11178                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
11179                 }
11180                 case LDKSignOrCreationError_CreationError: {
11181                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
11182                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
11183                 }
11184                 default: abort();
11185         }
11186 }
11187 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11188         LDKBolt11Invoice ret = *owner->contents.result;
11189         ret.is_owned = false;
11190         return ret;
11191 }
11192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11193         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11194         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
11195         int64_t ret_ref = 0;
11196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11198         return ret_ref;
11199 }
11200
11201 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
11202 CHECK(!owner->result_ok);
11203         return SignOrCreationError_clone(&*owner->contents.err);
11204 }
11205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11206         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
11207         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
11208         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
11209         int64_t ret_ref = tag_ptr(ret_copy, true);
11210         return ret_ref;
11211 }
11212
11213 static inline LDKCVec_FutureZ CVec_FutureZ_clone(const LDKCVec_FutureZ *orig) {
11214         LDKCVec_FutureZ ret = { .data = MALLOC(sizeof(LDKFuture) * orig->datalen, "LDKCVec_FutureZ clone bytes"), .datalen = orig->datalen };
11215         for (size_t i = 0; i < ret.datalen; i++) {
11216                 ret.data[i] = Future_clone(&orig->data[i]);
11217         }
11218         return ret;
11219 }
11220 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11221 CHECK(owner->result_ok);
11222         return OffersMessage_clone(&*owner->contents.result);
11223 }
11224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11225         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11226         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
11227         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
11228         int64_t ret_ref = tag_ptr(ret_copy, true);
11229         return ret_ref;
11230 }
11231
11232 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
11233 CHECK(!owner->result_ok);
11234         return DecodeError_clone(&*owner->contents.err);
11235 }
11236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11237         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
11238         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11239         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
11240         int64_t ret_ref = tag_ptr(ret_copy, true);
11241         return ret_ref;
11242 }
11243
11244 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
11245 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
11246 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
11247 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
11248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
11249         LDKCOption_HTLCClaimZ_Some_class =
11250                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
11251         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
11252         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
11253         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
11254         LDKCOption_HTLCClaimZ_None_class =
11255                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
11256         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
11257         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
11258         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
11259 }
11260 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11261         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
11262         switch(obj->tag) {
11263                 case LDKCOption_HTLCClaimZ_Some: {
11264                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
11265                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
11266                 }
11267                 case LDKCOption_HTLCClaimZ_None: {
11268                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
11269                 }
11270                 default: abort();
11271         }
11272 }
11273 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11274         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
11275         ret.is_owned = false;
11276         return ret;
11277 }
11278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11279         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11280         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
11281         int64_t ret_ref = 0;
11282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11284         return ret_ref;
11285 }
11286
11287 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
11288 CHECK(!owner->result_ok);
11289         return DecodeError_clone(&*owner->contents.err);
11290 }
11291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11292         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
11293         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11294         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
11295         int64_t ret_ref = tag_ptr(ret_copy, true);
11296         return ret_ref;
11297 }
11298
11299 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11300         LDKTxCreationKeys ret = *owner->contents.result;
11301         ret.is_owned = false;
11302         return ret;
11303 }
11304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11305         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11306         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
11307         int64_t ret_ref = 0;
11308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11310         return ret_ref;
11311 }
11312
11313 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
11314 CHECK(!owner->result_ok);
11315         return DecodeError_clone(&*owner->contents.err);
11316 }
11317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11318         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
11319         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11320         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
11321         int64_t ret_ref = tag_ptr(ret_copy, true);
11322         return ret_ref;
11323 }
11324
11325 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11326         LDKChannelPublicKeys ret = *owner->contents.result;
11327         ret.is_owned = false;
11328         return ret;
11329 }
11330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11331         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11332         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
11333         int64_t ret_ref = 0;
11334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11336         return ret_ref;
11337 }
11338
11339 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
11340 CHECK(!owner->result_ok);
11341         return DecodeError_clone(&*owner->contents.err);
11342 }
11343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11344         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
11345         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11346         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
11347         int64_t ret_ref = tag_ptr(ret_copy, true);
11348         return ret_ref;
11349 }
11350
11351 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11352         LDKHTLCOutputInCommitment ret = *owner->contents.result;
11353         ret.is_owned = false;
11354         return ret;
11355 }
11356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11357         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11358         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
11359         int64_t ret_ref = 0;
11360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11362         return ret_ref;
11363 }
11364
11365 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
11366 CHECK(!owner->result_ok);
11367         return DecodeError_clone(&*owner->contents.err);
11368 }
11369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11370         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
11371         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11372         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
11373         int64_t ret_ref = tag_ptr(ret_copy, true);
11374         return ret_ref;
11375 }
11376
11377 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11378         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
11379         ret.is_owned = false;
11380         return ret;
11381 }
11382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11383         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11384         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11385         int64_t ret_ref = 0;
11386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11388         return ret_ref;
11389 }
11390
11391 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11392 CHECK(!owner->result_ok);
11393         return DecodeError_clone(&*owner->contents.err);
11394 }
11395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11396         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11397         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11398         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11399         int64_t ret_ref = tag_ptr(ret_copy, true);
11400         return ret_ref;
11401 }
11402
11403 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11404         LDKChannelTransactionParameters ret = *owner->contents.result;
11405         ret.is_owned = false;
11406         return ret;
11407 }
11408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11409         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11410         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
11411         int64_t ret_ref = 0;
11412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11414         return ret_ref;
11415 }
11416
11417 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
11418 CHECK(!owner->result_ok);
11419         return DecodeError_clone(&*owner->contents.err);
11420 }
11421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11422         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
11423         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11424         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
11425         int64_t ret_ref = tag_ptr(ret_copy, true);
11426         return ret_ref;
11427 }
11428
11429 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11430         LDKHolderCommitmentTransaction ret = *owner->contents.result;
11431         ret.is_owned = false;
11432         return ret;
11433 }
11434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11435         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11436         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11437         int64_t ret_ref = 0;
11438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11440         return ret_ref;
11441 }
11442
11443 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11444 CHECK(!owner->result_ok);
11445         return DecodeError_clone(&*owner->contents.err);
11446 }
11447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11448         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11449         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11450         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11451         int64_t ret_ref = tag_ptr(ret_copy, true);
11452         return ret_ref;
11453 }
11454
11455 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11456         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
11457         ret.is_owned = false;
11458         return ret;
11459 }
11460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11461         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11462         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11463         int64_t ret_ref = 0;
11464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11466         return ret_ref;
11467 }
11468
11469 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11470 CHECK(!owner->result_ok);
11471         return DecodeError_clone(&*owner->contents.err);
11472 }
11473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11474         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11475         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11476         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11477         int64_t ret_ref = tag_ptr(ret_copy, true);
11478         return ret_ref;
11479 }
11480
11481 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11482         LDKTrustedClosingTransaction ret = *owner->contents.result;
11483         ret.is_owned = false;
11484         return ret;
11485 }
11486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11487         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11488         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
11489         int64_t ret_ref = 0;
11490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11492         return ret_ref;
11493 }
11494
11495 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
11496 CHECK(!owner->result_ok);
11497         return *owner->contents.err;
11498 }
11499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11500         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
11501         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
11502 }
11503
11504 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11505         LDKCommitmentTransaction ret = *owner->contents.result;
11506         ret.is_owned = false;
11507         return ret;
11508 }
11509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11510         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11511         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
11512         int64_t ret_ref = 0;
11513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11515         return ret_ref;
11516 }
11517
11518 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
11519 CHECK(!owner->result_ok);
11520         return DecodeError_clone(&*owner->contents.err);
11521 }
11522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11523         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
11524         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11525         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
11526         int64_t ret_ref = tag_ptr(ret_copy, true);
11527         return ret_ref;
11528 }
11529
11530 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
11531         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
11532         ret.is_owned = false;
11533         return ret;
11534 }
11535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11536         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
11537         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
11538         int64_t ret_ref = 0;
11539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11541         return ret_ref;
11542 }
11543
11544 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
11545 CHECK(!owner->result_ok);
11546         return *owner->contents.err;
11547 }
11548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11549         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
11550         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
11551 }
11552
11553 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
11554 CHECK(owner->result_ok);
11555         return *owner->contents.result;
11556 }
11557 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11558         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
11559         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
11560         jobjectArray ret_arr = NULL;
11561         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
11562         ;
11563         for (size_t i = 0; i < ret_var.datalen; i++) {
11564                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
11565                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
11566                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
11567         }
11568         
11569         return ret_arr;
11570 }
11571
11572 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
11573 CHECK(!owner->result_ok);
11574         return *owner->contents.err;
11575 }
11576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11577         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
11578         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
11579 }
11580
11581 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
11582         LDKShutdownScript ret = *owner->contents.result;
11583         ret.is_owned = false;
11584         return ret;
11585 }
11586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11587         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
11588         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
11589         int64_t ret_ref = 0;
11590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11592         return ret_ref;
11593 }
11594
11595 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
11596 CHECK(!owner->result_ok);
11597         return DecodeError_clone(&*owner->contents.err);
11598 }
11599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11600         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
11601         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11602         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
11603         int64_t ret_ref = tag_ptr(ret_copy, true);
11604         return ret_ref;
11605 }
11606
11607 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
11608         LDKShutdownScript ret = *owner->contents.result;
11609         ret.is_owned = false;
11610         return ret;
11611 }
11612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11613         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
11614         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
11615         int64_t ret_ref = 0;
11616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11618         return ret_ref;
11619 }
11620
11621 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
11622         LDKInvalidShutdownScript ret = *owner->contents.err;
11623         ret.is_owned = false;
11624         return ret;
11625 }
11626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11627         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
11628         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
11629         int64_t ret_ref = 0;
11630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11632         return ret_ref;
11633 }
11634
11635 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
11636 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
11637 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
11638 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
11639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
11640         LDKPaymentPurpose_InvoicePayment_class =
11641                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
11642         CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
11643         LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "(J[B)V");
11644         CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
11645         LDKPaymentPurpose_SpontaneousPayment_class =
11646                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
11647         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
11648         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
11649         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
11650 }
11651 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11652         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
11653         switch(obj->tag) {
11654                 case LDKPaymentPurpose_InvoicePayment: {
11655                         int64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
11656                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
11657                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
11658                         return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
11659                 }
11660                 case LDKPaymentPurpose_SpontaneousPayment: {
11661                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
11662                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
11663                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
11664                 }
11665                 default: abort();
11666         }
11667 }
11668 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
11669 CHECK(owner->result_ok);
11670         return PaymentPurpose_clone(&*owner->contents.result);
11671 }
11672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11673         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
11674         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
11675         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
11676         int64_t ret_ref = tag_ptr(ret_copy, true);
11677         return ret_ref;
11678 }
11679
11680 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
11681 CHECK(!owner->result_ok);
11682         return DecodeError_clone(&*owner->contents.err);
11683 }
11684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11685         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
11686         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11687         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
11688         int64_t ret_ref = tag_ptr(ret_copy, true);
11689         return ret_ref;
11690 }
11691
11692 static jclass LDKPathFailure_InitialSend_class = NULL;
11693 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
11694 static jclass LDKPathFailure_OnPath_class = NULL;
11695 static jmethodID LDKPathFailure_OnPath_meth = NULL;
11696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
11697         LDKPathFailure_InitialSend_class =
11698                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
11699         CHECK(LDKPathFailure_InitialSend_class != NULL);
11700         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
11701         CHECK(LDKPathFailure_InitialSend_meth != NULL);
11702         LDKPathFailure_OnPath_class =
11703                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
11704         CHECK(LDKPathFailure_OnPath_class != NULL);
11705         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
11706         CHECK(LDKPathFailure_OnPath_meth != NULL);
11707 }
11708 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11709         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
11710         switch(obj->tag) {
11711                 case LDKPathFailure_InitialSend: {
11712                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
11713                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
11714                 }
11715                 case LDKPathFailure_OnPath: {
11716                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
11717                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
11718                 }
11719                 default: abort();
11720         }
11721 }
11722 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
11723 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
11724 static jclass LDKCOption_PathFailureZ_None_class = NULL;
11725 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
11726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
11727         LDKCOption_PathFailureZ_Some_class =
11728                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
11729         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
11730         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
11731         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
11732         LDKCOption_PathFailureZ_None_class =
11733                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
11734         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
11735         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
11736         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
11737 }
11738 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11739         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
11740         switch(obj->tag) {
11741                 case LDKCOption_PathFailureZ_Some: {
11742                         int64_t some_ref = tag_ptr(&obj->some, false);
11743                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
11744                 }
11745                 case LDKCOption_PathFailureZ_None: {
11746                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
11747                 }
11748                 default: abort();
11749         }
11750 }
11751 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
11752 CHECK(owner->result_ok);
11753         return COption_PathFailureZ_clone(&*owner->contents.result);
11754 }
11755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11756         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
11757         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
11758         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
11759         int64_t ret_ref = tag_ptr(ret_copy, true);
11760         return ret_ref;
11761 }
11762
11763 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
11764 CHECK(!owner->result_ok);
11765         return DecodeError_clone(&*owner->contents.err);
11766 }
11767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11768         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
11769         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11770         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
11771         int64_t ret_ref = tag_ptr(ret_copy, true);
11772         return ret_ref;
11773 }
11774
11775 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
11776 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
11777 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
11778 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
11779 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
11780 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
11781 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
11782 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
11783 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
11784 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
11785 static jclass LDKClosureReason_ProcessingError_class = NULL;
11786 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
11787 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
11788 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
11789 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
11790 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
11791 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
11792 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
11793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
11794         LDKClosureReason_CounterpartyForceClosed_class =
11795                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
11796         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
11797         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
11798         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
11799         LDKClosureReason_HolderForceClosed_class =
11800                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
11801         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
11802         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
11803         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
11804         LDKClosureReason_CooperativeClosure_class =
11805                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
11806         CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
11807         LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
11808         CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
11809         LDKClosureReason_CommitmentTxConfirmed_class =
11810                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
11811         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
11812         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
11813         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
11814         LDKClosureReason_FundingTimedOut_class =
11815                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
11816         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
11817         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
11818         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
11819         LDKClosureReason_ProcessingError_class =
11820                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
11821         CHECK(LDKClosureReason_ProcessingError_class != NULL);
11822         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
11823         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
11824         LDKClosureReason_DisconnectedPeer_class =
11825                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
11826         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
11827         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
11828         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
11829         LDKClosureReason_OutdatedChannelManager_class =
11830                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
11831         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
11832         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
11833         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
11834         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
11835                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
11836         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
11837         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
11838         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
11839 }
11840 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11841         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
11842         switch(obj->tag) {
11843                 case LDKClosureReason_CounterpartyForceClosed: {
11844                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
11845                         int64_t peer_msg_ref = 0;
11846                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
11847                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
11848                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
11849                 }
11850                 case LDKClosureReason_HolderForceClosed: {
11851                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
11852                 }
11853                 case LDKClosureReason_CooperativeClosure: {
11854                         return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
11855                 }
11856                 case LDKClosureReason_CommitmentTxConfirmed: {
11857                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
11858                 }
11859                 case LDKClosureReason_FundingTimedOut: {
11860                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
11861                 }
11862                 case LDKClosureReason_ProcessingError: {
11863                         LDKStr err_str = obj->processing_error.err;
11864                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
11865                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
11866                 }
11867                 case LDKClosureReason_DisconnectedPeer: {
11868                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
11869                 }
11870                 case LDKClosureReason_OutdatedChannelManager: {
11871                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
11872                 }
11873                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
11874                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
11875                 }
11876                 default: abort();
11877         }
11878 }
11879 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
11880 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
11881 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
11882 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
11883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
11884         LDKCOption_ClosureReasonZ_Some_class =
11885                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
11886         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
11887         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
11888         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
11889         LDKCOption_ClosureReasonZ_None_class =
11890                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
11891         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
11892         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
11893         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
11894 }
11895 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11896         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
11897         switch(obj->tag) {
11898                 case LDKCOption_ClosureReasonZ_Some: {
11899                         int64_t some_ref = tag_ptr(&obj->some, false);
11900                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
11901                 }
11902                 case LDKCOption_ClosureReasonZ_None: {
11903                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
11904                 }
11905                 default: abort();
11906         }
11907 }
11908 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11909 CHECK(owner->result_ok);
11910         return COption_ClosureReasonZ_clone(&*owner->contents.result);
11911 }
11912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11913         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11914         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
11915         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
11916         int64_t ret_ref = tag_ptr(ret_copy, true);
11917         return ret_ref;
11918 }
11919
11920 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
11921 CHECK(!owner->result_ok);
11922         return DecodeError_clone(&*owner->contents.err);
11923 }
11924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11925         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
11926         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11927         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
11928         int64_t ret_ref = tag_ptr(ret_copy, true);
11929         return ret_ref;
11930 }
11931
11932 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
11933 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
11934 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
11935 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
11936 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
11937 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
11938 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
11939 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
11940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
11941         LDKHTLCDestination_NextHopChannel_class =
11942                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
11943         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
11944         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
11945         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
11946         LDKHTLCDestination_UnknownNextHop_class =
11947                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
11948         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
11949         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
11950         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
11951         LDKHTLCDestination_InvalidForward_class =
11952                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
11953         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
11954         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
11955         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
11956         LDKHTLCDestination_FailedPayment_class =
11957                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
11958         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
11959         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
11960         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
11961 }
11962 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11963         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
11964         switch(obj->tag) {
11965                 case LDKHTLCDestination_NextHopChannel: {
11966                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
11967                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
11968                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
11969                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
11970                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
11971                 }
11972                 case LDKHTLCDestination_UnknownNextHop: {
11973                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
11974                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
11975                 }
11976                 case LDKHTLCDestination_InvalidForward: {
11977                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
11978                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
11979                 }
11980                 case LDKHTLCDestination_FailedPayment: {
11981                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11982                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
11983                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
11984                 }
11985                 default: abort();
11986         }
11987 }
11988 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
11989 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
11990 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
11991 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
11992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
11993         LDKCOption_HTLCDestinationZ_Some_class =
11994                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
11995         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
11996         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
11997         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
11998         LDKCOption_HTLCDestinationZ_None_class =
11999                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
12000         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
12001         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
12002         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
12003 }
12004 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12005         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
12006         switch(obj->tag) {
12007                 case LDKCOption_HTLCDestinationZ_Some: {
12008                         int64_t some_ref = tag_ptr(&obj->some, false);
12009                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
12010                 }
12011                 case LDKCOption_HTLCDestinationZ_None: {
12012                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
12013                 }
12014                 default: abort();
12015         }
12016 }
12017 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12018 CHECK(owner->result_ok);
12019         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
12020 }
12021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12022         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12023         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
12024         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
12025         int64_t ret_ref = tag_ptr(ret_copy, true);
12026         return ret_ref;
12027 }
12028
12029 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
12030 CHECK(!owner->result_ok);
12031         return DecodeError_clone(&*owner->contents.err);
12032 }
12033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12034         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
12035         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12036         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
12037         int64_t ret_ref = tag_ptr(ret_copy, true);
12038         return ret_ref;
12039 }
12040
12041 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12042 CHECK(owner->result_ok);
12043         return PaymentFailureReason_clone(&*owner->contents.result);
12044 }
12045 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12046         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12047         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
12048         return ret_conv;
12049 }
12050
12051 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
12052 CHECK(!owner->result_ok);
12053         return DecodeError_clone(&*owner->contents.err);
12054 }
12055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12056         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
12057         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12058         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
12059         int64_t ret_ref = tag_ptr(ret_copy, true);
12060         return ret_ref;
12061 }
12062
12063 static jclass LDKCOption_u128Z_Some_class = NULL;
12064 static jmethodID LDKCOption_u128Z_Some_meth = NULL;
12065 static jclass LDKCOption_u128Z_None_class = NULL;
12066 static jmethodID LDKCOption_u128Z_None_meth = NULL;
12067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u128Z_init (JNIEnv *env, jclass clz) {
12068         LDKCOption_u128Z_Some_class =
12069                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u128Z$Some"));
12070         CHECK(LDKCOption_u128Z_Some_class != NULL);
12071         LDKCOption_u128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u128Z_Some_class, "<init>", "([B)V");
12072         CHECK(LDKCOption_u128Z_Some_meth != NULL);
12073         LDKCOption_u128Z_None_class =
12074                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u128Z$None"));
12075         CHECK(LDKCOption_u128Z_None_class != NULL);
12076         LDKCOption_u128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u128Z_None_class, "<init>", "()V");
12077         CHECK(LDKCOption_u128Z_None_meth != NULL);
12078 }
12079 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12080         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
12081         switch(obj->tag) {
12082                 case LDKCOption_u128Z_Some: {
12083                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
12084                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
12085                         return (*env)->NewObject(env, LDKCOption_u128Z_Some_class, LDKCOption_u128Z_Some_meth, some_arr);
12086                 }
12087                 case LDKCOption_u128Z_None: {
12088                         return (*env)->NewObject(env, LDKCOption_u128Z_None_class, LDKCOption_u128Z_None_meth);
12089                 }
12090                 default: abort();
12091         }
12092 }
12093 static jclass LDKCOption_PaymentIdZ_Some_class = NULL;
12094 static jmethodID LDKCOption_PaymentIdZ_Some_meth = NULL;
12095 static jclass LDKCOption_PaymentIdZ_None_class = NULL;
12096 static jmethodID LDKCOption_PaymentIdZ_None_meth = NULL;
12097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentIdZ_init (JNIEnv *env, jclass clz) {
12098         LDKCOption_PaymentIdZ_Some_class =
12099                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentIdZ$Some"));
12100         CHECK(LDKCOption_PaymentIdZ_Some_class != NULL);
12101         LDKCOption_PaymentIdZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentIdZ_Some_class, "<init>", "([B)V");
12102         CHECK(LDKCOption_PaymentIdZ_Some_meth != NULL);
12103         LDKCOption_PaymentIdZ_None_class =
12104                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentIdZ$None"));
12105         CHECK(LDKCOption_PaymentIdZ_None_class != NULL);
12106         LDKCOption_PaymentIdZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentIdZ_None_class, "<init>", "()V");
12107         CHECK(LDKCOption_PaymentIdZ_None_meth != NULL);
12108 }
12109 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentIdZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12110         LDKCOption_PaymentIdZ *obj = (LDKCOption_PaymentIdZ*)untag_ptr(ptr);
12111         switch(obj->tag) {
12112                 case LDKCOption_PaymentIdZ_Some: {
12113                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
12114                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
12115                         return (*env)->NewObject(env, LDKCOption_PaymentIdZ_Some_class, LDKCOption_PaymentIdZ_Some_meth, some_arr);
12116                 }
12117                 case LDKCOption_PaymentIdZ_None: {
12118                         return (*env)->NewObject(env, LDKCOption_PaymentIdZ_None_class, LDKCOption_PaymentIdZ_None_meth);
12119                 }
12120                 default: abort();
12121         }
12122 }
12123 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
12124 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
12125 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
12126 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
12127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
12128         LDKCOption_PaymentFailureReasonZ_Some_class =
12129                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
12130         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
12131         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
12132         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
12133         LDKCOption_PaymentFailureReasonZ_None_class =
12134                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
12135         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
12136         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
12137         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
12138 }
12139 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12140         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
12141         switch(obj->tag) {
12142                 case LDKCOption_PaymentFailureReasonZ_Some: {
12143                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
12144                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
12145                 }
12146                 case LDKCOption_PaymentFailureReasonZ_None: {
12147                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
12148                 }
12149                 default: abort();
12150         }
12151 }
12152 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
12153 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
12154 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
12155 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
12156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
12157         LDKBumpTransactionEvent_ChannelClose_class =
12158                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
12159         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
12160         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "([BI[BJJ[J)V");
12161         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
12162         LDKBumpTransactionEvent_HTLCResolution_class =
12163                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
12164         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
12165         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "([BI[JI)V");
12166         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
12167 }
12168 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12169         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
12170         switch(obj->tag) {
12171                 case LDKBumpTransactionEvent_ChannelClose: {
12172                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12173                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
12174                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
12175                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
12176                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
12177                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
12178                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
12179                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
12180                         int64_t anchor_descriptor_ref = 0;
12181                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
12182                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
12183                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
12184                         int64_tArray pending_htlcs_arr = NULL;
12185                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
12186                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
12187                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
12188                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
12189                                 int64_t pending_htlcs_conv_24_ref = 0;
12190                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
12191                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
12192                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
12193                         }
12194                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
12195                         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);
12196                 }
12197                 case LDKBumpTransactionEvent_HTLCResolution: {
12198                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
12199                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
12200                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
12201                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
12202                         int64_tArray htlc_descriptors_arr = NULL;
12203                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
12204                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
12205                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
12206                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
12207                                 int64_t htlc_descriptors_conv_16_ref = 0;
12208                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
12209                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
12210                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
12211                         }
12212                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
12213                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
12214                         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);
12215                 }
12216                 default: abort();
12217         }
12218 }
12219 static jclass LDKEvent_FundingGenerationReady_class = NULL;
12220 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
12221 static jclass LDKEvent_PaymentClaimable_class = NULL;
12222 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
12223 static jclass LDKEvent_PaymentClaimed_class = NULL;
12224 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
12225 static jclass LDKEvent_PaymentSent_class = NULL;
12226 static jmethodID LDKEvent_PaymentSent_meth = NULL;
12227 static jclass LDKEvent_PaymentFailed_class = NULL;
12228 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
12229 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
12230 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
12231 static jclass LDKEvent_PaymentPathFailed_class = NULL;
12232 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
12233 static jclass LDKEvent_ProbeSuccessful_class = NULL;
12234 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
12235 static jclass LDKEvent_ProbeFailed_class = NULL;
12236 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
12237 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
12238 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
12239 static jclass LDKEvent_HTLCIntercepted_class = NULL;
12240 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
12241 static jclass LDKEvent_SpendableOutputs_class = NULL;
12242 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
12243 static jclass LDKEvent_PaymentForwarded_class = NULL;
12244 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
12245 static jclass LDKEvent_ChannelPending_class = NULL;
12246 static jmethodID LDKEvent_ChannelPending_meth = NULL;
12247 static jclass LDKEvent_ChannelReady_class = NULL;
12248 static jmethodID LDKEvent_ChannelReady_meth = NULL;
12249 static jclass LDKEvent_ChannelClosed_class = NULL;
12250 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
12251 static jclass LDKEvent_DiscardFunding_class = NULL;
12252 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
12253 static jclass LDKEvent_OpenChannelRequest_class = NULL;
12254 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
12255 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
12256 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
12257 static jclass LDKEvent_BumpTransaction_class = NULL;
12258 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
12259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
12260         LDKEvent_FundingGenerationReady_class =
12261                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
12262         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
12263         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([B[BJ[B[B)V");
12264         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
12265         LDKEvent_PaymentClaimable_class =
12266                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
12267         CHECK(LDKEvent_PaymentClaimable_class != NULL);
12268         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJ[BJJ)V");
12269         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
12270         LDKEvent_PaymentClaimed_class =
12271                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
12272         CHECK(LDKEvent_PaymentClaimed_class != NULL);
12273         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ)V");
12274         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
12275         LDKEvent_PaymentSent_class =
12276                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
12277         CHECK(LDKEvent_PaymentSent_class != NULL);
12278         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
12279         CHECK(LDKEvent_PaymentSent_meth != NULL);
12280         LDKEvent_PaymentFailed_class =
12281                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
12282         CHECK(LDKEvent_PaymentFailed_class != NULL);
12283         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
12284         CHECK(LDKEvent_PaymentFailed_meth != NULL);
12285         LDKEvent_PaymentPathSuccessful_class =
12286                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
12287         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
12288         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
12289         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
12290         LDKEvent_PaymentPathFailed_class =
12291                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
12292         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
12293         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
12294         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
12295         LDKEvent_ProbeSuccessful_class =
12296                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
12297         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
12298         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
12299         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
12300         LDKEvent_ProbeFailed_class =
12301                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
12302         CHECK(LDKEvent_ProbeFailed_class != NULL);
12303         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
12304         CHECK(LDKEvent_ProbeFailed_meth != NULL);
12305         LDKEvent_PendingHTLCsForwardable_class =
12306                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
12307         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
12308         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
12309         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
12310         LDKEvent_HTLCIntercepted_class =
12311                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
12312         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
12313         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
12314         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
12315         LDKEvent_SpendableOutputs_class =
12316                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
12317         CHECK(LDKEvent_SpendableOutputs_class != NULL);
12318         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
12319         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
12320         LDKEvent_PaymentForwarded_class =
12321                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
12322         CHECK(LDKEvent_PaymentForwarded_class != NULL);
12323         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "([B[BJZJ)V");
12324         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
12325         LDKEvent_ChannelPending_class =
12326                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
12327         CHECK(LDKEvent_ChannelPending_class != NULL);
12328         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "([B[B[B[BJ)V");
12329         CHECK(LDKEvent_ChannelPending_meth != NULL);
12330         LDKEvent_ChannelReady_class =
12331                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
12332         CHECK(LDKEvent_ChannelReady_class != NULL);
12333         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "([B[B[BJ)V");
12334         CHECK(LDKEvent_ChannelReady_meth != NULL);
12335         LDKEvent_ChannelClosed_class =
12336                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
12337         CHECK(LDKEvent_ChannelClosed_class != NULL);
12338         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([B[BJ)V");
12339         CHECK(LDKEvent_ChannelClosed_meth != NULL);
12340         LDKEvent_DiscardFunding_class =
12341                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
12342         CHECK(LDKEvent_DiscardFunding_class != NULL);
12343         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
12344         CHECK(LDKEvent_DiscardFunding_meth != NULL);
12345         LDKEvent_OpenChannelRequest_class =
12346                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
12347         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
12348         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
12349         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
12350         LDKEvent_HTLCHandlingFailed_class =
12351                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
12352         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
12353         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "([BJ)V");
12354         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
12355         LDKEvent_BumpTransaction_class =
12356                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
12357         CHECK(LDKEvent_BumpTransaction_class != NULL);
12358         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
12359         CHECK(LDKEvent_BumpTransaction_meth != NULL);
12360 }
12361 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12362         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
12363         switch(obj->tag) {
12364                 case LDKEvent_FundingGenerationReady: {
12365                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
12366                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
12367                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12368                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
12369                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
12370                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
12371                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
12372                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
12373                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12374                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
12375                         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);
12376                 }
12377                 case LDKEvent_PaymentClaimable: {
12378                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
12379                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
12380                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12381                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
12382                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
12383                         int64_t onion_fields_ref = 0;
12384                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
12385                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
12386                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
12387                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
12388                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
12389                         int8_tArray via_channel_id_arr = (*env)->NewByteArray(env, 32);
12390                         (*env)->SetByteArrayRegion(env, via_channel_id_arr, 0, 32, obj->payment_claimable.via_channel_id.data);
12391                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
12392                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
12393                         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);
12394                 }
12395                 case LDKEvent_PaymentClaimed: {
12396                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
12397                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
12398                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12399                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
12400                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
12401                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
12402                         return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, receiver_node_id_arr, payment_hash_arr, amount_msat_conv, purpose_ref);
12403                 }
12404                 case LDKEvent_PaymentSent: {
12405                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
12406                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
12407                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
12408                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12409                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
12410                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
12411                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
12412                 }
12413                 case LDKEvent_PaymentFailed: {
12414                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12415                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
12416                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12417                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
12418                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
12419                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
12420                 }
12421                 case LDKEvent_PaymentPathSuccessful: {
12422                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12423                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
12424                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
12425                         LDKPath path_var = obj->payment_path_successful.path;
12426                         int64_t path_ref = 0;
12427                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12428                         path_ref = tag_ptr(path_var.inner, false);
12429                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
12430                 }
12431                 case LDKEvent_PaymentPathFailed: {
12432                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
12433                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12434                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
12435                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
12436                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
12437                         LDKPath path_var = obj->payment_path_failed.path;
12438                         int64_t path_ref = 0;
12439                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12440                         path_ref = tag_ptr(path_var.inner, false);
12441                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
12442                         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);
12443                 }
12444                 case LDKEvent_ProbeSuccessful: {
12445                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12446                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
12447                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12448                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
12449                         LDKPath path_var = obj->probe_successful.path;
12450                         int64_t path_ref = 0;
12451                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12452                         path_ref = tag_ptr(path_var.inner, false);
12453                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
12454                 }
12455                 case LDKEvent_ProbeFailed: {
12456                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12457                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
12458                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12459                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
12460                         LDKPath path_var = obj->probe_failed.path;
12461                         int64_t path_ref = 0;
12462                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
12463                         path_ref = tag_ptr(path_var.inner, false);
12464                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
12465                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
12466                 }
12467                 case LDKEvent_PendingHTLCsForwardable: {
12468                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
12469                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
12470                 }
12471                 case LDKEvent_HTLCIntercepted: {
12472                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
12473                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
12474                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
12475                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12476                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
12477                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
12478                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
12479                         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);
12480                 }
12481                 case LDKEvent_SpendableOutputs: {
12482                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
12483                         int64_tArray outputs_arr = NULL;
12484                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
12485                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
12486                         for (size_t b = 0; b < outputs_var.datalen; b++) {
12487                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
12488                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
12489                         }
12490                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
12491                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
12492                 }
12493                 case LDKEvent_PaymentForwarded: {
12494                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
12495                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->payment_forwarded.prev_channel_id.data);
12496                         int8_tArray next_channel_id_arr = (*env)->NewByteArray(env, 32);
12497                         (*env)->SetByteArrayRegion(env, next_channel_id_arr, 0, 32, obj->payment_forwarded.next_channel_id.data);
12498                         int64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
12499                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
12500                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
12501                         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);
12502                 }
12503                 case LDKEvent_ChannelPending: {
12504                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12505                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_pending.channel_id.data);
12506                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12507                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
12508                         int8_tArray former_temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
12509                         (*env)->SetByteArrayRegion(env, former_temporary_channel_id_arr, 0, 32, obj->channel_pending.former_temporary_channel_id.data);
12510                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12511                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
12512                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
12513                         int64_t funding_txo_ref = 0;
12514                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
12515                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
12516                         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);
12517                 }
12518                 case LDKEvent_ChannelReady: {
12519                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12520                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_ready.channel_id.data);
12521                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12522                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
12523                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12524                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
12525                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
12526                         int64_t channel_type_ref = 0;
12527                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12528                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12529                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_arr, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
12530                 }
12531                 case LDKEvent_ChannelClosed: {
12532                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12533                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
12534                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
12535                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
12536                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
12537                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_arr, reason_ref);
12538                 }
12539                 case LDKEvent_DiscardFunding: {
12540                         int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
12541                         (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
12542                         LDKTransaction transaction_var = obj->discard_funding.transaction;
12543                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
12544                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
12545                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
12546                 }
12547                 case LDKEvent_OpenChannelRequest: {
12548                         int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
12549                         (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
12550                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
12551                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
12552                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
12553                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
12554                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
12555                         int64_t channel_type_ref = 0;
12556                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
12557                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
12558                         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);
12559                 }
12560                 case LDKEvent_HTLCHandlingFailed: {
12561                         int8_tArray prev_channel_id_arr = (*env)->NewByteArray(env, 32);
12562                         (*env)->SetByteArrayRegion(env, prev_channel_id_arr, 0, 32, obj->htlc_handling_failed.prev_channel_id.data);
12563                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
12564                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_arr, failed_next_destination_ref);
12565                 }
12566                 case LDKEvent_BumpTransaction: {
12567                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
12568                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
12569                 }
12570                 default: abort();
12571         }
12572 }
12573 static jclass LDKCOption_EventZ_Some_class = NULL;
12574 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
12575 static jclass LDKCOption_EventZ_None_class = NULL;
12576 static jmethodID LDKCOption_EventZ_None_meth = NULL;
12577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
12578         LDKCOption_EventZ_Some_class =
12579                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
12580         CHECK(LDKCOption_EventZ_Some_class != NULL);
12581         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
12582         CHECK(LDKCOption_EventZ_Some_meth != NULL);
12583         LDKCOption_EventZ_None_class =
12584                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
12585         CHECK(LDKCOption_EventZ_None_class != NULL);
12586         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
12587         CHECK(LDKCOption_EventZ_None_meth != NULL);
12588 }
12589 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12590         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
12591         switch(obj->tag) {
12592                 case LDKCOption_EventZ_Some: {
12593                         int64_t some_ref = tag_ptr(&obj->some, false);
12594                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
12595                 }
12596                 case LDKCOption_EventZ_None: {
12597                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
12598                 }
12599                 default: abort();
12600         }
12601 }
12602 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
12603 CHECK(owner->result_ok);
12604         return COption_EventZ_clone(&*owner->contents.result);
12605 }
12606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12607         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
12608         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
12609         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
12610         int64_t ret_ref = tag_ptr(ret_copy, true);
12611         return ret_ref;
12612 }
12613
12614 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
12615 CHECK(!owner->result_ok);
12616         return DecodeError_clone(&*owner->contents.err);
12617 }
12618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12619         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
12620         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12621         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
12622         int64_t ret_ref = tag_ptr(ret_copy, true);
12623         return ret_ref;
12624 }
12625
12626 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
12627         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
12628         for (size_t i = 0; i < ret.datalen; i++) {
12629                 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
12630         }
12631         return ret;
12632 }
12633 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
12634 CHECK(owner->result_ok);
12635         return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
12636 }
12637 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12638         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
12639         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
12640         int64_tArray ret_arr = NULL;
12641         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12642         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12643         for (size_t j = 0; j < ret_var.datalen; j++) {
12644                 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
12645                 *ret_conv_35_conv = ret_var.data[j];
12646                 ret_arr_ptr[j] = tag_ptr(ret_conv_35_conv, true);
12647         }
12648         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12649         FREE(ret_var.data);
12650         return ret_arr;
12651 }
12652
12653 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
12654 CHECK(!owner->result_ok);
12655         return *owner->contents.err;
12656 }
12657 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12658         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(owner);
12659         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
12660         return ret_conv;
12661 }
12662
12663 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
12664 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
12665 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
12666 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
12667 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
12668 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
12669 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
12670 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
12671 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
12672 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
12673 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
12674 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
12675 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
12676 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
12677 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
12678 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
12679 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
12680 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
12681 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
12682 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
12683 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
12684 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
12685 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
12686 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
12687 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
12688 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
12689 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
12690 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
12691 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
12692 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
12693 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
12694 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
12695 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
12696 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
12697 static jclass LDKBolt11ParseError_Skip_class = NULL;
12698 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
12699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
12700         LDKBolt11ParseError_Bech32Error_class =
12701                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
12702         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
12703         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
12704         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
12705         LDKBolt11ParseError_ParseAmountError_class =
12706                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
12707         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
12708         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
12709         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
12710         LDKBolt11ParseError_MalformedSignature_class =
12711                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
12712         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
12713         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
12714         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
12715         LDKBolt11ParseError_BadPrefix_class =
12716                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
12717         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
12718         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
12719         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
12720         LDKBolt11ParseError_UnknownCurrency_class =
12721                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
12722         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
12723         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
12724         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
12725         LDKBolt11ParseError_UnknownSiPrefix_class =
12726                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
12727         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
12728         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
12729         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
12730         LDKBolt11ParseError_MalformedHRP_class =
12731                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
12732         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
12733         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
12734         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
12735         LDKBolt11ParseError_TooShortDataPart_class =
12736                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
12737         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
12738         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
12739         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
12740         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
12741                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
12742         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
12743         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
12744         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
12745         LDKBolt11ParseError_DescriptionDecodeError_class =
12746                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
12747         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
12748         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
12749         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
12750         LDKBolt11ParseError_PaddingError_class =
12751                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
12752         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
12753         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
12754         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
12755         LDKBolt11ParseError_IntegerOverflowError_class =
12756                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
12757         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
12758         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
12759         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
12760         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
12761                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
12762         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
12763         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
12764         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
12765         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
12766                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
12767         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
12768         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
12769         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
12770         LDKBolt11ParseError_InvalidScriptHashLength_class =
12771                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
12772         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
12773         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
12774         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
12775         LDKBolt11ParseError_InvalidRecoveryId_class =
12776                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
12777         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
12778         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
12779         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
12780         LDKBolt11ParseError_InvalidSliceLength_class =
12781                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
12782         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
12783         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
12784         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
12785         LDKBolt11ParseError_Skip_class =
12786                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
12787         CHECK(LDKBolt11ParseError_Skip_class != NULL);
12788         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
12789         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
12790 }
12791 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12792         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
12793         switch(obj->tag) {
12794                 case LDKBolt11ParseError_Bech32Error: {
12795                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
12796                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
12797                 }
12798                 case LDKBolt11ParseError_ParseAmountError: {
12799                         /*obj->parse_amount_error*/
12800                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
12801                 }
12802                 case LDKBolt11ParseError_MalformedSignature: {
12803                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
12804                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
12805                 }
12806                 case LDKBolt11ParseError_BadPrefix: {
12807                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
12808                 }
12809                 case LDKBolt11ParseError_UnknownCurrency: {
12810                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
12811                 }
12812                 case LDKBolt11ParseError_UnknownSiPrefix: {
12813                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
12814                 }
12815                 case LDKBolt11ParseError_MalformedHRP: {
12816                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
12817                 }
12818                 case LDKBolt11ParseError_TooShortDataPart: {
12819                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
12820                 }
12821                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
12822                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
12823                 }
12824                 case LDKBolt11ParseError_DescriptionDecodeError: {
12825                         /*obj->description_decode_error*/
12826                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
12827                 }
12828                 case LDKBolt11ParseError_PaddingError: {
12829                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
12830                 }
12831                 case LDKBolt11ParseError_IntegerOverflowError: {
12832                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
12833                 }
12834                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
12835                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
12836                 }
12837                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
12838                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
12839                 }
12840                 case LDKBolt11ParseError_InvalidScriptHashLength: {
12841                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
12842                 }
12843                 case LDKBolt11ParseError_InvalidRecoveryId: {
12844                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
12845                 }
12846                 case LDKBolt11ParseError_InvalidSliceLength: {
12847                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
12848                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
12849                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
12850                 }
12851                 case LDKBolt11ParseError_Skip: {
12852                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
12853                 }
12854                 default: abort();
12855         }
12856 }
12857 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12858 CHECK(owner->result_ok);
12859         return SiPrefix_clone(&*owner->contents.result);
12860 }
12861 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12862         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12863         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
12864         return ret_conv;
12865 }
12866
12867 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
12868 CHECK(!owner->result_ok);
12869         return Bolt11ParseError_clone(&*owner->contents.err);
12870 }
12871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12872         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
12873         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12874         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
12875         int64_t ret_ref = tag_ptr(ret_copy, true);
12876         return ret_ref;
12877 }
12878
12879 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
12880 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
12881 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
12882 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
12883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
12884         LDKParseOrSemanticError_ParseError_class =
12885                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
12886         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
12887         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
12888         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
12889         LDKParseOrSemanticError_SemanticError_class =
12890                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
12891         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
12892         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
12893         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
12894 }
12895 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12896         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
12897         switch(obj->tag) {
12898                 case LDKParseOrSemanticError_ParseError: {
12899                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
12900                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
12901                 }
12902                 case LDKParseOrSemanticError_SemanticError: {
12903                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
12904                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
12905                 }
12906                 default: abort();
12907         }
12908 }
12909 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12910         LDKBolt11Invoice ret = *owner->contents.result;
12911         ret.is_owned = false;
12912         return ret;
12913 }
12914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12915         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12916         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
12917         int64_t ret_ref = 0;
12918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12920         return ret_ref;
12921 }
12922
12923 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
12924 CHECK(!owner->result_ok);
12925         return ParseOrSemanticError_clone(&*owner->contents.err);
12926 }
12927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12928         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
12929         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
12930         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
12931         int64_t ret_ref = tag_ptr(ret_copy, true);
12932         return ret_ref;
12933 }
12934
12935 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12936         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
12937         ret.is_owned = false;
12938         return ret;
12939 }
12940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12941         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12942         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
12943         int64_t ret_ref = 0;
12944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12946         return ret_ref;
12947 }
12948
12949 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
12950 CHECK(!owner->result_ok);
12951         return Bolt11ParseError_clone(&*owner->contents.err);
12952 }
12953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12954         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
12955         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
12956         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
12957         int64_t ret_ref = tag_ptr(ret_copy, true);
12958         return ret_ref;
12959 }
12960
12961 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12962         LDKRawBolt11Invoice ret = owner->a;
12963         ret.is_owned = false;
12964         return ret;
12965 }
12966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
12967         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12968         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
12969         int64_t ret_ref = 0;
12970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12972         return ret_ref;
12973 }
12974
12975 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12976         return ThirtyTwoBytes_clone(&owner->b);
12977 }
12978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
12979         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12980         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12981         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
12982         return ret_arr;
12983 }
12984
12985 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
12986         LDKBolt11InvoiceSignature ret = owner->c;
12987         ret.is_owned = false;
12988         return ret;
12989 }
12990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
12991         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
12992         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
12993         int64_t ret_ref = 0;
12994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12996         return ret_ref;
12997 }
12998
12999 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
13000         LDKPayeePubKey ret = *owner->contents.result;
13001         ret.is_owned = false;
13002         return ret;
13003 }
13004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13005         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
13006         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
13007         int64_t ret_ref = 0;
13008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13010         return ret_ref;
13011 }
13012
13013 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
13014 CHECK(!owner->result_ok);
13015         return *owner->contents.err;
13016 }
13017 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13018         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
13019         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
13020         return ret_conv;
13021 }
13022
13023 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
13024         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
13025         for (size_t i = 0; i < ret.datalen; i++) {
13026                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
13027         }
13028         return ret;
13029 }
13030 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13031         LDKPositiveTimestamp ret = *owner->contents.result;
13032         ret.is_owned = false;
13033         return ret;
13034 }
13035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13036         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13037         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
13038         int64_t ret_ref = 0;
13039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13041         return ret_ref;
13042 }
13043
13044 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
13045 CHECK(!owner->result_ok);
13046         return CreationError_clone(&*owner->contents.err);
13047 }
13048 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13049         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
13050         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
13051         return ret_conv;
13052 }
13053
13054 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13055 CHECK(owner->result_ok);
13056         return *owner->contents.result;
13057 }
13058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13059         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13060         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
13061 }
13062
13063 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
13064 CHECK(!owner->result_ok);
13065         return Bolt11SemanticError_clone(&*owner->contents.err);
13066 }
13067 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13068         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
13069         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
13070         return ret_conv;
13071 }
13072
13073 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13074         LDKBolt11Invoice ret = *owner->contents.result;
13075         ret.is_owned = false;
13076         return ret;
13077 }
13078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13079         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13080         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
13081         int64_t ret_ref = 0;
13082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13084         return ret_ref;
13085 }
13086
13087 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
13088 CHECK(!owner->result_ok);
13089         return Bolt11SemanticError_clone(&*owner->contents.err);
13090 }
13091 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13092         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
13093         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
13094         return ret_conv;
13095 }
13096
13097 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13098         LDKDescription ret = *owner->contents.result;
13099         ret.is_owned = false;
13100         return ret;
13101 }
13102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13103         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13104         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
13105         int64_t ret_ref = 0;
13106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13108         return ret_ref;
13109 }
13110
13111 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
13112 CHECK(!owner->result_ok);
13113         return CreationError_clone(&*owner->contents.err);
13114 }
13115 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13116         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
13117         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
13118         return ret_conv;
13119 }
13120
13121 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13122         LDKPrivateRoute ret = *owner->contents.result;
13123         ret.is_owned = false;
13124         return ret;
13125 }
13126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13127         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13128         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
13129         int64_t ret_ref = 0;
13130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13132         return ret_ref;
13133 }
13134
13135 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
13136 CHECK(!owner->result_ok);
13137         return CreationError_clone(&*owner->contents.err);
13138 }
13139 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13140         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
13141         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
13142         return ret_conv;
13143 }
13144
13145 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13146         LDKOutPoint ret = *owner->contents.result;
13147         ret.is_owned = false;
13148         return ret;
13149 }
13150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13151         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13152         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
13153         int64_t ret_ref = 0;
13154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13156         return ret_ref;
13157 }
13158
13159 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
13160 CHECK(!owner->result_ok);
13161         return DecodeError_clone(&*owner->contents.err);
13162 }
13163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13164         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
13165         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13166         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
13167         int64_t ret_ref = tag_ptr(ret_copy, true);
13168         return ret_ref;
13169 }
13170
13171 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13172         LDKBigSize ret = *owner->contents.result;
13173         ret.is_owned = false;
13174         return ret;
13175 }
13176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13177         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13178         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
13179         int64_t ret_ref = 0;
13180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13182         return ret_ref;
13183 }
13184
13185 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
13186 CHECK(!owner->result_ok);
13187         return DecodeError_clone(&*owner->contents.err);
13188 }
13189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13190         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
13191         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13192         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
13193         int64_t ret_ref = tag_ptr(ret_copy, true);
13194         return ret_ref;
13195 }
13196
13197 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13198         LDKHostname ret = *owner->contents.result;
13199         ret.is_owned = false;
13200         return ret;
13201 }
13202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13203         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13204         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
13205         int64_t ret_ref = 0;
13206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13208         return ret_ref;
13209 }
13210
13211 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
13212 CHECK(!owner->result_ok);
13213         return DecodeError_clone(&*owner->contents.err);
13214 }
13215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13216         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
13217         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13218         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
13219         int64_t ret_ref = tag_ptr(ret_copy, true);
13220         return ret_ref;
13221 }
13222
13223 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13224         LDKTransactionU16LenLimited ret = *owner->contents.result;
13225         ret.is_owned = false;
13226         return ret;
13227 }
13228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13229         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13230         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
13231         int64_t ret_ref = 0;
13232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13234         return ret_ref;
13235 }
13236
13237 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
13238 CHECK(!owner->result_ok);
13239         return *owner->contents.err;
13240 }
13241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13242         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
13243         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
13244 }
13245
13246 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13247         LDKTransactionU16LenLimited ret = *owner->contents.result;
13248         ret.is_owned = false;
13249         return ret;
13250 }
13251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13252         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13253         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
13254         int64_t ret_ref = 0;
13255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13257         return ret_ref;
13258 }
13259
13260 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
13261 CHECK(!owner->result_ok);
13262         return DecodeError_clone(&*owner->contents.err);
13263 }
13264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13265         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
13266         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13267         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
13268         int64_t ret_ref = tag_ptr(ret_copy, true);
13269         return ret_ref;
13270 }
13271
13272 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13273         LDKUntrustedString ret = *owner->contents.result;
13274         ret.is_owned = false;
13275         return ret;
13276 }
13277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13278         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13279         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
13280         int64_t ret_ref = 0;
13281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13283         return ret_ref;
13284 }
13285
13286 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
13287 CHECK(!owner->result_ok);
13288         return DecodeError_clone(&*owner->contents.err);
13289 }
13290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13291         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
13292         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13293         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
13294         int64_t ret_ref = tag_ptr(ret_copy, true);
13295         return ret_ref;
13296 }
13297
13298 static jclass LDKPaymentError_Invoice_class = NULL;
13299 static jmethodID LDKPaymentError_Invoice_meth = NULL;
13300 static jclass LDKPaymentError_Sending_class = NULL;
13301 static jmethodID LDKPaymentError_Sending_meth = NULL;
13302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
13303         LDKPaymentError_Invoice_class =
13304                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
13305         CHECK(LDKPaymentError_Invoice_class != NULL);
13306         LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
13307         CHECK(LDKPaymentError_Invoice_meth != NULL);
13308         LDKPaymentError_Sending_class =
13309                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
13310         CHECK(LDKPaymentError_Sending_class != NULL);
13311         LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(Lorg/ldk/enums/RetryableSendFailure;)V");
13312         CHECK(LDKPaymentError_Sending_meth != NULL);
13313 }
13314 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13315         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
13316         switch(obj->tag) {
13317                 case LDKPaymentError_Invoice: {
13318                         LDKStr invoice_str = obj->invoice;
13319                         jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
13320                         return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
13321                 }
13322                 case LDKPaymentError_Sending: {
13323                         jclass sending_conv = LDKRetryableSendFailure_to_java(env, obj->sending);
13324                         return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_conv);
13325                 }
13326                 default: abort();
13327         }
13328 }
13329 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
13330 CHECK(owner->result_ok);
13331         return ThirtyTwoBytes_clone(&*owner->contents.result);
13332 }
13333 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13334         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
13335         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13336         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
13337         return ret_arr;
13338 }
13339
13340 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
13341 CHECK(!owner->result_ok);
13342         return PaymentError_clone(&*owner->contents.err);
13343 }
13344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13345         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
13346         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
13347         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
13348         int64_t ret_ref = tag_ptr(ret_copy, true);
13349         return ret_ref;
13350 }
13351
13352 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
13353 CHECK(owner->result_ok);
13354         return *owner->contents.result;
13355 }
13356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13357         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
13358         CResult_NonePaymentErrorZ_get_ok(owner_conv);
13359 }
13360
13361 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
13362 CHECK(!owner->result_ok);
13363         return PaymentError_clone(&*owner->contents.err);
13364 }
13365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13366         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
13367         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
13368         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
13369         int64_t ret_ref = tag_ptr(ret_copy, true);
13370         return ret_ref;
13371 }
13372
13373 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
13374 CHECK(owner->result_ok);
13375         return *owner->contents.result;
13376 }
13377 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13378         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
13379         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
13380         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13381         return ret_conv;
13382 }
13383
13384 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
13385 CHECK(!owner->result_ok);
13386         return *owner->contents.err;
13387 }
13388 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13389         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
13390         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
13391         return ret_conv;
13392 }
13393
13394 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
13395         LDKOnionMessagePath ret = *owner->contents.result;
13396         ret.is_owned = false;
13397         return ret;
13398 }
13399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13400         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
13401         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
13402         int64_t ret_ref = 0;
13403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13405         return ret_ref;
13406 }
13407
13408 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
13409 CHECK(!owner->result_ok);
13410         return *owner->contents.err;
13411 }
13412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13413         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
13414         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
13415 }
13416
13417 static jclass LDKSendError_Secp256k1_class = NULL;
13418 static jmethodID LDKSendError_Secp256k1_meth = NULL;
13419 static jclass LDKSendError_TooBigPacket_class = NULL;
13420 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
13421 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
13422 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
13423 static jclass LDKSendError_InvalidFirstHop_class = NULL;
13424 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
13425 static jclass LDKSendError_InvalidMessage_class = NULL;
13426 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
13427 static jclass LDKSendError_BufferFull_class = NULL;
13428 static jmethodID LDKSendError_BufferFull_meth = NULL;
13429 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
13430 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
13431 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
13432 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
13433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
13434         LDKSendError_Secp256k1_class =
13435                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
13436         CHECK(LDKSendError_Secp256k1_class != NULL);
13437         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
13438         CHECK(LDKSendError_Secp256k1_meth != NULL);
13439         LDKSendError_TooBigPacket_class =
13440                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
13441         CHECK(LDKSendError_TooBigPacket_class != NULL);
13442         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
13443         CHECK(LDKSendError_TooBigPacket_meth != NULL);
13444         LDKSendError_TooFewBlindedHops_class =
13445                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
13446         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
13447         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
13448         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
13449         LDKSendError_InvalidFirstHop_class =
13450                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
13451         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
13452         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "()V");
13453         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
13454         LDKSendError_InvalidMessage_class =
13455                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
13456         CHECK(LDKSendError_InvalidMessage_class != NULL);
13457         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
13458         CHECK(LDKSendError_InvalidMessage_meth != NULL);
13459         LDKSendError_BufferFull_class =
13460                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
13461         CHECK(LDKSendError_BufferFull_class != NULL);
13462         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
13463         CHECK(LDKSendError_BufferFull_meth != NULL);
13464         LDKSendError_GetNodeIdFailed_class =
13465                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
13466         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
13467         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
13468         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
13469         LDKSendError_BlindedPathAdvanceFailed_class =
13470                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
13471         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
13472         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
13473         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
13474 }
13475 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13476         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
13477         switch(obj->tag) {
13478                 case LDKSendError_Secp256k1: {
13479                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
13480                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
13481                 }
13482                 case LDKSendError_TooBigPacket: {
13483                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
13484                 }
13485                 case LDKSendError_TooFewBlindedHops: {
13486                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
13487                 }
13488                 case LDKSendError_InvalidFirstHop: {
13489                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth);
13490                 }
13491                 case LDKSendError_InvalidMessage: {
13492                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
13493                 }
13494                 case LDKSendError_BufferFull: {
13495                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
13496                 }
13497                 case LDKSendError_GetNodeIdFailed: {
13498                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
13499                 }
13500                 case LDKSendError_BlindedPathAdvanceFailed: {
13501                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
13502                 }
13503                 default: abort();
13504         }
13505 }
13506 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
13507 CHECK(owner->result_ok);
13508         return *owner->contents.result;
13509 }
13510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13511         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
13512         CResult_NoneSendErrorZ_get_ok(owner_conv);
13513 }
13514
13515 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
13516 CHECK(!owner->result_ok);
13517         return SendError_clone(&*owner->contents.err);
13518 }
13519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13520         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
13521         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
13522         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
13523         int64_t ret_ref = tag_ptr(ret_copy, true);
13524         return ret_ref;
13525 }
13526
13527 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13528         LDKBlindedPath ret = *owner->contents.result;
13529         ret.is_owned = false;
13530         return ret;
13531 }
13532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13533         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13534         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
13535         int64_t ret_ref = 0;
13536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13538         return ret_ref;
13539 }
13540
13541 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
13542 CHECK(!owner->result_ok);
13543         return *owner->contents.err;
13544 }
13545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13546         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
13547         CResult_BlindedPathNoneZ_get_err(owner_conv);
13548 }
13549
13550 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13551         LDKBlindedPath ret = *owner->contents.result;
13552         ret.is_owned = false;
13553         return ret;
13554 }
13555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13556         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13557         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
13558         int64_t ret_ref = 0;
13559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13561         return ret_ref;
13562 }
13563
13564 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
13565 CHECK(!owner->result_ok);
13566         return DecodeError_clone(&*owner->contents.err);
13567 }
13568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13569         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
13570         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13571         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
13572         int64_t ret_ref = tag_ptr(ret_copy, true);
13573         return ret_ref;
13574 }
13575
13576 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13577         LDKBlindedHop ret = *owner->contents.result;
13578         ret.is_owned = false;
13579         return ret;
13580 }
13581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13582         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13583         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
13584         int64_t ret_ref = 0;
13585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13587         return ret_ref;
13588 }
13589
13590 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
13591 CHECK(!owner->result_ok);
13592         return DecodeError_clone(&*owner->contents.err);
13593 }
13594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13595         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
13596         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13597         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
13598         int64_t ret_ref = tag_ptr(ret_copy, true);
13599         return ret_ref;
13600 }
13601
13602 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13603         LDKInvoiceError ret = *owner->contents.result;
13604         ret.is_owned = false;
13605         return ret;
13606 }
13607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13608         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13609         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
13610         int64_t ret_ref = 0;
13611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13613         return ret_ref;
13614 }
13615
13616 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
13617 CHECK(!owner->result_ok);
13618         return DecodeError_clone(&*owner->contents.err);
13619 }
13620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13621         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
13622         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13623         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
13624         int64_t ret_ref = tag_ptr(ret_copy, true);
13625         return ret_ref;
13626 }
13627
13628 typedef struct LDKFilter_JCalls {
13629         atomic_size_t refcnt;
13630         JavaVM *vm;
13631         jweak o;
13632         jmethodID register_tx_meth;
13633         jmethodID register_output_meth;
13634 } LDKFilter_JCalls;
13635 static void LDKFilter_JCalls_free(void* this_arg) {
13636         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13637         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13638                 JNIEnv *env;
13639                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13640                 if (get_jenv_res == JNI_EDETACHED) {
13641                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13642                 } else {
13643                         DO_ASSERT(get_jenv_res == JNI_OK);
13644                 }
13645                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13646                 if (get_jenv_res == JNI_EDETACHED) {
13647                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13648                 }
13649                 FREE(j_calls);
13650         }
13651 }
13652 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
13653         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13654         JNIEnv *env;
13655         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13656         if (get_jenv_res == JNI_EDETACHED) {
13657                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13658         } else {
13659                 DO_ASSERT(get_jenv_res == JNI_OK);
13660         }
13661         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
13662         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
13663         LDKu8slice script_pubkey_var = script_pubkey;
13664         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
13665         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
13666         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13667         CHECK(obj != NULL);
13668         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
13669         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13670                 (*env)->ExceptionDescribe(env);
13671                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
13672         }
13673         if (get_jenv_res == JNI_EDETACHED) {
13674                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13675         }
13676 }
13677 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
13678         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
13679         JNIEnv *env;
13680         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13681         if (get_jenv_res == JNI_EDETACHED) {
13682                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13683         } else {
13684                 DO_ASSERT(get_jenv_res == JNI_OK);
13685         }
13686         LDKWatchedOutput output_var = output;
13687         int64_t output_ref = 0;
13688         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
13689         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
13690         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13691         CHECK(obj != NULL);
13692         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
13693         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13694                 (*env)->ExceptionDescribe(env);
13695                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
13696         }
13697         if (get_jenv_res == JNI_EDETACHED) {
13698                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13699         }
13700 }
13701 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
13702         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
13703         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13704 }
13705 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
13706         jclass c = (*env)->GetObjectClass(env, o);
13707         CHECK(c != NULL);
13708         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
13709         atomic_init(&calls->refcnt, 1);
13710         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13711         calls->o = (*env)->NewWeakGlobalRef(env, o);
13712         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
13713         CHECK(calls->register_tx_meth != NULL);
13714         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
13715         CHECK(calls->register_output_meth != NULL);
13716
13717         LDKFilter ret = {
13718                 .this_arg = (void*) calls,
13719                 .register_tx = register_tx_LDKFilter_jcall,
13720                 .register_output = register_output_LDKFilter_jcall,
13721                 .free = LDKFilter_JCalls_free,
13722         };
13723         return ret;
13724 }
13725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
13726         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13727         *res_ptr = LDKFilter_init(env, clz, o);
13728         return tag_ptr(res_ptr, true);
13729 }
13730 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) {
13731         void* this_arg_ptr = untag_ptr(this_arg);
13732         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13733         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13734         uint8_t txid_arr[32];
13735         CHECK((*env)->GetArrayLength(env, txid) == 32);
13736         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
13737         uint8_t (*txid_ref)[32] = &txid_arr;
13738         LDKu8slice script_pubkey_ref;
13739         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
13740         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
13741         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
13742         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
13743 }
13744
13745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
13746         void* this_arg_ptr = untag_ptr(this_arg);
13747         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13748         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
13749         LDKWatchedOutput output_conv;
13750         output_conv.inner = untag_ptr(output);
13751         output_conv.is_owned = ptr_is_owned(output);
13752         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
13753         output_conv = WatchedOutput_clone(&output_conv);
13754         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
13755 }
13756
13757 static jclass LDKCOption_FilterZ_Some_class = NULL;
13758 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
13759 static jclass LDKCOption_FilterZ_None_class = NULL;
13760 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
13761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
13762         LDKCOption_FilterZ_Some_class =
13763                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
13764         CHECK(LDKCOption_FilterZ_Some_class != NULL);
13765         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
13766         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
13767         LDKCOption_FilterZ_None_class =
13768                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
13769         CHECK(LDKCOption_FilterZ_None_class != NULL);
13770         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
13771         CHECK(LDKCOption_FilterZ_None_meth != NULL);
13772 }
13773 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13774         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
13775         switch(obj->tag) {
13776                 case LDKCOption_FilterZ_Some: {
13777                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
13778                         *some_ret = obj->some;
13779                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
13780                         if ((*some_ret).free == LDKFilter_JCalls_free) {
13781                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13782                                 LDKFilter_JCalls_cloned(&(*some_ret));
13783                         }
13784                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
13785                 }
13786                 case LDKCOption_FilterZ_None: {
13787                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
13788                 }
13789                 default: abort();
13790         }
13791 }
13792 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13793         LDKLockedChannelMonitor ret = *owner->contents.result;
13794         ret.is_owned = false;
13795         return ret;
13796 }
13797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13798         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13799         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
13800         int64_t ret_ref = 0;
13801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13803         return ret_ref;
13804 }
13805
13806 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
13807 CHECK(!owner->result_ok);
13808         return *owner->contents.err;
13809 }
13810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13811         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
13812         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
13813 }
13814
13815 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
13816         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
13817         for (size_t i = 0; i < ret.datalen; i++) {
13818                 ret.data[i] = OutPoint_clone(&orig->data[i]);
13819         }
13820         return ret;
13821 }
13822 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
13823         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
13824         for (size_t i = 0; i < ret.datalen; i++) {
13825                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
13826         }
13827         return ret;
13828 }
13829 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
13830         LDKOutPoint ret = owner->a;
13831         ret.is_owned = false;
13832         return ret;
13833 }
13834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
13835         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
13836         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
13837         int64_t ret_ref = 0;
13838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13840         return ret_ref;
13841 }
13842
13843 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
13844         return CVec_MonitorUpdateIdZ_clone(&owner->b);
13845 }
13846 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
13847         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
13848         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
13849         int64_tArray ret_arr = NULL;
13850         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13851         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13852         for (size_t r = 0; r < ret_var.datalen; r++) {
13853                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
13854                 int64_t ret_conv_17_ref = 0;
13855                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
13856                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
13857                 ret_arr_ptr[r] = ret_conv_17_ref;
13858         }
13859         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13860         FREE(ret_var.data);
13861         return ret_arr;
13862 }
13863
13864 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
13865         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
13866         for (size_t i = 0; i < ret.datalen; i++) {
13867                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
13868         }
13869         return ret;
13870 }
13871 typedef struct LDKPersister_JCalls {
13872         atomic_size_t refcnt;
13873         JavaVM *vm;
13874         jweak o;
13875         jmethodID persist_manager_meth;
13876         jmethodID persist_graph_meth;
13877         jmethodID persist_scorer_meth;
13878 } LDKPersister_JCalls;
13879 static void LDKPersister_JCalls_free(void* this_arg) {
13880         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13881         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13882                 JNIEnv *env;
13883                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13884                 if (get_jenv_res == JNI_EDETACHED) {
13885                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13886                 } else {
13887                         DO_ASSERT(get_jenv_res == JNI_OK);
13888                 }
13889                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13890                 if (get_jenv_res == JNI_EDETACHED) {
13891                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13892                 }
13893                 FREE(j_calls);
13894         }
13895 }
13896 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
13897         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13898         JNIEnv *env;
13899         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13900         if (get_jenv_res == JNI_EDETACHED) {
13901                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13902         } else {
13903                 DO_ASSERT(get_jenv_res == JNI_OK);
13904         }
13905         LDKChannelManager channel_manager_var = *channel_manager;
13906         int64_t channel_manager_ref = 0;
13907         // WARNING: we may need a move here but no clone is available for LDKChannelManager
13908         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
13909         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
13910         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13911         CHECK(obj != NULL);
13912         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
13913         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13914                 (*env)->ExceptionDescribe(env);
13915                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
13916         }
13917         void* ret_ptr = untag_ptr(ret);
13918         CHECK_ACCESS(ret_ptr);
13919         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13920         FREE(untag_ptr(ret));
13921         if (get_jenv_res == JNI_EDETACHED) {
13922                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13923         }
13924         return ret_conv;
13925 }
13926 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
13927         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13928         JNIEnv *env;
13929         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13930         if (get_jenv_res == JNI_EDETACHED) {
13931                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13932         } else {
13933                 DO_ASSERT(get_jenv_res == JNI_OK);
13934         }
13935         LDKNetworkGraph network_graph_var = *network_graph;
13936         int64_t network_graph_ref = 0;
13937         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
13938         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
13939         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
13940         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13941         CHECK(obj != NULL);
13942         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
13943         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13944                 (*env)->ExceptionDescribe(env);
13945                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
13946         }
13947         void* ret_ptr = untag_ptr(ret);
13948         CHECK_ACCESS(ret_ptr);
13949         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13950         FREE(untag_ptr(ret));
13951         if (get_jenv_res == JNI_EDETACHED) {
13952                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13953         }
13954         return ret_conv;
13955 }
13956 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
13957         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13958         JNIEnv *env;
13959         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13960         if (get_jenv_res == JNI_EDETACHED) {
13961                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13962         } else {
13963                 DO_ASSERT(get_jenv_res == JNI_OK);
13964         }
13965         // WARNING: This object doesn't live past this scope, needs clone!
13966         int64_t ret_scorer = tag_ptr(scorer, false);
13967         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13968         CHECK(obj != NULL);
13969         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
13970         if (UNLIKELY((*env)->ExceptionCheck(env))) {
13971                 (*env)->ExceptionDescribe(env);
13972                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
13973         }
13974         void* ret_ptr = untag_ptr(ret);
13975         CHECK_ACCESS(ret_ptr);
13976         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13977         FREE(untag_ptr(ret));
13978         if (get_jenv_res == JNI_EDETACHED) {
13979                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13980         }
13981         return ret_conv;
13982 }
13983 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
13984         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
13985         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13986 }
13987 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
13988         jclass c = (*env)->GetObjectClass(env, o);
13989         CHECK(c != NULL);
13990         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
13991         atomic_init(&calls->refcnt, 1);
13992         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13993         calls->o = (*env)->NewWeakGlobalRef(env, o);
13994         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
13995         CHECK(calls->persist_manager_meth != NULL);
13996         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
13997         CHECK(calls->persist_graph_meth != NULL);
13998         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
13999         CHECK(calls->persist_scorer_meth != NULL);
14000
14001         LDKPersister ret = {
14002                 .this_arg = (void*) calls,
14003                 .persist_manager = persist_manager_LDKPersister_jcall,
14004                 .persist_graph = persist_graph_LDKPersister_jcall,
14005                 .persist_scorer = persist_scorer_LDKPersister_jcall,
14006                 .free = LDKPersister_JCalls_free,
14007         };
14008         return ret;
14009 }
14010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
14011         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
14012         *res_ptr = LDKPersister_init(env, clz, o);
14013         return tag_ptr(res_ptr, true);
14014 }
14015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
14016         void* this_arg_ptr = untag_ptr(this_arg);
14017         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14018         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14019         LDKChannelManager channel_manager_conv;
14020         channel_manager_conv.inner = untag_ptr(channel_manager);
14021         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
14022         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
14023         channel_manager_conv.is_owned = false;
14024         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14025         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
14026         return tag_ptr(ret_conv, true);
14027 }
14028
14029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
14030         void* this_arg_ptr = untag_ptr(this_arg);
14031         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14032         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14033         LDKNetworkGraph network_graph_conv;
14034         network_graph_conv.inner = untag_ptr(network_graph);
14035         network_graph_conv.is_owned = ptr_is_owned(network_graph);
14036         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
14037         network_graph_conv.is_owned = false;
14038         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14039         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
14040         return tag_ptr(ret_conv, true);
14041 }
14042
14043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
14044         void* this_arg_ptr = untag_ptr(this_arg);
14045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14046         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
14047         void* scorer_ptr = untag_ptr(scorer);
14048         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
14049         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
14050         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14051         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
14052         return tag_ptr(ret_conv, true);
14053 }
14054
14055 typedef struct LDKFutureCallback_JCalls {
14056         atomic_size_t refcnt;
14057         JavaVM *vm;
14058         jweak o;
14059         jmethodID call_meth;
14060 } LDKFutureCallback_JCalls;
14061 static void LDKFutureCallback_JCalls_free(void* this_arg) {
14062         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14063         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14064                 JNIEnv *env;
14065                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14066                 if (get_jenv_res == JNI_EDETACHED) {
14067                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14068                 } else {
14069                         DO_ASSERT(get_jenv_res == JNI_OK);
14070                 }
14071                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14072                 if (get_jenv_res == JNI_EDETACHED) {
14073                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14074                 }
14075                 FREE(j_calls);
14076         }
14077 }
14078 void call_LDKFutureCallback_jcall(const void* this_arg) {
14079         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
14080         JNIEnv *env;
14081         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14082         if (get_jenv_res == JNI_EDETACHED) {
14083                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14084         } else {
14085                 DO_ASSERT(get_jenv_res == JNI_OK);
14086         }
14087         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14088         CHECK(obj != NULL);
14089         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
14090         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14091                 (*env)->ExceptionDescribe(env);
14092                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
14093         }
14094         if (get_jenv_res == JNI_EDETACHED) {
14095                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14096         }
14097 }
14098 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
14099         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
14100         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14101 }
14102 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
14103         jclass c = (*env)->GetObjectClass(env, o);
14104         CHECK(c != NULL);
14105         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
14106         atomic_init(&calls->refcnt, 1);
14107         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14108         calls->o = (*env)->NewWeakGlobalRef(env, o);
14109         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
14110         CHECK(calls->call_meth != NULL);
14111
14112         LDKFutureCallback ret = {
14113                 .this_arg = (void*) calls,
14114                 .call = call_LDKFutureCallback_jcall,
14115                 .free = LDKFutureCallback_JCalls_free,
14116         };
14117         return ret;
14118 }
14119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
14120         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
14121         *res_ptr = LDKFutureCallback_init(env, clz, o);
14122         return tag_ptr(res_ptr, true);
14123 }
14124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
14125         void* this_arg_ptr = untag_ptr(this_arg);
14126         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14127         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
14128         (this_arg_conv->call)(this_arg_conv->this_arg);
14129 }
14130
14131 typedef struct LDKListen_JCalls {
14132         atomic_size_t refcnt;
14133         JavaVM *vm;
14134         jweak o;
14135         jmethodID filtered_block_connected_meth;
14136         jmethodID block_connected_meth;
14137         jmethodID block_disconnected_meth;
14138 } LDKListen_JCalls;
14139 static void LDKListen_JCalls_free(void* this_arg) {
14140         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14141         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14142                 JNIEnv *env;
14143                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14144                 if (get_jenv_res == JNI_EDETACHED) {
14145                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14146                 } else {
14147                         DO_ASSERT(get_jenv_res == JNI_OK);
14148                 }
14149                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14150                 if (get_jenv_res == JNI_EDETACHED) {
14151                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14152                 }
14153                 FREE(j_calls);
14154         }
14155 }
14156 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14157         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14158         JNIEnv *env;
14159         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14160         if (get_jenv_res == JNI_EDETACHED) {
14161                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14162         } else {
14163                 DO_ASSERT(get_jenv_res == JNI_OK);
14164         }
14165         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
14166         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
14167         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14168         int64_tArray txdata_arr = NULL;
14169         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
14170         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
14171         for (size_t c = 0; c < txdata_var.datalen; c++) {
14172                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14173                 *txdata_conv_28_conv = txdata_var.data[c];
14174                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14175         }
14176         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
14177         FREE(txdata_var.data);
14178         int32_t height_conv = height;
14179         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14180         CHECK(obj != NULL);
14181         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
14182         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14183                 (*env)->ExceptionDescribe(env);
14184                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
14185         }
14186         if (get_jenv_res == JNI_EDETACHED) {
14187                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14188         }
14189 }
14190 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
14191         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14192         JNIEnv *env;
14193         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14194         if (get_jenv_res == JNI_EDETACHED) {
14195                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14196         } else {
14197                 DO_ASSERT(get_jenv_res == JNI_OK);
14198         }
14199         LDKu8slice block_var = block;
14200         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
14201         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
14202         int32_t height_conv = height;
14203         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14204         CHECK(obj != NULL);
14205         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
14206         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14207                 (*env)->ExceptionDescribe(env);
14208                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
14209         }
14210         if (get_jenv_res == JNI_EDETACHED) {
14211                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14212         }
14213 }
14214 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14215         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
14216         JNIEnv *env;
14217         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14218         if (get_jenv_res == JNI_EDETACHED) {
14219                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14220         } else {
14221                 DO_ASSERT(get_jenv_res == JNI_OK);
14222         }
14223         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
14224         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
14225         int32_t height_conv = height;
14226         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14227         CHECK(obj != NULL);
14228         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
14229         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14230                 (*env)->ExceptionDescribe(env);
14231                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
14232         }
14233         if (get_jenv_res == JNI_EDETACHED) {
14234                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14235         }
14236 }
14237 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
14238         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
14239         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14240 }
14241 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
14242         jclass c = (*env)->GetObjectClass(env, o);
14243         CHECK(c != NULL);
14244         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
14245         atomic_init(&calls->refcnt, 1);
14246         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14247         calls->o = (*env)->NewWeakGlobalRef(env, o);
14248         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
14249         CHECK(calls->filtered_block_connected_meth != NULL);
14250         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
14251         CHECK(calls->block_connected_meth != NULL);
14252         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
14253         CHECK(calls->block_disconnected_meth != NULL);
14254
14255         LDKListen ret = {
14256                 .this_arg = (void*) calls,
14257                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
14258                 .block_connected = block_connected_LDKListen_jcall,
14259                 .block_disconnected = block_disconnected_LDKListen_jcall,
14260                 .free = LDKListen_JCalls_free,
14261         };
14262         return ret;
14263 }
14264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
14265         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
14266         *res_ptr = LDKListen_init(env, clz, o);
14267         return tag_ptr(res_ptr, true);
14268 }
14269 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) {
14270         void* this_arg_ptr = untag_ptr(this_arg);
14271         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14272         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14273         uint8_t header_arr[80];
14274         CHECK((*env)->GetArrayLength(env, header) == 80);
14275         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14276         uint8_t (*header_ref)[80] = &header_arr;
14277         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14278         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14279         if (txdata_constr.datalen > 0)
14280                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14281         else
14282                 txdata_constr.data = NULL;
14283         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14284         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14285                 int64_t txdata_conv_28 = txdata_vals[c];
14286                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14287                 CHECK_ACCESS(txdata_conv_28_ptr);
14288                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14289                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14290                 txdata_constr.data[c] = txdata_conv_28_conv;
14291         }
14292         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14293         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14294 }
14295
14296 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) {
14297         void* this_arg_ptr = untag_ptr(this_arg);
14298         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14299         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14300         LDKu8slice block_ref;
14301         block_ref.datalen = (*env)->GetArrayLength(env, block);
14302         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
14303         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
14304         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
14305 }
14306
14307 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) {
14308         void* this_arg_ptr = untag_ptr(this_arg);
14309         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14310         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
14311         uint8_t header_arr[80];
14312         CHECK((*env)->GetArrayLength(env, header) == 80);
14313         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14314         uint8_t (*header_ref)[80] = &header_arr;
14315         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
14316 }
14317
14318 typedef struct LDKConfirm_JCalls {
14319         atomic_size_t refcnt;
14320         JavaVM *vm;
14321         jweak o;
14322         jmethodID transactions_confirmed_meth;
14323         jmethodID transaction_unconfirmed_meth;
14324         jmethodID best_block_updated_meth;
14325         jmethodID get_relevant_txids_meth;
14326 } LDKConfirm_JCalls;
14327 static void LDKConfirm_JCalls_free(void* this_arg) {
14328         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14329         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14330                 JNIEnv *env;
14331                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14332                 if (get_jenv_res == JNI_EDETACHED) {
14333                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14334                 } else {
14335                         DO_ASSERT(get_jenv_res == JNI_OK);
14336                 }
14337                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14338                 if (get_jenv_res == JNI_EDETACHED) {
14339                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14340                 }
14341                 FREE(j_calls);
14342         }
14343 }
14344 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
14345         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14346         JNIEnv *env;
14347         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14348         if (get_jenv_res == JNI_EDETACHED) {
14349                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14350         } else {
14351                 DO_ASSERT(get_jenv_res == JNI_OK);
14352         }
14353         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
14354         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
14355         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
14356         int64_tArray txdata_arr = NULL;
14357         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
14358         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
14359         for (size_t c = 0; c < txdata_var.datalen; c++) {
14360                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14361                 *txdata_conv_28_conv = txdata_var.data[c];
14362                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
14363         }
14364         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
14365         FREE(txdata_var.data);
14366         int32_t height_conv = height;
14367         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14368         CHECK(obj != NULL);
14369         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
14370         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14371                 (*env)->ExceptionDescribe(env);
14372                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
14373         }
14374         if (get_jenv_res == JNI_EDETACHED) {
14375                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14376         }
14377 }
14378 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
14379         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14380         JNIEnv *env;
14381         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14382         if (get_jenv_res == JNI_EDETACHED) {
14383                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14384         } else {
14385                 DO_ASSERT(get_jenv_res == JNI_OK);
14386         }
14387         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
14388         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
14389         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14390         CHECK(obj != NULL);
14391         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
14392         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14393                 (*env)->ExceptionDescribe(env);
14394                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
14395         }
14396         if (get_jenv_res == JNI_EDETACHED) {
14397                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14398         }
14399 }
14400 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
14401         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14402         JNIEnv *env;
14403         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14404         if (get_jenv_res == JNI_EDETACHED) {
14405                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14406         } else {
14407                 DO_ASSERT(get_jenv_res == JNI_OK);
14408         }
14409         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
14410         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
14411         int32_t height_conv = height;
14412         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14413         CHECK(obj != NULL);
14414         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
14415         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14416                 (*env)->ExceptionDescribe(env);
14417                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
14418         }
14419         if (get_jenv_res == JNI_EDETACHED) {
14420                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14421         }
14422 }
14423 LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
14424         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
14425         JNIEnv *env;
14426         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14427         if (get_jenv_res == JNI_EDETACHED) {
14428                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14429         } else {
14430                 DO_ASSERT(get_jenv_res == JNI_OK);
14431         }
14432         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14433         CHECK(obj != NULL);
14434         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
14435         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14436                 (*env)->ExceptionDescribe(env);
14437                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
14438         }
14439         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_constr;
14440         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
14441         if (ret_constr.datalen > 0)
14442                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ Elements");
14443         else
14444                 ret_constr.data = NULL;
14445         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
14446         for (size_t i = 0; i < ret_constr.datalen; i++) {
14447                 int64_t ret_conv_34 = ret_vals[i];
14448                 void* ret_conv_34_ptr = untag_ptr(ret_conv_34);
14449                 CHECK_ACCESS(ret_conv_34_ptr);
14450                 LDKC2Tuple_TxidCOption_BlockHashZZ ret_conv_34_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(ret_conv_34_ptr);
14451                 FREE(untag_ptr(ret_conv_34));
14452                 ret_constr.data[i] = ret_conv_34_conv;
14453         }
14454         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
14455         if (get_jenv_res == JNI_EDETACHED) {
14456                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14457         }
14458         return ret_constr;
14459 }
14460 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
14461         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
14462         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14463 }
14464 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
14465         jclass c = (*env)->GetObjectClass(env, o);
14466         CHECK(c != NULL);
14467         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
14468         atomic_init(&calls->refcnt, 1);
14469         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14470         calls->o = (*env)->NewWeakGlobalRef(env, o);
14471         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
14472         CHECK(calls->transactions_confirmed_meth != NULL);
14473         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
14474         CHECK(calls->transaction_unconfirmed_meth != NULL);
14475         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
14476         CHECK(calls->best_block_updated_meth != NULL);
14477         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
14478         CHECK(calls->get_relevant_txids_meth != NULL);
14479
14480         LDKConfirm ret = {
14481                 .this_arg = (void*) calls,
14482                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
14483                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
14484                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
14485                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
14486                 .free = LDKConfirm_JCalls_free,
14487         };
14488         return ret;
14489 }
14490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
14491         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14492         *res_ptr = LDKConfirm_init(env, clz, o);
14493         return tag_ptr(res_ptr, true);
14494 }
14495 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) {
14496         void* this_arg_ptr = untag_ptr(this_arg);
14497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14498         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14499         uint8_t header_arr[80];
14500         CHECK((*env)->GetArrayLength(env, header) == 80);
14501         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14502         uint8_t (*header_ref)[80] = &header_arr;
14503         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14504         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14505         if (txdata_constr.datalen > 0)
14506                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14507         else
14508                 txdata_constr.data = NULL;
14509         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14510         for (size_t c = 0; c < txdata_constr.datalen; c++) {
14511                 int64_t txdata_conv_28 = txdata_vals[c];
14512                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
14513                 CHECK_ACCESS(txdata_conv_28_ptr);
14514                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
14515                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
14516                 txdata_constr.data[c] = txdata_conv_28_conv;
14517         }
14518         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14519         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
14520 }
14521
14522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
14523         void* this_arg_ptr = untag_ptr(this_arg);
14524         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14525         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14526         uint8_t txid_arr[32];
14527         CHECK((*env)->GetArrayLength(env, txid) == 32);
14528         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14529         uint8_t (*txid_ref)[32] = &txid_arr;
14530         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
14531 }
14532
14533 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) {
14534         void* this_arg_ptr = untag_ptr(this_arg);
14535         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14536         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14537         uint8_t header_arr[80];
14538         CHECK((*env)->GetArrayLength(env, header) == 80);
14539         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14540         uint8_t (*header_ref)[80] = &header_arr;
14541         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
14542 }
14543
14544 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
14545         void* this_arg_ptr = untag_ptr(this_arg);
14546         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14547         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
14548         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
14549         int64_tArray ret_arr = NULL;
14550         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14551         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14552         for (size_t i = 0; i < ret_var.datalen; i++) {
14553                 LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv_34_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
14554                 *ret_conv_34_conv = ret_var.data[i];
14555                 ret_arr_ptr[i] = tag_ptr(ret_conv_34_conv, true);
14556         }
14557         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14558         FREE(ret_var.data);
14559         return ret_arr;
14560 }
14561
14562 typedef struct LDKPersist_JCalls {
14563         atomic_size_t refcnt;
14564         JavaVM *vm;
14565         jweak o;
14566         jmethodID persist_new_channel_meth;
14567         jmethodID update_persisted_channel_meth;
14568 } LDKPersist_JCalls;
14569 static void LDKPersist_JCalls_free(void* this_arg) {
14570         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14571         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14572                 JNIEnv *env;
14573                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14574                 if (get_jenv_res == JNI_EDETACHED) {
14575                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14576                 } else {
14577                         DO_ASSERT(get_jenv_res == JNI_OK);
14578                 }
14579                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14580                 if (get_jenv_res == JNI_EDETACHED) {
14581                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14582                 }
14583                 FREE(j_calls);
14584         }
14585 }
14586 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14587         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14588         JNIEnv *env;
14589         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14590         if (get_jenv_res == JNI_EDETACHED) {
14591                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14592         } else {
14593                 DO_ASSERT(get_jenv_res == JNI_OK);
14594         }
14595         LDKOutPoint channel_id_var = channel_id;
14596         int64_t channel_id_ref = 0;
14597         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14598         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
14599         LDKChannelMonitor data_var = *data;
14600         int64_t data_ref = 0;
14601         data_var = ChannelMonitor_clone(&data_var);
14602         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14603         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14604         LDKMonitorUpdateId update_id_var = update_id;
14605         int64_t update_id_ref = 0;
14606         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14607         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14608         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14609         CHECK(obj != NULL);
14610         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
14611         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14612                 (*env)->ExceptionDescribe(env);
14613                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
14614         }
14615         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
14616         if (get_jenv_res == JNI_EDETACHED) {
14617                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14618         }
14619         return ret_conv;
14620 }
14621 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
14622         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
14623         JNIEnv *env;
14624         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14625         if (get_jenv_res == JNI_EDETACHED) {
14626                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14627         } else {
14628                 DO_ASSERT(get_jenv_res == JNI_OK);
14629         }
14630         LDKOutPoint channel_id_var = channel_id;
14631         int64_t channel_id_ref = 0;
14632         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14633         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
14634         LDKChannelMonitorUpdate update_var = update;
14635         int64_t update_ref = 0;
14636         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
14637         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
14638         LDKChannelMonitor data_var = *data;
14639         int64_t data_ref = 0;
14640         data_var = ChannelMonitor_clone(&data_var);
14641         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
14642         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
14643         LDKMonitorUpdateId update_id_var = update_id;
14644         int64_t update_id_ref = 0;
14645         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
14646         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
14647         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14648         CHECK(obj != NULL);
14649         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
14650         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14651                 (*env)->ExceptionDescribe(env);
14652                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
14653         }
14654         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
14655         if (get_jenv_res == JNI_EDETACHED) {
14656                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14657         }
14658         return ret_conv;
14659 }
14660 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
14661         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
14662         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14663 }
14664 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
14665         jclass c = (*env)->GetObjectClass(env, o);
14666         CHECK(c != NULL);
14667         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
14668         atomic_init(&calls->refcnt, 1);
14669         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14670         calls->o = (*env)->NewWeakGlobalRef(env, o);
14671         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
14672         CHECK(calls->persist_new_channel_meth != NULL);
14673         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
14674         CHECK(calls->update_persisted_channel_meth != NULL);
14675
14676         LDKPersist ret = {
14677                 .this_arg = (void*) calls,
14678                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
14679                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
14680                 .free = LDKPersist_JCalls_free,
14681         };
14682         return ret;
14683 }
14684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
14685         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
14686         *res_ptr = LDKPersist_init(env, clz, o);
14687         return tag_ptr(res_ptr, true);
14688 }
14689 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) {
14690         void* this_arg_ptr = untag_ptr(this_arg);
14691         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14692         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14693         LDKOutPoint channel_id_conv;
14694         channel_id_conv.inner = untag_ptr(channel_id);
14695         channel_id_conv.is_owned = ptr_is_owned(channel_id);
14696         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
14697         channel_id_conv = OutPoint_clone(&channel_id_conv);
14698         LDKChannelMonitor data_conv;
14699         data_conv.inner = untag_ptr(data);
14700         data_conv.is_owned = ptr_is_owned(data);
14701         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14702         data_conv.is_owned = false;
14703         LDKMonitorUpdateId update_id_conv;
14704         update_id_conv.inner = untag_ptr(update_id);
14705         update_id_conv.is_owned = ptr_is_owned(update_id);
14706         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14707         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14708         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));
14709         return ret_conv;
14710 }
14711
14712 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) {
14713         void* this_arg_ptr = untag_ptr(this_arg);
14714         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14715         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
14716         LDKOutPoint channel_id_conv;
14717         channel_id_conv.inner = untag_ptr(channel_id);
14718         channel_id_conv.is_owned = ptr_is_owned(channel_id);
14719         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
14720         channel_id_conv = OutPoint_clone(&channel_id_conv);
14721         LDKChannelMonitorUpdate update_conv;
14722         update_conv.inner = untag_ptr(update);
14723         update_conv.is_owned = ptr_is_owned(update);
14724         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
14725         update_conv = ChannelMonitorUpdate_clone(&update_conv);
14726         LDKChannelMonitor data_conv;
14727         data_conv.inner = untag_ptr(data);
14728         data_conv.is_owned = ptr_is_owned(data);
14729         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
14730         data_conv.is_owned = false;
14731         LDKMonitorUpdateId update_id_conv;
14732         update_id_conv.inner = untag_ptr(update_id);
14733         update_id_conv.is_owned = ptr_is_owned(update_id);
14734         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
14735         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
14736         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));
14737         return ret_conv;
14738 }
14739
14740 typedef struct LDKEventHandler_JCalls {
14741         atomic_size_t refcnt;
14742         JavaVM *vm;
14743         jweak o;
14744         jmethodID handle_event_meth;
14745 } LDKEventHandler_JCalls;
14746 static void LDKEventHandler_JCalls_free(void* this_arg) {
14747         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
14748         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14749                 JNIEnv *env;
14750                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14751                 if (get_jenv_res == JNI_EDETACHED) {
14752                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14753                 } else {
14754                         DO_ASSERT(get_jenv_res == JNI_OK);
14755                 }
14756                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14757                 if (get_jenv_res == JNI_EDETACHED) {
14758                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14759                 }
14760                 FREE(j_calls);
14761         }
14762 }
14763 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
14764         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
14765         JNIEnv *env;
14766         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14767         if (get_jenv_res == JNI_EDETACHED) {
14768                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14769         } else {
14770                 DO_ASSERT(get_jenv_res == JNI_OK);
14771         }
14772         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14773         *event_copy = event;
14774         int64_t event_ref = tag_ptr(event_copy, true);
14775         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14776         CHECK(obj != NULL);
14777         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
14778         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14779                 (*env)->ExceptionDescribe(env);
14780                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
14781         }
14782         if (get_jenv_res == JNI_EDETACHED) {
14783                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14784         }
14785 }
14786 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
14787         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
14788         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14789 }
14790 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
14791         jclass c = (*env)->GetObjectClass(env, o);
14792         CHECK(c != NULL);
14793         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
14794         atomic_init(&calls->refcnt, 1);
14795         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14796         calls->o = (*env)->NewWeakGlobalRef(env, o);
14797         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
14798         CHECK(calls->handle_event_meth != NULL);
14799
14800         LDKEventHandler ret = {
14801                 .this_arg = (void*) calls,
14802                 .handle_event = handle_event_LDKEventHandler_jcall,
14803                 .free = LDKEventHandler_JCalls_free,
14804         };
14805         return ret;
14806 }
14807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
14808         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
14809         *res_ptr = LDKEventHandler_init(env, clz, o);
14810         return tag_ptr(res_ptr, true);
14811 }
14812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
14813         void* this_arg_ptr = untag_ptr(this_arg);
14814         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14815         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
14816         void* event_ptr = untag_ptr(event);
14817         CHECK_ACCESS(event_ptr);
14818         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
14819         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
14820         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
14821 }
14822
14823 typedef struct LDKEventsProvider_JCalls {
14824         atomic_size_t refcnt;
14825         JavaVM *vm;
14826         jweak o;
14827         jmethodID process_pending_events_meth;
14828 } LDKEventsProvider_JCalls;
14829 static void LDKEventsProvider_JCalls_free(void* this_arg) {
14830         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
14831         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14832                 JNIEnv *env;
14833                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14834                 if (get_jenv_res == JNI_EDETACHED) {
14835                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14836                 } else {
14837                         DO_ASSERT(get_jenv_res == JNI_OK);
14838                 }
14839                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14840                 if (get_jenv_res == JNI_EDETACHED) {
14841                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14842                 }
14843                 FREE(j_calls);
14844         }
14845 }
14846 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
14847         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
14848         JNIEnv *env;
14849         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14850         if (get_jenv_res == JNI_EDETACHED) {
14851                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14852         } else {
14853                 DO_ASSERT(get_jenv_res == JNI_OK);
14854         }
14855         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
14856         *handler_ret = handler;
14857         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14858         CHECK(obj != NULL);
14859         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
14860         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14861                 (*env)->ExceptionDescribe(env);
14862                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
14863         }
14864         if (get_jenv_res == JNI_EDETACHED) {
14865                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14866         }
14867 }
14868 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
14869         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
14870         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14871 }
14872 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
14873         jclass c = (*env)->GetObjectClass(env, o);
14874         CHECK(c != NULL);
14875         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
14876         atomic_init(&calls->refcnt, 1);
14877         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14878         calls->o = (*env)->NewWeakGlobalRef(env, o);
14879         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
14880         CHECK(calls->process_pending_events_meth != NULL);
14881
14882         LDKEventsProvider ret = {
14883                 .this_arg = (void*) calls,
14884                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
14885                 .free = LDKEventsProvider_JCalls_free,
14886         };
14887         return ret;
14888 }
14889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
14890         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14891         *res_ptr = LDKEventsProvider_init(env, clz, o);
14892         return tag_ptr(res_ptr, true);
14893 }
14894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
14895         void* this_arg_ptr = untag_ptr(this_arg);
14896         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14897         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
14898         void* handler_ptr = untag_ptr(handler);
14899         CHECK_ACCESS(handler_ptr);
14900         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
14901         if (handler_conv.free == LDKEventHandler_JCalls_free) {
14902                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14903                 LDKEventHandler_JCalls_cloned(&handler_conv);
14904         }
14905         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
14906 }
14907
14908 static jclass LDKRetry_Attempts_class = NULL;
14909 static jmethodID LDKRetry_Attempts_meth = NULL;
14910 static jclass LDKRetry_Timeout_class = NULL;
14911 static jmethodID LDKRetry_Timeout_meth = NULL;
14912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
14913         LDKRetry_Attempts_class =
14914                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
14915         CHECK(LDKRetry_Attempts_class != NULL);
14916         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(J)V");
14917         CHECK(LDKRetry_Attempts_meth != NULL);
14918         LDKRetry_Timeout_class =
14919                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
14920         CHECK(LDKRetry_Timeout_class != NULL);
14921         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
14922         CHECK(LDKRetry_Timeout_meth != NULL);
14923 }
14924 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14925         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
14926         switch(obj->tag) {
14927                 case LDKRetry_Attempts: {
14928                         int64_t attempts_conv = obj->attempts;
14929                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
14930                 }
14931                 case LDKRetry_Timeout: {
14932                         int64_t timeout_conv = obj->timeout;
14933                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
14934                 }
14935                 default: abort();
14936         }
14937 }
14938 typedef struct LDKMessageSendEventsProvider_JCalls {
14939         atomic_size_t refcnt;
14940         JavaVM *vm;
14941         jweak o;
14942         jmethodID get_and_clear_pending_msg_events_meth;
14943 } LDKMessageSendEventsProvider_JCalls;
14944 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
14945         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
14946         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
14947                 JNIEnv *env;
14948                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14949                 if (get_jenv_res == JNI_EDETACHED) {
14950                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14951                 } else {
14952                         DO_ASSERT(get_jenv_res == JNI_OK);
14953                 }
14954                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
14955                 if (get_jenv_res == JNI_EDETACHED) {
14956                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14957                 }
14958                 FREE(j_calls);
14959         }
14960 }
14961 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
14962         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
14963         JNIEnv *env;
14964         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
14965         if (get_jenv_res == JNI_EDETACHED) {
14966                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
14967         } else {
14968                 DO_ASSERT(get_jenv_res == JNI_OK);
14969         }
14970         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
14971         CHECK(obj != NULL);
14972         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
14973         if (UNLIKELY((*env)->ExceptionCheck(env))) {
14974                 (*env)->ExceptionDescribe(env);
14975                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
14976         }
14977         LDKCVec_MessageSendEventZ ret_constr;
14978         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
14979         if (ret_constr.datalen > 0)
14980                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
14981         else
14982                 ret_constr.data = NULL;
14983         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
14984         for (size_t s = 0; s < ret_constr.datalen; s++) {
14985                 int64_t ret_conv_18 = ret_vals[s];
14986                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
14987                 CHECK_ACCESS(ret_conv_18_ptr);
14988                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
14989                 FREE(untag_ptr(ret_conv_18));
14990                 ret_constr.data[s] = ret_conv_18_conv;
14991         }
14992         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
14993         if (get_jenv_res == JNI_EDETACHED) {
14994                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14995         }
14996         return ret_constr;
14997 }
14998 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
14999         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
15000         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
15001 }
15002 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
15003         jclass c = (*env)->GetObjectClass(env, o);
15004         CHECK(c != NULL);
15005         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
15006         atomic_init(&calls->refcnt, 1);
15007         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
15008         calls->o = (*env)->NewWeakGlobalRef(env, o);
15009         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
15010         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
15011
15012         LDKMessageSendEventsProvider ret = {
15013                 .this_arg = (void*) calls,
15014                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
15015                 .free = LDKMessageSendEventsProvider_JCalls_free,
15016         };
15017         return ret;
15018 }
15019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
15020         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15021         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
15022         return tag_ptr(res_ptr, true);
15023 }
15024 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
15025         void* this_arg_ptr = untag_ptr(this_arg);
15026         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
15027         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
15028         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
15029         int64_tArray ret_arr = NULL;
15030         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15031         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15032         for (size_t s = 0; s < ret_var.datalen; s++) {
15033                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15034                 *ret_conv_18_copy = ret_var.data[s];
15035                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
15036                 ret_arr_ptr[s] = ret_conv_18_ref;
15037         }
15038         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15039         FREE(ret_var.data);
15040         return ret_arr;
15041 }
15042
15043 typedef struct LDKChannelMessageHandler_JCalls {
15044         atomic_size_t refcnt;
15045         JavaVM *vm;
15046         jweak o;
15047         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
15048         jmethodID handle_open_channel_meth;
15049         jmethodID handle_open_channel_v2_meth;
15050         jmethodID handle_accept_channel_meth;
15051         jmethodID handle_accept_channel_v2_meth;
15052         jmethodID handle_funding_created_meth;
15053         jmethodID handle_funding_signed_meth;
15054         jmethodID handle_channel_ready_meth;
15055         jmethodID handle_shutdown_meth;
15056         jmethodID handle_closing_signed_meth;
15057         jmethodID handle_tx_add_input_meth;
15058         jmethodID handle_tx_add_output_meth;
15059         jmethodID handle_tx_remove_input_meth;
15060         jmethodID handle_tx_remove_output_meth;
15061         jmethodID handle_tx_complete_meth;
15062         jmethodID handle_tx_signatures_meth;
15063         jmethodID handle_tx_init_rbf_meth;
15064         jmethodID handle_tx_ack_rbf_meth;
15065         jmethodID handle_tx_abort_meth;
15066         jmethodID handle_update_add_htlc_meth;
15067         jmethodID handle_update_fulfill_htlc_meth;
15068         jmethodID handle_update_fail_htlc_meth;
15069         jmethodID handle_update_fail_malformed_htlc_meth;
15070         jmethodID handle_commitment_signed_meth;
15071         jmethodID handle_revoke_and_ack_meth;
15072         jmethodID handle_update_fee_meth;
15073         jmethodID handle_announcement_signatures_meth;
15074         jmethodID peer_disconnected_meth;
15075         jmethodID peer_connected_meth;
15076         jmethodID handle_channel_reestablish_meth;
15077         jmethodID handle_channel_update_meth;
15078         jmethodID handle_error_meth;
15079         jmethodID provided_node_features_meth;
15080         jmethodID provided_init_features_meth;
15081         jmethodID get_genesis_hashes_meth;
15082 } LDKChannelMessageHandler_JCalls;
15083 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
15084         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15085         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
15086                 JNIEnv *env;
15087                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15088                 if (get_jenv_res == JNI_EDETACHED) {
15089                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15090                 } else {
15091                         DO_ASSERT(get_jenv_res == JNI_OK);
15092                 }
15093                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
15094                 if (get_jenv_res == JNI_EDETACHED) {
15095                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15096                 }
15097                 FREE(j_calls);
15098         }
15099 }
15100 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
15101         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15102         JNIEnv *env;
15103         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15104         if (get_jenv_res == JNI_EDETACHED) {
15105                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15106         } else {
15107                 DO_ASSERT(get_jenv_res == JNI_OK);
15108         }
15109         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15110         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15111         LDKOpenChannel msg_var = *msg;
15112         int64_t msg_ref = 0;
15113         msg_var = OpenChannel_clone(&msg_var);
15114         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15115         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15116         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15117         CHECK(obj != NULL);
15118         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
15119         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15120                 (*env)->ExceptionDescribe(env);
15121                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
15122         }
15123         if (get_jenv_res == JNI_EDETACHED) {
15124                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15125         }
15126 }
15127 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
15128         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15129         JNIEnv *env;
15130         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15131         if (get_jenv_res == JNI_EDETACHED) {
15132                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15133         } else {
15134                 DO_ASSERT(get_jenv_res == JNI_OK);
15135         }
15136         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15137         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15138         LDKOpenChannelV2 msg_var = *msg;
15139         int64_t msg_ref = 0;
15140         msg_var = OpenChannelV2_clone(&msg_var);
15141         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15142         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15143         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15144         CHECK(obj != NULL);
15145         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
15146         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15147                 (*env)->ExceptionDescribe(env);
15148                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
15149         }
15150         if (get_jenv_res == JNI_EDETACHED) {
15151                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15152         }
15153 }
15154 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
15155         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15156         JNIEnv *env;
15157         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15158         if (get_jenv_res == JNI_EDETACHED) {
15159                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15160         } else {
15161                 DO_ASSERT(get_jenv_res == JNI_OK);
15162         }
15163         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15164         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15165         LDKAcceptChannel msg_var = *msg;
15166         int64_t msg_ref = 0;
15167         msg_var = AcceptChannel_clone(&msg_var);
15168         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15169         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15170         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15171         CHECK(obj != NULL);
15172         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
15173         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15174                 (*env)->ExceptionDescribe(env);
15175                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
15176         }
15177         if (get_jenv_res == JNI_EDETACHED) {
15178                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15179         }
15180 }
15181 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
15182         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15183         JNIEnv *env;
15184         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15185         if (get_jenv_res == JNI_EDETACHED) {
15186                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15187         } else {
15188                 DO_ASSERT(get_jenv_res == JNI_OK);
15189         }
15190         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15191         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15192         LDKAcceptChannelV2 msg_var = *msg;
15193         int64_t msg_ref = 0;
15194         msg_var = AcceptChannelV2_clone(&msg_var);
15195         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15196         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15197         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15198         CHECK(obj != NULL);
15199         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
15200         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15201                 (*env)->ExceptionDescribe(env);
15202                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
15203         }
15204         if (get_jenv_res == JNI_EDETACHED) {
15205                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15206         }
15207 }
15208 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
15209         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15210         JNIEnv *env;
15211         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15212         if (get_jenv_res == JNI_EDETACHED) {
15213                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15214         } else {
15215                 DO_ASSERT(get_jenv_res == JNI_OK);
15216         }
15217         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15218         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15219         LDKFundingCreated msg_var = *msg;
15220         int64_t msg_ref = 0;
15221         msg_var = FundingCreated_clone(&msg_var);
15222         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15223         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15224         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15225         CHECK(obj != NULL);
15226         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
15227         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15228                 (*env)->ExceptionDescribe(env);
15229                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
15230         }
15231         if (get_jenv_res == JNI_EDETACHED) {
15232                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15233         }
15234 }
15235 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
15236         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15237         JNIEnv *env;
15238         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15239         if (get_jenv_res == JNI_EDETACHED) {
15240                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15241         } else {
15242                 DO_ASSERT(get_jenv_res == JNI_OK);
15243         }
15244         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15245         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15246         LDKFundingSigned msg_var = *msg;
15247         int64_t msg_ref = 0;
15248         msg_var = FundingSigned_clone(&msg_var);
15249         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15250         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15251         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15252         CHECK(obj != NULL);
15253         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
15254         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15255                 (*env)->ExceptionDescribe(env);
15256                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
15257         }
15258         if (get_jenv_res == JNI_EDETACHED) {
15259                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15260         }
15261 }
15262 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
15263         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15264         JNIEnv *env;
15265         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15266         if (get_jenv_res == JNI_EDETACHED) {
15267                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15268         } else {
15269                 DO_ASSERT(get_jenv_res == JNI_OK);
15270         }
15271         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15272         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15273         LDKChannelReady msg_var = *msg;
15274         int64_t msg_ref = 0;
15275         msg_var = ChannelReady_clone(&msg_var);
15276         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15277         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15278         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15279         CHECK(obj != NULL);
15280         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
15281         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15282                 (*env)->ExceptionDescribe(env);
15283                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
15284         }
15285         if (get_jenv_res == JNI_EDETACHED) {
15286                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15287         }
15288 }
15289 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
15290         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15291         JNIEnv *env;
15292         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15293         if (get_jenv_res == JNI_EDETACHED) {
15294                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15295         } else {
15296                 DO_ASSERT(get_jenv_res == JNI_OK);
15297         }
15298         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15299         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15300         LDKShutdown msg_var = *msg;
15301         int64_t msg_ref = 0;
15302         msg_var = Shutdown_clone(&msg_var);
15303         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15304         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15305         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15306         CHECK(obj != NULL);
15307         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
15308         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15309                 (*env)->ExceptionDescribe(env);
15310                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
15311         }
15312         if (get_jenv_res == JNI_EDETACHED) {
15313                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15314         }
15315 }
15316 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
15317         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15318         JNIEnv *env;
15319         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15320         if (get_jenv_res == JNI_EDETACHED) {
15321                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15322         } else {
15323                 DO_ASSERT(get_jenv_res == JNI_OK);
15324         }
15325         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15326         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15327         LDKClosingSigned msg_var = *msg;
15328         int64_t msg_ref = 0;
15329         msg_var = ClosingSigned_clone(&msg_var);
15330         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15331         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15332         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15333         CHECK(obj != NULL);
15334         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
15335         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15336                 (*env)->ExceptionDescribe(env);
15337                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
15338         }
15339         if (get_jenv_res == JNI_EDETACHED) {
15340                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15341         }
15342 }
15343 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
15344         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15345         JNIEnv *env;
15346         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15347         if (get_jenv_res == JNI_EDETACHED) {
15348                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15349         } else {
15350                 DO_ASSERT(get_jenv_res == JNI_OK);
15351         }
15352         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15353         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15354         LDKTxAddInput msg_var = *msg;
15355         int64_t msg_ref = 0;
15356         msg_var = TxAddInput_clone(&msg_var);
15357         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15358         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15359         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15360         CHECK(obj != NULL);
15361         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
15362         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15363                 (*env)->ExceptionDescribe(env);
15364                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
15365         }
15366         if (get_jenv_res == JNI_EDETACHED) {
15367                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15368         }
15369 }
15370 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
15371         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15372         JNIEnv *env;
15373         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15374         if (get_jenv_res == JNI_EDETACHED) {
15375                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15376         } else {
15377                 DO_ASSERT(get_jenv_res == JNI_OK);
15378         }
15379         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15380         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15381         LDKTxAddOutput msg_var = *msg;
15382         int64_t msg_ref = 0;
15383         msg_var = TxAddOutput_clone(&msg_var);
15384         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15385         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15386         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15387         CHECK(obj != NULL);
15388         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
15389         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15390                 (*env)->ExceptionDescribe(env);
15391                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
15392         }
15393         if (get_jenv_res == JNI_EDETACHED) {
15394                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15395         }
15396 }
15397 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
15398         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15399         JNIEnv *env;
15400         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15401         if (get_jenv_res == JNI_EDETACHED) {
15402                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15403         } else {
15404                 DO_ASSERT(get_jenv_res == JNI_OK);
15405         }
15406         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15407         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15408         LDKTxRemoveInput msg_var = *msg;
15409         int64_t msg_ref = 0;
15410         msg_var = TxRemoveInput_clone(&msg_var);
15411         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15412         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15413         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15414         CHECK(obj != NULL);
15415         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
15416         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15417                 (*env)->ExceptionDescribe(env);
15418                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
15419         }
15420         if (get_jenv_res == JNI_EDETACHED) {
15421                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15422         }
15423 }
15424 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
15425         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15426         JNIEnv *env;
15427         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15428         if (get_jenv_res == JNI_EDETACHED) {
15429                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15430         } else {
15431                 DO_ASSERT(get_jenv_res == JNI_OK);
15432         }
15433         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15434         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15435         LDKTxRemoveOutput msg_var = *msg;
15436         int64_t msg_ref = 0;
15437         msg_var = TxRemoveOutput_clone(&msg_var);
15438         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15439         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15440         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15441         CHECK(obj != NULL);
15442         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
15443         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15444                 (*env)->ExceptionDescribe(env);
15445                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
15446         }
15447         if (get_jenv_res == JNI_EDETACHED) {
15448                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15449         }
15450 }
15451 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
15452         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15453         JNIEnv *env;
15454         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15455         if (get_jenv_res == JNI_EDETACHED) {
15456                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15457         } else {
15458                 DO_ASSERT(get_jenv_res == JNI_OK);
15459         }
15460         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15461         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15462         LDKTxComplete msg_var = *msg;
15463         int64_t msg_ref = 0;
15464         msg_var = TxComplete_clone(&msg_var);
15465         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15466         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15467         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15468         CHECK(obj != NULL);
15469         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
15470         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15471                 (*env)->ExceptionDescribe(env);
15472                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
15473         }
15474         if (get_jenv_res == JNI_EDETACHED) {
15475                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15476         }
15477 }
15478 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
15479         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15480         JNIEnv *env;
15481         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15482         if (get_jenv_res == JNI_EDETACHED) {
15483                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15484         } else {
15485                 DO_ASSERT(get_jenv_res == JNI_OK);
15486         }
15487         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15488         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15489         LDKTxSignatures msg_var = *msg;
15490         int64_t msg_ref = 0;
15491         msg_var = TxSignatures_clone(&msg_var);
15492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15493         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15494         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15495         CHECK(obj != NULL);
15496         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
15497         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15498                 (*env)->ExceptionDescribe(env);
15499                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler from rust threw an exception.");
15500         }
15501         if (get_jenv_res == JNI_EDETACHED) {
15502                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15503         }
15504 }
15505 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
15506         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15507         JNIEnv *env;
15508         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15509         if (get_jenv_res == JNI_EDETACHED) {
15510                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15511         } else {
15512                 DO_ASSERT(get_jenv_res == JNI_OK);
15513         }
15514         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15515         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15516         LDKTxInitRbf msg_var = *msg;
15517         int64_t msg_ref = 0;
15518         msg_var = TxInitRbf_clone(&msg_var);
15519         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15520         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15521         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15522         CHECK(obj != NULL);
15523         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
15524         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15525                 (*env)->ExceptionDescribe(env);
15526                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
15527         }
15528         if (get_jenv_res == JNI_EDETACHED) {
15529                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15530         }
15531 }
15532 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
15533         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15534         JNIEnv *env;
15535         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15536         if (get_jenv_res == JNI_EDETACHED) {
15537                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15538         } else {
15539                 DO_ASSERT(get_jenv_res == JNI_OK);
15540         }
15541         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15542         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15543         LDKTxAckRbf msg_var = *msg;
15544         int64_t msg_ref = 0;
15545         msg_var = TxAckRbf_clone(&msg_var);
15546         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15547         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15548         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15549         CHECK(obj != NULL);
15550         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
15551         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15552                 (*env)->ExceptionDescribe(env);
15553                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
15554         }
15555         if (get_jenv_res == JNI_EDETACHED) {
15556                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15557         }
15558 }
15559 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
15560         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15561         JNIEnv *env;
15562         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15563         if (get_jenv_res == JNI_EDETACHED) {
15564                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15565         } else {
15566                 DO_ASSERT(get_jenv_res == JNI_OK);
15567         }
15568         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15569         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15570         LDKTxAbort msg_var = *msg;
15571         int64_t msg_ref = 0;
15572         msg_var = TxAbort_clone(&msg_var);
15573         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15574         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15575         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15576         CHECK(obj != NULL);
15577         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
15578         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15579                 (*env)->ExceptionDescribe(env);
15580                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
15581         }
15582         if (get_jenv_res == JNI_EDETACHED) {
15583                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15584         }
15585 }
15586 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
15587         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15588         JNIEnv *env;
15589         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15590         if (get_jenv_res == JNI_EDETACHED) {
15591                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15592         } else {
15593                 DO_ASSERT(get_jenv_res == JNI_OK);
15594         }
15595         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15596         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15597         LDKUpdateAddHTLC msg_var = *msg;
15598         int64_t msg_ref = 0;
15599         msg_var = UpdateAddHTLC_clone(&msg_var);
15600         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15601         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15602         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15603         CHECK(obj != NULL);
15604         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
15605         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15606                 (*env)->ExceptionDescribe(env);
15607                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
15608         }
15609         if (get_jenv_res == JNI_EDETACHED) {
15610                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15611         }
15612 }
15613 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
15614         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15615         JNIEnv *env;
15616         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15617         if (get_jenv_res == JNI_EDETACHED) {
15618                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15619         } else {
15620                 DO_ASSERT(get_jenv_res == JNI_OK);
15621         }
15622         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15623         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15624         LDKUpdateFulfillHTLC msg_var = *msg;
15625         int64_t msg_ref = 0;
15626         msg_var = UpdateFulfillHTLC_clone(&msg_var);
15627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15628         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15629         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15630         CHECK(obj != NULL);
15631         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
15632         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15633                 (*env)->ExceptionDescribe(env);
15634                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
15635         }
15636         if (get_jenv_res == JNI_EDETACHED) {
15637                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15638         }
15639 }
15640 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
15641         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15642         JNIEnv *env;
15643         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15644         if (get_jenv_res == JNI_EDETACHED) {
15645                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15646         } else {
15647                 DO_ASSERT(get_jenv_res == JNI_OK);
15648         }
15649         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15650         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15651         LDKUpdateFailHTLC msg_var = *msg;
15652         int64_t msg_ref = 0;
15653         msg_var = UpdateFailHTLC_clone(&msg_var);
15654         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15655         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15656         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15657         CHECK(obj != NULL);
15658         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
15659         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15660                 (*env)->ExceptionDescribe(env);
15661                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
15662         }
15663         if (get_jenv_res == JNI_EDETACHED) {
15664                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15665         }
15666 }
15667 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
15668         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15669         JNIEnv *env;
15670         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15671         if (get_jenv_res == JNI_EDETACHED) {
15672                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15673         } else {
15674                 DO_ASSERT(get_jenv_res == JNI_OK);
15675         }
15676         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15677         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15678         LDKUpdateFailMalformedHTLC msg_var = *msg;
15679         int64_t msg_ref = 0;
15680         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
15681         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15682         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15683         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15684         CHECK(obj != NULL);
15685         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
15686         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15687                 (*env)->ExceptionDescribe(env);
15688                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
15689         }
15690         if (get_jenv_res == JNI_EDETACHED) {
15691                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15692         }
15693 }
15694 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
15695         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15696         JNIEnv *env;
15697         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15698         if (get_jenv_res == JNI_EDETACHED) {
15699                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15700         } else {
15701                 DO_ASSERT(get_jenv_res == JNI_OK);
15702         }
15703         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15704         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15705         LDKCommitmentSigned msg_var = *msg;
15706         int64_t msg_ref = 0;
15707         msg_var = CommitmentSigned_clone(&msg_var);
15708         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15709         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15710         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15711         CHECK(obj != NULL);
15712         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
15713         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15714                 (*env)->ExceptionDescribe(env);
15715                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
15716         }
15717         if (get_jenv_res == JNI_EDETACHED) {
15718                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15719         }
15720 }
15721 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
15722         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15723         JNIEnv *env;
15724         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15725         if (get_jenv_res == JNI_EDETACHED) {
15726                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15727         } else {
15728                 DO_ASSERT(get_jenv_res == JNI_OK);
15729         }
15730         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15731         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15732         LDKRevokeAndACK msg_var = *msg;
15733         int64_t msg_ref = 0;
15734         msg_var = RevokeAndACK_clone(&msg_var);
15735         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15736         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15737         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15738         CHECK(obj != NULL);
15739         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
15740         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15741                 (*env)->ExceptionDescribe(env);
15742                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
15743         }
15744         if (get_jenv_res == JNI_EDETACHED) {
15745                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15746         }
15747 }
15748 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
15749         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15750         JNIEnv *env;
15751         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15752         if (get_jenv_res == JNI_EDETACHED) {
15753                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15754         } else {
15755                 DO_ASSERT(get_jenv_res == JNI_OK);
15756         }
15757         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15758         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15759         LDKUpdateFee msg_var = *msg;
15760         int64_t msg_ref = 0;
15761         msg_var = UpdateFee_clone(&msg_var);
15762         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15763         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15764         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15765         CHECK(obj != NULL);
15766         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
15767         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15768                 (*env)->ExceptionDescribe(env);
15769                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
15770         }
15771         if (get_jenv_res == JNI_EDETACHED) {
15772                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15773         }
15774 }
15775 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
15776         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15777         JNIEnv *env;
15778         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15779         if (get_jenv_res == JNI_EDETACHED) {
15780                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15781         } else {
15782                 DO_ASSERT(get_jenv_res == JNI_OK);
15783         }
15784         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15785         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15786         LDKAnnouncementSignatures msg_var = *msg;
15787         int64_t msg_ref = 0;
15788         msg_var = AnnouncementSignatures_clone(&msg_var);
15789         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15790         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15791         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15792         CHECK(obj != NULL);
15793         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
15794         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15795                 (*env)->ExceptionDescribe(env);
15796                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
15797         }
15798         if (get_jenv_res == JNI_EDETACHED) {
15799                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15800         }
15801 }
15802 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15803         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15804         JNIEnv *env;
15805         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15806         if (get_jenv_res == JNI_EDETACHED) {
15807                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15808         } else {
15809                 DO_ASSERT(get_jenv_res == JNI_OK);
15810         }
15811         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15812         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15813         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15814         CHECK(obj != NULL);
15815         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
15816         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15817                 (*env)->ExceptionDescribe(env);
15818                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
15819         }
15820         if (get_jenv_res == JNI_EDETACHED) {
15821                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15822         }
15823 }
15824 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
15825         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15826         JNIEnv *env;
15827         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15828         if (get_jenv_res == JNI_EDETACHED) {
15829                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15830         } else {
15831                 DO_ASSERT(get_jenv_res == JNI_OK);
15832         }
15833         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15834         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15835         LDKInit msg_var = *msg;
15836         int64_t msg_ref = 0;
15837         msg_var = Init_clone(&msg_var);
15838         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15839         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15840         jboolean inbound_conv = inbound;
15841         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15842         CHECK(obj != NULL);
15843         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
15844         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15845                 (*env)->ExceptionDescribe(env);
15846                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
15847         }
15848         void* ret_ptr = untag_ptr(ret);
15849         CHECK_ACCESS(ret_ptr);
15850         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
15851         FREE(untag_ptr(ret));
15852         if (get_jenv_res == JNI_EDETACHED) {
15853                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15854         }
15855         return ret_conv;
15856 }
15857 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
15858         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15859         JNIEnv *env;
15860         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15861         if (get_jenv_res == JNI_EDETACHED) {
15862                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15863         } else {
15864                 DO_ASSERT(get_jenv_res == JNI_OK);
15865         }
15866         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15867         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15868         LDKChannelReestablish msg_var = *msg;
15869         int64_t msg_ref = 0;
15870         msg_var = ChannelReestablish_clone(&msg_var);
15871         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15872         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15873         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15874         CHECK(obj != NULL);
15875         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
15876         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15877                 (*env)->ExceptionDescribe(env);
15878                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
15879         }
15880         if (get_jenv_res == JNI_EDETACHED) {
15881                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15882         }
15883 }
15884 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
15885         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15886         JNIEnv *env;
15887         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15888         if (get_jenv_res == JNI_EDETACHED) {
15889                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15890         } else {
15891                 DO_ASSERT(get_jenv_res == JNI_OK);
15892         }
15893         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15894         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15895         LDKChannelUpdate msg_var = *msg;
15896         int64_t msg_ref = 0;
15897         msg_var = ChannelUpdate_clone(&msg_var);
15898         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15899         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15900         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15901         CHECK(obj != NULL);
15902         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
15903         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15904                 (*env)->ExceptionDescribe(env);
15905                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
15906         }
15907         if (get_jenv_res == JNI_EDETACHED) {
15908                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15909         }
15910 }
15911 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
15912         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15913         JNIEnv *env;
15914         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15915         if (get_jenv_res == JNI_EDETACHED) {
15916                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15917         } else {
15918                 DO_ASSERT(get_jenv_res == JNI_OK);
15919         }
15920         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15921         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15922         LDKErrorMessage msg_var = *msg;
15923         int64_t msg_ref = 0;
15924         msg_var = ErrorMessage_clone(&msg_var);
15925         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
15926         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
15927         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15928         CHECK(obj != NULL);
15929         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
15930         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15931                 (*env)->ExceptionDescribe(env);
15932                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
15933         }
15934         if (get_jenv_res == JNI_EDETACHED) {
15935                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15936         }
15937 }
15938 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
15939         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15940         JNIEnv *env;
15941         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15942         if (get_jenv_res == JNI_EDETACHED) {
15943                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15944         } else {
15945                 DO_ASSERT(get_jenv_res == JNI_OK);
15946         }
15947         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15948         CHECK(obj != NULL);
15949         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
15950         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15951                 (*env)->ExceptionDescribe(env);
15952                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
15953         }
15954         LDKNodeFeatures ret_conv;
15955         ret_conv.inner = untag_ptr(ret);
15956         ret_conv.is_owned = ptr_is_owned(ret);
15957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15958         if (get_jenv_res == JNI_EDETACHED) {
15959                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15960         }
15961         return ret_conv;
15962 }
15963 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
15964         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15965         JNIEnv *env;
15966         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15967         if (get_jenv_res == JNI_EDETACHED) {
15968                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15969         } else {
15970                 DO_ASSERT(get_jenv_res == JNI_OK);
15971         }
15972         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
15973         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
15974         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
15975         CHECK(obj != NULL);
15976         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
15977         if (UNLIKELY((*env)->ExceptionCheck(env))) {
15978                 (*env)->ExceptionDescribe(env);
15979                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
15980         }
15981         LDKInitFeatures ret_conv;
15982         ret_conv.inner = untag_ptr(ret);
15983         ret_conv.is_owned = ptr_is_owned(ret);
15984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
15985         if (get_jenv_res == JNI_EDETACHED) {
15986                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
15987         }
15988         return ret_conv;
15989 }
15990 LDKCOption_CVec_ChainHashZZ get_genesis_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
15991         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
15992         JNIEnv *env;
15993         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
15994         if (get_jenv_res == JNI_EDETACHED) {
15995                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
15996         } else {
15997                 DO_ASSERT(get_jenv_res == JNI_OK);
15998         }
15999         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16000         CHECK(obj != NULL);
16001         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_genesis_hashes_meth);
16002         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16003                 (*env)->ExceptionDescribe(env);
16004                 (*env)->FatalError(env, "A call to get_genesis_hashes in LDKChannelMessageHandler from rust threw an exception.");
16005         }
16006         void* ret_ptr = untag_ptr(ret);
16007         CHECK_ACCESS(ret_ptr);
16008         LDKCOption_CVec_ChainHashZZ ret_conv = *(LDKCOption_CVec_ChainHashZZ*)(ret_ptr);
16009         FREE(untag_ptr(ret));
16010         if (get_jenv_res == JNI_EDETACHED) {
16011                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16012         }
16013         return ret_conv;
16014 }
16015 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
16016         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
16017         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16018         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
16019 }
16020 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
16021         jclass c = (*env)->GetObjectClass(env, o);
16022         CHECK(c != NULL);
16023         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
16024         atomic_init(&calls->refcnt, 1);
16025         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16026         calls->o = (*env)->NewWeakGlobalRef(env, o);
16027         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
16028         CHECK(calls->handle_open_channel_meth != NULL);
16029         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
16030         CHECK(calls->handle_open_channel_v2_meth != NULL);
16031         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
16032         CHECK(calls->handle_accept_channel_meth != NULL);
16033         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
16034         CHECK(calls->handle_accept_channel_v2_meth != NULL);
16035         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
16036         CHECK(calls->handle_funding_created_meth != NULL);
16037         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
16038         CHECK(calls->handle_funding_signed_meth != NULL);
16039         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
16040         CHECK(calls->handle_channel_ready_meth != NULL);
16041         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
16042         CHECK(calls->handle_shutdown_meth != NULL);
16043         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
16044         CHECK(calls->handle_closing_signed_meth != NULL);
16045         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
16046         CHECK(calls->handle_tx_add_input_meth != NULL);
16047         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
16048         CHECK(calls->handle_tx_add_output_meth != NULL);
16049         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
16050         CHECK(calls->handle_tx_remove_input_meth != NULL);
16051         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
16052         CHECK(calls->handle_tx_remove_output_meth != NULL);
16053         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
16054         CHECK(calls->handle_tx_complete_meth != NULL);
16055         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
16056         CHECK(calls->handle_tx_signatures_meth != NULL);
16057         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
16058         CHECK(calls->handle_tx_init_rbf_meth != NULL);
16059         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
16060         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
16061         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
16062         CHECK(calls->handle_tx_abort_meth != NULL);
16063         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
16064         CHECK(calls->handle_update_add_htlc_meth != NULL);
16065         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
16066         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
16067         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
16068         CHECK(calls->handle_update_fail_htlc_meth != NULL);
16069         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
16070         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
16071         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
16072         CHECK(calls->handle_commitment_signed_meth != NULL);
16073         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
16074         CHECK(calls->handle_revoke_and_ack_meth != NULL);
16075         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
16076         CHECK(calls->handle_update_fee_meth != NULL);
16077         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
16078         CHECK(calls->handle_announcement_signatures_meth != NULL);
16079         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
16080         CHECK(calls->peer_disconnected_meth != NULL);
16081         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
16082         CHECK(calls->peer_connected_meth != NULL);
16083         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
16084         CHECK(calls->handle_channel_reestablish_meth != NULL);
16085         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
16086         CHECK(calls->handle_channel_update_meth != NULL);
16087         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
16088         CHECK(calls->handle_error_meth != NULL);
16089         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
16090         CHECK(calls->provided_node_features_meth != NULL);
16091         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
16092         CHECK(calls->provided_init_features_meth != NULL);
16093         calls->get_genesis_hashes_meth = (*env)->GetMethodID(env, c, "get_genesis_hashes", "()J");
16094         CHECK(calls->get_genesis_hashes_meth != NULL);
16095
16096         LDKChannelMessageHandler ret = {
16097                 .this_arg = (void*) calls,
16098                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
16099                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
16100                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
16101                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
16102                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
16103                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
16104                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
16105                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
16106                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
16107                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
16108                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
16109                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
16110                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
16111                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
16112                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
16113                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
16114                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
16115                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
16116                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
16117                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
16118                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
16119                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
16120                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
16121                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
16122                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
16123                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
16124                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
16125                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
16126                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
16127                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
16128                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
16129                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
16130                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
16131                 .get_genesis_hashes = get_genesis_hashes_LDKChannelMessageHandler_jcall,
16132                 .free = LDKChannelMessageHandler_JCalls_free,
16133                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
16134         };
16135         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
16136         return ret;
16137 }
16138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
16139         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16140         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
16141         return tag_ptr(res_ptr, true);
16142 }
16143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
16144         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
16145         return tag_ptr(&inp->MessageSendEventsProvider, false);
16146 }
16147 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) {
16148         void* this_arg_ptr = untag_ptr(this_arg);
16149         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16150         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16151         LDKPublicKey their_node_id_ref;
16152         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16153         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16154         LDKOpenChannel msg_conv;
16155         msg_conv.inner = untag_ptr(msg);
16156         msg_conv.is_owned = ptr_is_owned(msg);
16157         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16158         msg_conv.is_owned = false;
16159         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16160 }
16161
16162 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) {
16163         void* this_arg_ptr = untag_ptr(this_arg);
16164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16165         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16166         LDKPublicKey their_node_id_ref;
16167         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16168         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16169         LDKOpenChannelV2 msg_conv;
16170         msg_conv.inner = untag_ptr(msg);
16171         msg_conv.is_owned = ptr_is_owned(msg);
16172         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16173         msg_conv.is_owned = false;
16174         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16175 }
16176
16177 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) {
16178         void* this_arg_ptr = untag_ptr(this_arg);
16179         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16180         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16181         LDKPublicKey their_node_id_ref;
16182         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16183         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16184         LDKAcceptChannel msg_conv;
16185         msg_conv.inner = untag_ptr(msg);
16186         msg_conv.is_owned = ptr_is_owned(msg);
16187         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16188         msg_conv.is_owned = false;
16189         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16190 }
16191
16192 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) {
16193         void* this_arg_ptr = untag_ptr(this_arg);
16194         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16195         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16196         LDKPublicKey their_node_id_ref;
16197         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16198         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16199         LDKAcceptChannelV2 msg_conv;
16200         msg_conv.inner = untag_ptr(msg);
16201         msg_conv.is_owned = ptr_is_owned(msg);
16202         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16203         msg_conv.is_owned = false;
16204         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16205 }
16206
16207 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) {
16208         void* this_arg_ptr = untag_ptr(this_arg);
16209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16210         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16211         LDKPublicKey their_node_id_ref;
16212         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16213         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16214         LDKFundingCreated msg_conv;
16215         msg_conv.inner = untag_ptr(msg);
16216         msg_conv.is_owned = ptr_is_owned(msg);
16217         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16218         msg_conv.is_owned = false;
16219         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16220 }
16221
16222 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) {
16223         void* this_arg_ptr = untag_ptr(this_arg);
16224         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16225         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16226         LDKPublicKey their_node_id_ref;
16227         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16228         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16229         LDKFundingSigned msg_conv;
16230         msg_conv.inner = untag_ptr(msg);
16231         msg_conv.is_owned = ptr_is_owned(msg);
16232         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16233         msg_conv.is_owned = false;
16234         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16235 }
16236
16237 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) {
16238         void* this_arg_ptr = untag_ptr(this_arg);
16239         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16240         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16241         LDKPublicKey their_node_id_ref;
16242         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16243         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16244         LDKChannelReady msg_conv;
16245         msg_conv.inner = untag_ptr(msg);
16246         msg_conv.is_owned = ptr_is_owned(msg);
16247         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16248         msg_conv.is_owned = false;
16249         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16250 }
16251
16252 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) {
16253         void* this_arg_ptr = untag_ptr(this_arg);
16254         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16255         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16256         LDKPublicKey their_node_id_ref;
16257         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16258         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16259         LDKShutdown msg_conv;
16260         msg_conv.inner = untag_ptr(msg);
16261         msg_conv.is_owned = ptr_is_owned(msg);
16262         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16263         msg_conv.is_owned = false;
16264         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16265 }
16266
16267 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) {
16268         void* this_arg_ptr = untag_ptr(this_arg);
16269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16270         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16271         LDKPublicKey their_node_id_ref;
16272         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16273         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16274         LDKClosingSigned msg_conv;
16275         msg_conv.inner = untag_ptr(msg);
16276         msg_conv.is_owned = ptr_is_owned(msg);
16277         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16278         msg_conv.is_owned = false;
16279         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16280 }
16281
16282 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) {
16283         void* this_arg_ptr = untag_ptr(this_arg);
16284         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16285         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16286         LDKPublicKey their_node_id_ref;
16287         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16288         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16289         LDKTxAddInput msg_conv;
16290         msg_conv.inner = untag_ptr(msg);
16291         msg_conv.is_owned = ptr_is_owned(msg);
16292         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16293         msg_conv.is_owned = false;
16294         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16295 }
16296
16297 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) {
16298         void* this_arg_ptr = untag_ptr(this_arg);
16299         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16300         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16301         LDKPublicKey their_node_id_ref;
16302         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16303         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16304         LDKTxAddOutput msg_conv;
16305         msg_conv.inner = untag_ptr(msg);
16306         msg_conv.is_owned = ptr_is_owned(msg);
16307         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16308         msg_conv.is_owned = false;
16309         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16310 }
16311
16312 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) {
16313         void* this_arg_ptr = untag_ptr(this_arg);
16314         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16315         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16316         LDKPublicKey their_node_id_ref;
16317         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16318         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16319         LDKTxRemoveInput msg_conv;
16320         msg_conv.inner = untag_ptr(msg);
16321         msg_conv.is_owned = ptr_is_owned(msg);
16322         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16323         msg_conv.is_owned = false;
16324         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16325 }
16326
16327 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) {
16328         void* this_arg_ptr = untag_ptr(this_arg);
16329         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16330         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16331         LDKPublicKey their_node_id_ref;
16332         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16333         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16334         LDKTxRemoveOutput msg_conv;
16335         msg_conv.inner = untag_ptr(msg);
16336         msg_conv.is_owned = ptr_is_owned(msg);
16337         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16338         msg_conv.is_owned = false;
16339         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16340 }
16341
16342 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) {
16343         void* this_arg_ptr = untag_ptr(this_arg);
16344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16345         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16346         LDKPublicKey their_node_id_ref;
16347         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16348         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16349         LDKTxComplete msg_conv;
16350         msg_conv.inner = untag_ptr(msg);
16351         msg_conv.is_owned = ptr_is_owned(msg);
16352         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16353         msg_conv.is_owned = false;
16354         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16355 }
16356
16357 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) {
16358         void* this_arg_ptr = untag_ptr(this_arg);
16359         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16360         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16361         LDKPublicKey their_node_id_ref;
16362         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16363         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16364         LDKTxSignatures msg_conv;
16365         msg_conv.inner = untag_ptr(msg);
16366         msg_conv.is_owned = ptr_is_owned(msg);
16367         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16368         msg_conv.is_owned = false;
16369         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16370 }
16371
16372 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) {
16373         void* this_arg_ptr = untag_ptr(this_arg);
16374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16375         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16376         LDKPublicKey their_node_id_ref;
16377         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16378         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16379         LDKTxInitRbf msg_conv;
16380         msg_conv.inner = untag_ptr(msg);
16381         msg_conv.is_owned = ptr_is_owned(msg);
16382         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16383         msg_conv.is_owned = false;
16384         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16385 }
16386
16387 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) {
16388         void* this_arg_ptr = untag_ptr(this_arg);
16389         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16390         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16391         LDKPublicKey their_node_id_ref;
16392         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16393         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16394         LDKTxAckRbf msg_conv;
16395         msg_conv.inner = untag_ptr(msg);
16396         msg_conv.is_owned = ptr_is_owned(msg);
16397         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16398         msg_conv.is_owned = false;
16399         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16400 }
16401
16402 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) {
16403         void* this_arg_ptr = untag_ptr(this_arg);
16404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16405         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16406         LDKPublicKey their_node_id_ref;
16407         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16408         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16409         LDKTxAbort msg_conv;
16410         msg_conv.inner = untag_ptr(msg);
16411         msg_conv.is_owned = ptr_is_owned(msg);
16412         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16413         msg_conv.is_owned = false;
16414         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16415 }
16416
16417 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) {
16418         void* this_arg_ptr = untag_ptr(this_arg);
16419         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16420         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16421         LDKPublicKey their_node_id_ref;
16422         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16423         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16424         LDKUpdateAddHTLC msg_conv;
16425         msg_conv.inner = untag_ptr(msg);
16426         msg_conv.is_owned = ptr_is_owned(msg);
16427         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16428         msg_conv.is_owned = false;
16429         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16430 }
16431
16432 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) {
16433         void* this_arg_ptr = untag_ptr(this_arg);
16434         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16435         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16436         LDKPublicKey their_node_id_ref;
16437         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16438         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16439         LDKUpdateFulfillHTLC msg_conv;
16440         msg_conv.inner = untag_ptr(msg);
16441         msg_conv.is_owned = ptr_is_owned(msg);
16442         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16443         msg_conv.is_owned = false;
16444         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16445 }
16446
16447 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) {
16448         void* this_arg_ptr = untag_ptr(this_arg);
16449         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16450         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16451         LDKPublicKey their_node_id_ref;
16452         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16453         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16454         LDKUpdateFailHTLC msg_conv;
16455         msg_conv.inner = untag_ptr(msg);
16456         msg_conv.is_owned = ptr_is_owned(msg);
16457         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16458         msg_conv.is_owned = false;
16459         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16460 }
16461
16462 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) {
16463         void* this_arg_ptr = untag_ptr(this_arg);
16464         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16465         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16466         LDKPublicKey their_node_id_ref;
16467         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16468         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16469         LDKUpdateFailMalformedHTLC msg_conv;
16470         msg_conv.inner = untag_ptr(msg);
16471         msg_conv.is_owned = ptr_is_owned(msg);
16472         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16473         msg_conv.is_owned = false;
16474         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16475 }
16476
16477 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) {
16478         void* this_arg_ptr = untag_ptr(this_arg);
16479         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16480         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16481         LDKPublicKey their_node_id_ref;
16482         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16483         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16484         LDKCommitmentSigned msg_conv;
16485         msg_conv.inner = untag_ptr(msg);
16486         msg_conv.is_owned = ptr_is_owned(msg);
16487         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16488         msg_conv.is_owned = false;
16489         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16490 }
16491
16492 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) {
16493         void* this_arg_ptr = untag_ptr(this_arg);
16494         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16495         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16496         LDKPublicKey their_node_id_ref;
16497         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16498         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16499         LDKRevokeAndACK msg_conv;
16500         msg_conv.inner = untag_ptr(msg);
16501         msg_conv.is_owned = ptr_is_owned(msg);
16502         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16503         msg_conv.is_owned = false;
16504         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16505 }
16506
16507 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) {
16508         void* this_arg_ptr = untag_ptr(this_arg);
16509         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16510         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16511         LDKPublicKey their_node_id_ref;
16512         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16513         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16514         LDKUpdateFee msg_conv;
16515         msg_conv.inner = untag_ptr(msg);
16516         msg_conv.is_owned = ptr_is_owned(msg);
16517         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16518         msg_conv.is_owned = false;
16519         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16520 }
16521
16522 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) {
16523         void* this_arg_ptr = untag_ptr(this_arg);
16524         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16525         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16526         LDKPublicKey their_node_id_ref;
16527         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16528         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16529         LDKAnnouncementSignatures msg_conv;
16530         msg_conv.inner = untag_ptr(msg);
16531         msg_conv.is_owned = ptr_is_owned(msg);
16532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16533         msg_conv.is_owned = false;
16534         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16535 }
16536
16537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
16538         void* this_arg_ptr = untag_ptr(this_arg);
16539         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16540         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16541         LDKPublicKey their_node_id_ref;
16542         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16543         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16544         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
16545 }
16546
16547 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) {
16548         void* this_arg_ptr = untag_ptr(this_arg);
16549         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16550         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16551         LDKPublicKey their_node_id_ref;
16552         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16553         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16554         LDKInit msg_conv;
16555         msg_conv.inner = untag_ptr(msg);
16556         msg_conv.is_owned = ptr_is_owned(msg);
16557         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16558         msg_conv.is_owned = false;
16559         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
16560         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
16561         return tag_ptr(ret_conv, true);
16562 }
16563
16564 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) {
16565         void* this_arg_ptr = untag_ptr(this_arg);
16566         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16567         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16568         LDKPublicKey their_node_id_ref;
16569         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16570         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16571         LDKChannelReestablish msg_conv;
16572         msg_conv.inner = untag_ptr(msg);
16573         msg_conv.is_owned = ptr_is_owned(msg);
16574         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16575         msg_conv.is_owned = false;
16576         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16577 }
16578
16579 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) {
16580         void* this_arg_ptr = untag_ptr(this_arg);
16581         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16582         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16583         LDKPublicKey their_node_id_ref;
16584         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16585         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16586         LDKChannelUpdate msg_conv;
16587         msg_conv.inner = untag_ptr(msg);
16588         msg_conv.is_owned = ptr_is_owned(msg);
16589         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16590         msg_conv.is_owned = false;
16591         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16592 }
16593
16594 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) {
16595         void* this_arg_ptr = untag_ptr(this_arg);
16596         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16597         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16598         LDKPublicKey their_node_id_ref;
16599         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16600         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16601         LDKErrorMessage msg_conv;
16602         msg_conv.inner = untag_ptr(msg);
16603         msg_conv.is_owned = ptr_is_owned(msg);
16604         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
16605         msg_conv.is_owned = false;
16606         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
16607 }
16608
16609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
16610         void* this_arg_ptr = untag_ptr(this_arg);
16611         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16612         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16613         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
16614         int64_t ret_ref = 0;
16615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16617         return ret_ref;
16618 }
16619
16620 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) {
16621         void* this_arg_ptr = untag_ptr(this_arg);
16622         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16623         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16624         LDKPublicKey their_node_id_ref;
16625         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
16626         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
16627         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
16628         int64_t ret_ref = 0;
16629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16631         return ret_ref;
16632 }
16633
16634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1genesis_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
16635         void* this_arg_ptr = untag_ptr(this_arg);
16636         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16637         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
16638         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
16639         *ret_copy = (this_arg_conv->get_genesis_hashes)(this_arg_conv->this_arg);
16640         int64_t ret_ref = tag_ptr(ret_copy, true);
16641         return ret_ref;
16642 }
16643
16644 typedef struct LDKRoutingMessageHandler_JCalls {
16645         atomic_size_t refcnt;
16646         JavaVM *vm;
16647         jweak o;
16648         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
16649         jmethodID handle_node_announcement_meth;
16650         jmethodID handle_channel_announcement_meth;
16651         jmethodID handle_channel_update_meth;
16652         jmethodID get_next_channel_announcement_meth;
16653         jmethodID get_next_node_announcement_meth;
16654         jmethodID peer_connected_meth;
16655         jmethodID handle_reply_channel_range_meth;
16656         jmethodID handle_reply_short_channel_ids_end_meth;
16657         jmethodID handle_query_channel_range_meth;
16658         jmethodID handle_query_short_channel_ids_meth;
16659         jmethodID processing_queue_high_meth;
16660         jmethodID provided_node_features_meth;
16661         jmethodID provided_init_features_meth;
16662 } LDKRoutingMessageHandler_JCalls;
16663 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
16664         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16665         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16666                 JNIEnv *env;
16667                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16668                 if (get_jenv_res == JNI_EDETACHED) {
16669                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16670                 } else {
16671                         DO_ASSERT(get_jenv_res == JNI_OK);
16672                 }
16673                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16674                 if (get_jenv_res == JNI_EDETACHED) {
16675                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16676                 }
16677                 FREE(j_calls);
16678         }
16679 }
16680 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
16681         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16682         JNIEnv *env;
16683         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16684         if (get_jenv_res == JNI_EDETACHED) {
16685                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16686         } else {
16687                 DO_ASSERT(get_jenv_res == JNI_OK);
16688         }
16689         LDKNodeAnnouncement msg_var = *msg;
16690         int64_t msg_ref = 0;
16691         msg_var = NodeAnnouncement_clone(&msg_var);
16692         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16693         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16694         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16695         CHECK(obj != NULL);
16696         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
16697         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16698                 (*env)->ExceptionDescribe(env);
16699                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
16700         }
16701         void* ret_ptr = untag_ptr(ret);
16702         CHECK_ACCESS(ret_ptr);
16703         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16704         FREE(untag_ptr(ret));
16705         if (get_jenv_res == JNI_EDETACHED) {
16706                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16707         }
16708         return ret_conv;
16709 }
16710 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
16711         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16712         JNIEnv *env;
16713         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16714         if (get_jenv_res == JNI_EDETACHED) {
16715                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16716         } else {
16717                 DO_ASSERT(get_jenv_res == JNI_OK);
16718         }
16719         LDKChannelAnnouncement msg_var = *msg;
16720         int64_t msg_ref = 0;
16721         msg_var = ChannelAnnouncement_clone(&msg_var);
16722         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16723         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16724         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16725         CHECK(obj != NULL);
16726         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
16727         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16728                 (*env)->ExceptionDescribe(env);
16729                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
16730         }
16731         void* ret_ptr = untag_ptr(ret);
16732         CHECK_ACCESS(ret_ptr);
16733         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16734         FREE(untag_ptr(ret));
16735         if (get_jenv_res == JNI_EDETACHED) {
16736                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16737         }
16738         return ret_conv;
16739 }
16740 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
16741         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16742         JNIEnv *env;
16743         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16744         if (get_jenv_res == JNI_EDETACHED) {
16745                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16746         } else {
16747                 DO_ASSERT(get_jenv_res == JNI_OK);
16748         }
16749         LDKChannelUpdate msg_var = *msg;
16750         int64_t msg_ref = 0;
16751         msg_var = ChannelUpdate_clone(&msg_var);
16752         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16753         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16754         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16755         CHECK(obj != NULL);
16756         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
16757         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16758                 (*env)->ExceptionDescribe(env);
16759                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
16760         }
16761         void* ret_ptr = untag_ptr(ret);
16762         CHECK_ACCESS(ret_ptr);
16763         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
16764         FREE(untag_ptr(ret));
16765         if (get_jenv_res == JNI_EDETACHED) {
16766                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16767         }
16768         return ret_conv;
16769 }
16770 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
16771         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16772         JNIEnv *env;
16773         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16774         if (get_jenv_res == JNI_EDETACHED) {
16775                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16776         } else {
16777                 DO_ASSERT(get_jenv_res == JNI_OK);
16778         }
16779         int64_t starting_point_conv = starting_point;
16780         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16781         CHECK(obj != NULL);
16782         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
16783         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16784                 (*env)->ExceptionDescribe(env);
16785                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
16786         }
16787         void* ret_ptr = untag_ptr(ret);
16788         CHECK_ACCESS(ret_ptr);
16789         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
16790         FREE(untag_ptr(ret));
16791         if (get_jenv_res == JNI_EDETACHED) {
16792                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16793         }
16794         return ret_conv;
16795 }
16796 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
16797         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16798         JNIEnv *env;
16799         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16800         if (get_jenv_res == JNI_EDETACHED) {
16801                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16802         } else {
16803                 DO_ASSERT(get_jenv_res == JNI_OK);
16804         }
16805         LDKNodeId starting_point_var = starting_point;
16806         int64_t starting_point_ref = 0;
16807         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
16808         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
16809         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16810         CHECK(obj != NULL);
16811         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
16812         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16813                 (*env)->ExceptionDescribe(env);
16814                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
16815         }
16816         LDKNodeAnnouncement ret_conv;
16817         ret_conv.inner = untag_ptr(ret);
16818         ret_conv.is_owned = ptr_is_owned(ret);
16819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
16820         if (get_jenv_res == JNI_EDETACHED) {
16821                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16822         }
16823         return ret_conv;
16824 }
16825 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
16826         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16827         JNIEnv *env;
16828         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16829         if (get_jenv_res == JNI_EDETACHED) {
16830                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16831         } else {
16832                 DO_ASSERT(get_jenv_res == JNI_OK);
16833         }
16834         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16835         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16836         LDKInit init_var = *init;
16837         int64_t init_ref = 0;
16838         init_var = Init_clone(&init_var);
16839         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
16840         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
16841         jboolean inbound_conv = inbound;
16842         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16843         CHECK(obj != NULL);
16844         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
16845         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16846                 (*env)->ExceptionDescribe(env);
16847                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
16848         }
16849         void* ret_ptr = untag_ptr(ret);
16850         CHECK_ACCESS(ret_ptr);
16851         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
16852         FREE(untag_ptr(ret));
16853         if (get_jenv_res == JNI_EDETACHED) {
16854                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16855         }
16856         return ret_conv;
16857 }
16858 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
16859         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16860         JNIEnv *env;
16861         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16862         if (get_jenv_res == JNI_EDETACHED) {
16863                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16864         } else {
16865                 DO_ASSERT(get_jenv_res == JNI_OK);
16866         }
16867         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16868         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16869         LDKReplyChannelRange msg_var = msg;
16870         int64_t msg_ref = 0;
16871         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16872         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16873         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16874         CHECK(obj != NULL);
16875         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
16876         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16877                 (*env)->ExceptionDescribe(env);
16878                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
16879         }
16880         void* ret_ptr = untag_ptr(ret);
16881         CHECK_ACCESS(ret_ptr);
16882         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16883         FREE(untag_ptr(ret));
16884         if (get_jenv_res == JNI_EDETACHED) {
16885                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16886         }
16887         return ret_conv;
16888 }
16889 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
16890         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16891         JNIEnv *env;
16892         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16893         if (get_jenv_res == JNI_EDETACHED) {
16894                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16895         } else {
16896                 DO_ASSERT(get_jenv_res == JNI_OK);
16897         }
16898         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16899         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16900         LDKReplyShortChannelIdsEnd msg_var = msg;
16901         int64_t msg_ref = 0;
16902         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16903         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16904         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16905         CHECK(obj != NULL);
16906         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
16907         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16908                 (*env)->ExceptionDescribe(env);
16909                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
16910         }
16911         void* ret_ptr = untag_ptr(ret);
16912         CHECK_ACCESS(ret_ptr);
16913         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16914         FREE(untag_ptr(ret));
16915         if (get_jenv_res == JNI_EDETACHED) {
16916                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16917         }
16918         return ret_conv;
16919 }
16920 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
16921         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16922         JNIEnv *env;
16923         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16924         if (get_jenv_res == JNI_EDETACHED) {
16925                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16926         } else {
16927                 DO_ASSERT(get_jenv_res == JNI_OK);
16928         }
16929         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16930         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16931         LDKQueryChannelRange msg_var = msg;
16932         int64_t msg_ref = 0;
16933         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16934         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16935         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16936         CHECK(obj != NULL);
16937         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
16938         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16939                 (*env)->ExceptionDescribe(env);
16940                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
16941         }
16942         void* ret_ptr = untag_ptr(ret);
16943         CHECK_ACCESS(ret_ptr);
16944         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16945         FREE(untag_ptr(ret));
16946         if (get_jenv_res == JNI_EDETACHED) {
16947                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16948         }
16949         return ret_conv;
16950 }
16951 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
16952         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16953         JNIEnv *env;
16954         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16955         if (get_jenv_res == JNI_EDETACHED) {
16956                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16957         } else {
16958                 DO_ASSERT(get_jenv_res == JNI_OK);
16959         }
16960         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
16961         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
16962         LDKQueryShortChannelIds msg_var = msg;
16963         int64_t msg_ref = 0;
16964         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
16965         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
16966         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16967         CHECK(obj != NULL);
16968         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
16969         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16970                 (*env)->ExceptionDescribe(env);
16971                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
16972         }
16973         void* ret_ptr = untag_ptr(ret);
16974         CHECK_ACCESS(ret_ptr);
16975         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
16976         FREE(untag_ptr(ret));
16977         if (get_jenv_res == JNI_EDETACHED) {
16978                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16979         }
16980         return ret_conv;
16981 }
16982 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
16983         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
16984         JNIEnv *env;
16985         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16986         if (get_jenv_res == JNI_EDETACHED) {
16987                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16988         } else {
16989                 DO_ASSERT(get_jenv_res == JNI_OK);
16990         }
16991         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16992         CHECK(obj != NULL);
16993         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
16994         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16995                 (*env)->ExceptionDescribe(env);
16996                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
16997         }
16998         if (get_jenv_res == JNI_EDETACHED) {
16999                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17000         }
17001         return ret;
17002 }
17003 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
17004         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17005         JNIEnv *env;
17006         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17007         if (get_jenv_res == JNI_EDETACHED) {
17008                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17009         } else {
17010                 DO_ASSERT(get_jenv_res == JNI_OK);
17011         }
17012         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17013         CHECK(obj != NULL);
17014         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
17015         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17016                 (*env)->ExceptionDescribe(env);
17017                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
17018         }
17019         LDKNodeFeatures ret_conv;
17020         ret_conv.inner = untag_ptr(ret);
17021         ret_conv.is_owned = ptr_is_owned(ret);
17022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17023         if (get_jenv_res == JNI_EDETACHED) {
17024                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17025         }
17026         return ret_conv;
17027 }
17028 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17029         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
17030         JNIEnv *env;
17031         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17032         if (get_jenv_res == JNI_EDETACHED) {
17033                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17034         } else {
17035                 DO_ASSERT(get_jenv_res == JNI_OK);
17036         }
17037         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17038         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17039         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17040         CHECK(obj != NULL);
17041         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
17042         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17043                 (*env)->ExceptionDescribe(env);
17044                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
17045         }
17046         LDKInitFeatures ret_conv;
17047         ret_conv.inner = untag_ptr(ret);
17048         ret_conv.is_owned = ptr_is_owned(ret);
17049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17050         if (get_jenv_res == JNI_EDETACHED) {
17051                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17052         }
17053         return ret_conv;
17054 }
17055 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
17056         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
17057         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17058         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
17059 }
17060 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17061         jclass c = (*env)->GetObjectClass(env, o);
17062         CHECK(c != NULL);
17063         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
17064         atomic_init(&calls->refcnt, 1);
17065         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17066         calls->o = (*env)->NewWeakGlobalRef(env, o);
17067         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
17068         CHECK(calls->handle_node_announcement_meth != NULL);
17069         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
17070         CHECK(calls->handle_channel_announcement_meth != NULL);
17071         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
17072         CHECK(calls->handle_channel_update_meth != NULL);
17073         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
17074         CHECK(calls->get_next_channel_announcement_meth != NULL);
17075         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
17076         CHECK(calls->get_next_node_announcement_meth != NULL);
17077         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
17078         CHECK(calls->peer_connected_meth != NULL);
17079         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
17080         CHECK(calls->handle_reply_channel_range_meth != NULL);
17081         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
17082         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
17083         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
17084         CHECK(calls->handle_query_channel_range_meth != NULL);
17085         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
17086         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
17087         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
17088         CHECK(calls->processing_queue_high_meth != NULL);
17089         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17090         CHECK(calls->provided_node_features_meth != NULL);
17091         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17092         CHECK(calls->provided_init_features_meth != NULL);
17093
17094         LDKRoutingMessageHandler ret = {
17095                 .this_arg = (void*) calls,
17096                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
17097                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
17098                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
17099                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
17100                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
17101                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
17102                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
17103                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
17104                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
17105                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
17106                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
17107                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
17108                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
17109                 .free = LDKRoutingMessageHandler_JCalls_free,
17110                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
17111         };
17112         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
17113         return ret;
17114 }
17115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
17116         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
17117         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
17118         return tag_ptr(res_ptr, true);
17119 }
17120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
17121         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
17122         return tag_ptr(&inp->MessageSendEventsProvider, false);
17123 }
17124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17125         void* this_arg_ptr = untag_ptr(this_arg);
17126         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17127         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17128         LDKNodeAnnouncement msg_conv;
17129         msg_conv.inner = untag_ptr(msg);
17130         msg_conv.is_owned = ptr_is_owned(msg);
17131         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17132         msg_conv.is_owned = false;
17133         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17134         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
17135         return tag_ptr(ret_conv, true);
17136 }
17137
17138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17139         void* this_arg_ptr = untag_ptr(this_arg);
17140         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17141         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17142         LDKChannelAnnouncement msg_conv;
17143         msg_conv.inner = untag_ptr(msg);
17144         msg_conv.is_owned = ptr_is_owned(msg);
17145         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17146         msg_conv.is_owned = false;
17147         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17148         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
17149         return tag_ptr(ret_conv, true);
17150 }
17151
17152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17153         void* this_arg_ptr = untag_ptr(this_arg);
17154         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17155         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17156         LDKChannelUpdate msg_conv;
17157         msg_conv.inner = untag_ptr(msg);
17158         msg_conv.is_owned = ptr_is_owned(msg);
17159         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17160         msg_conv.is_owned = false;
17161         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
17162         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
17163         return tag_ptr(ret_conv, true);
17164 }
17165
17166 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) {
17167         void* this_arg_ptr = untag_ptr(this_arg);
17168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17169         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17170         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
17171         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
17172         int64_t ret_ref = tag_ptr(ret_copy, true);
17173         return ret_ref;
17174 }
17175
17176 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) {
17177         void* this_arg_ptr = untag_ptr(this_arg);
17178         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17179         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17180         LDKNodeId starting_point_conv;
17181         starting_point_conv.inner = untag_ptr(starting_point);
17182         starting_point_conv.is_owned = ptr_is_owned(starting_point);
17183         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
17184         starting_point_conv = NodeId_clone(&starting_point_conv);
17185         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
17186         int64_t ret_ref = 0;
17187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17189         return ret_ref;
17190 }
17191
17192 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) {
17193         void* this_arg_ptr = untag_ptr(this_arg);
17194         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17195         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17196         LDKPublicKey their_node_id_ref;
17197         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17198         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17199         LDKInit init_conv;
17200         init_conv.inner = untag_ptr(init);
17201         init_conv.is_owned = ptr_is_owned(init);
17202         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
17203         init_conv.is_owned = false;
17204         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17205         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
17206         return tag_ptr(ret_conv, true);
17207 }
17208
17209 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) {
17210         void* this_arg_ptr = untag_ptr(this_arg);
17211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17212         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17213         LDKPublicKey their_node_id_ref;
17214         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17215         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17216         LDKReplyChannelRange msg_conv;
17217         msg_conv.inner = untag_ptr(msg);
17218         msg_conv.is_owned = ptr_is_owned(msg);
17219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17220         msg_conv = ReplyChannelRange_clone(&msg_conv);
17221         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17222         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
17223         return tag_ptr(ret_conv, true);
17224 }
17225
17226 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) {
17227         void* this_arg_ptr = untag_ptr(this_arg);
17228         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17229         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17230         LDKPublicKey their_node_id_ref;
17231         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17232         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17233         LDKReplyShortChannelIdsEnd msg_conv;
17234         msg_conv.inner = untag_ptr(msg);
17235         msg_conv.is_owned = ptr_is_owned(msg);
17236         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17237         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
17238         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17239         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
17240         return tag_ptr(ret_conv, true);
17241 }
17242
17243 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) {
17244         void* this_arg_ptr = untag_ptr(this_arg);
17245         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17246         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17247         LDKPublicKey their_node_id_ref;
17248         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17249         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17250         LDKQueryChannelRange msg_conv;
17251         msg_conv.inner = untag_ptr(msg);
17252         msg_conv.is_owned = ptr_is_owned(msg);
17253         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17254         msg_conv = QueryChannelRange_clone(&msg_conv);
17255         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17256         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
17257         return tag_ptr(ret_conv, true);
17258 }
17259
17260 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) {
17261         void* this_arg_ptr = untag_ptr(this_arg);
17262         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17263         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17264         LDKPublicKey their_node_id_ref;
17265         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17266         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17267         LDKQueryShortChannelIds msg_conv;
17268         msg_conv.inner = untag_ptr(msg);
17269         msg_conv.is_owned = ptr_is_owned(msg);
17270         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17271         msg_conv = QueryShortChannelIds_clone(&msg_conv);
17272         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17273         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
17274         return tag_ptr(ret_conv, true);
17275 }
17276
17277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
17278         void* this_arg_ptr = untag_ptr(this_arg);
17279         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17280         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17281         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
17282         return ret_conv;
17283 }
17284
17285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17286         void* this_arg_ptr = untag_ptr(this_arg);
17287         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17288         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17289         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17290         int64_t ret_ref = 0;
17291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17293         return ret_ref;
17294 }
17295
17296 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) {
17297         void* this_arg_ptr = untag_ptr(this_arg);
17298         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17299         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
17300         LDKPublicKey their_node_id_ref;
17301         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17302         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17303         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17304         int64_t ret_ref = 0;
17305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17307         return ret_ref;
17308 }
17309
17310 typedef struct LDKOnionMessageProvider_JCalls {
17311         atomic_size_t refcnt;
17312         JavaVM *vm;
17313         jweak o;
17314         jmethodID next_onion_message_for_peer_meth;
17315 } LDKOnionMessageProvider_JCalls;
17316 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
17317         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
17318         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17319                 JNIEnv *env;
17320                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17321                 if (get_jenv_res == JNI_EDETACHED) {
17322                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17323                 } else {
17324                         DO_ASSERT(get_jenv_res == JNI_OK);
17325                 }
17326                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17327                 if (get_jenv_res == JNI_EDETACHED) {
17328                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17329                 }
17330                 FREE(j_calls);
17331         }
17332 }
17333 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
17334         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
17335         JNIEnv *env;
17336         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17337         if (get_jenv_res == JNI_EDETACHED) {
17338                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17339         } else {
17340                 DO_ASSERT(get_jenv_res == JNI_OK);
17341         }
17342         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
17343         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
17344         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17345         CHECK(obj != NULL);
17346         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
17347         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17348                 (*env)->ExceptionDescribe(env);
17349                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageProvider from rust threw an exception.");
17350         }
17351         LDKOnionMessage ret_conv;
17352         ret_conv.inner = untag_ptr(ret);
17353         ret_conv.is_owned = ptr_is_owned(ret);
17354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17355         if (get_jenv_res == JNI_EDETACHED) {
17356                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17357         }
17358         return ret_conv;
17359 }
17360 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
17361         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
17362         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17363 }
17364 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JNIEnv *env, jclass clz, jobject o) {
17365         jclass c = (*env)->GetObjectClass(env, o);
17366         CHECK(c != NULL);
17367         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
17368         atomic_init(&calls->refcnt, 1);
17369         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17370         calls->o = (*env)->NewWeakGlobalRef(env, o);
17371         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
17372         CHECK(calls->next_onion_message_for_peer_meth != NULL);
17373
17374         LDKOnionMessageProvider ret = {
17375                 .this_arg = (void*) calls,
17376                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
17377                 .free = LDKOnionMessageProvider_JCalls_free,
17378         };
17379         return ret;
17380 }
17381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageProvider_1new(JNIEnv *env, jclass clz, jobject o) {
17382         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
17383         *res_ptr = LDKOnionMessageProvider_init(env, clz, o);
17384         return tag_ptr(res_ptr, true);
17385 }
17386 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) {
17387         void* this_arg_ptr = untag_ptr(this_arg);
17388         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17389         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
17390         LDKPublicKey peer_node_id_ref;
17391         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
17392         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
17393         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
17394         int64_t ret_ref = 0;
17395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17397         return ret_ref;
17398 }
17399
17400 typedef struct LDKOnionMessageHandler_JCalls {
17401         atomic_size_t refcnt;
17402         JavaVM *vm;
17403         jweak o;
17404         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
17405         jmethodID handle_onion_message_meth;
17406         jmethodID peer_connected_meth;
17407         jmethodID peer_disconnected_meth;
17408         jmethodID provided_node_features_meth;
17409         jmethodID provided_init_features_meth;
17410 } LDKOnionMessageHandler_JCalls;
17411 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
17412         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17413         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17414                 JNIEnv *env;
17415                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17416                 if (get_jenv_res == JNI_EDETACHED) {
17417                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17418                 } else {
17419                         DO_ASSERT(get_jenv_res == JNI_OK);
17420                 }
17421                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17422                 if (get_jenv_res == JNI_EDETACHED) {
17423                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17424                 }
17425                 FREE(j_calls);
17426         }
17427 }
17428 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
17429         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17430         JNIEnv *env;
17431         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17432         if (get_jenv_res == JNI_EDETACHED) {
17433                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17434         } else {
17435                 DO_ASSERT(get_jenv_res == JNI_OK);
17436         }
17437         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
17438         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
17439         LDKOnionMessage msg_var = *msg;
17440         int64_t msg_ref = 0;
17441         msg_var = OnionMessage_clone(&msg_var);
17442         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
17443         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
17444         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17445         CHECK(obj != NULL);
17446         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
17447         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17448                 (*env)->ExceptionDescribe(env);
17449                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
17450         }
17451         if (get_jenv_res == JNI_EDETACHED) {
17452                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17453         }
17454 }
17455 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
17456         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17457         JNIEnv *env;
17458         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17459         if (get_jenv_res == JNI_EDETACHED) {
17460                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17461         } else {
17462                 DO_ASSERT(get_jenv_res == JNI_OK);
17463         }
17464         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17465         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17466         LDKInit init_var = *init;
17467         int64_t init_ref = 0;
17468         init_var = Init_clone(&init_var);
17469         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
17470         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
17471         jboolean inbound_conv = inbound;
17472         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17473         CHECK(obj != NULL);
17474         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
17475         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17476                 (*env)->ExceptionDescribe(env);
17477                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
17478         }
17479         void* ret_ptr = untag_ptr(ret);
17480         CHECK_ACCESS(ret_ptr);
17481         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
17482         FREE(untag_ptr(ret));
17483         if (get_jenv_res == JNI_EDETACHED) {
17484                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17485         }
17486         return ret_conv;
17487 }
17488 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17489         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17490         JNIEnv *env;
17491         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17492         if (get_jenv_res == JNI_EDETACHED) {
17493                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17494         } else {
17495                 DO_ASSERT(get_jenv_res == JNI_OK);
17496         }
17497         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17498         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17499         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17500         CHECK(obj != NULL);
17501         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
17502         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17503                 (*env)->ExceptionDescribe(env);
17504                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
17505         }
17506         if (get_jenv_res == JNI_EDETACHED) {
17507                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17508         }
17509 }
17510 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
17511         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17512         JNIEnv *env;
17513         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17514         if (get_jenv_res == JNI_EDETACHED) {
17515                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17516         } else {
17517                 DO_ASSERT(get_jenv_res == JNI_OK);
17518         }
17519         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17520         CHECK(obj != NULL);
17521         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
17522         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17523                 (*env)->ExceptionDescribe(env);
17524                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
17525         }
17526         LDKNodeFeatures ret_conv;
17527         ret_conv.inner = untag_ptr(ret);
17528         ret_conv.is_owned = ptr_is_owned(ret);
17529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17530         if (get_jenv_res == JNI_EDETACHED) {
17531                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17532         }
17533         return ret_conv;
17534 }
17535 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17536         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
17537         JNIEnv *env;
17538         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17539         if (get_jenv_res == JNI_EDETACHED) {
17540                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17541         } else {
17542                 DO_ASSERT(get_jenv_res == JNI_OK);
17543         }
17544         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17545         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17546         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17547         CHECK(obj != NULL);
17548         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
17549         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17550                 (*env)->ExceptionDescribe(env);
17551                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
17552         }
17553         LDKInitFeatures ret_conv;
17554         ret_conv.inner = untag_ptr(ret);
17555         ret_conv.is_owned = ptr_is_owned(ret);
17556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17557         if (get_jenv_res == JNI_EDETACHED) {
17558                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17559         }
17560         return ret_conv;
17561 }
17562 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
17563         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
17564         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17565         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
17566 }
17567 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
17568         jclass c = (*env)->GetObjectClass(env, o);
17569         CHECK(c != NULL);
17570         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
17571         atomic_init(&calls->refcnt, 1);
17572         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17573         calls->o = (*env)->NewWeakGlobalRef(env, o);
17574         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
17575         CHECK(calls->handle_onion_message_meth != NULL);
17576         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
17577         CHECK(calls->peer_connected_meth != NULL);
17578         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
17579         CHECK(calls->peer_disconnected_meth != NULL);
17580         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17581         CHECK(calls->provided_node_features_meth != NULL);
17582         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17583         CHECK(calls->provided_init_features_meth != NULL);
17584
17585         LDKOnionMessageHandler ret = {
17586                 .this_arg = (void*) calls,
17587                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
17588                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
17589                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
17590                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
17591                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
17592                 .free = LDKOnionMessageHandler_JCalls_free,
17593                 .OnionMessageProvider = LDKOnionMessageProvider_init(env, clz, OnionMessageProvider),
17594         };
17595         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
17596         return ret;
17597 }
17598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) {
17599         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
17600         *res_ptr = LDKOnionMessageHandler_init(env, clz, o, OnionMessageProvider);
17601         return tag_ptr(res_ptr, true);
17602 }
17603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1get_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t arg) {
17604         LDKOnionMessageHandler *inp = (LDKOnionMessageHandler *)untag_ptr(arg);
17605         return tag_ptr(&inp->OnionMessageProvider, false);
17606 }
17607 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) {
17608         void* this_arg_ptr = untag_ptr(this_arg);
17609         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17610         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17611         LDKPublicKey peer_node_id_ref;
17612         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
17613         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
17614         LDKOnionMessage msg_conv;
17615         msg_conv.inner = untag_ptr(msg);
17616         msg_conv.is_owned = ptr_is_owned(msg);
17617         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
17618         msg_conv.is_owned = false;
17619         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
17620 }
17621
17622 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) {
17623         void* this_arg_ptr = untag_ptr(this_arg);
17624         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17625         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17626         LDKPublicKey their_node_id_ref;
17627         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17628         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17629         LDKInit init_conv;
17630         init_conv.inner = untag_ptr(init);
17631         init_conv.is_owned = ptr_is_owned(init);
17632         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
17633         init_conv.is_owned = false;
17634         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
17635         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
17636         return tag_ptr(ret_conv, true);
17637 }
17638
17639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
17640         void* this_arg_ptr = untag_ptr(this_arg);
17641         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17642         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17643         LDKPublicKey their_node_id_ref;
17644         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17645         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17646         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
17647 }
17648
17649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17650         void* this_arg_ptr = untag_ptr(this_arg);
17651         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17652         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17653         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17654         int64_t ret_ref = 0;
17655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17657         return ret_ref;
17658 }
17659
17660 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) {
17661         void* this_arg_ptr = untag_ptr(this_arg);
17662         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17663         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
17664         LDKPublicKey their_node_id_ref;
17665         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
17666         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
17667         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
17668         int64_t ret_ref = 0;
17669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17671         return ret_ref;
17672 }
17673
17674 typedef struct LDKCustomMessageReader_JCalls {
17675         atomic_size_t refcnt;
17676         JavaVM *vm;
17677         jweak o;
17678         jmethodID read_meth;
17679 } LDKCustomMessageReader_JCalls;
17680 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
17681         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
17682         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17683                 JNIEnv *env;
17684                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17685                 if (get_jenv_res == JNI_EDETACHED) {
17686                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17687                 } else {
17688                         DO_ASSERT(get_jenv_res == JNI_OK);
17689                 }
17690                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17691                 if (get_jenv_res == JNI_EDETACHED) {
17692                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17693                 }
17694                 FREE(j_calls);
17695         }
17696 }
17697 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
17698         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
17699         JNIEnv *env;
17700         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17701         if (get_jenv_res == JNI_EDETACHED) {
17702                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17703         } else {
17704                 DO_ASSERT(get_jenv_res == JNI_OK);
17705         }
17706         int16_t message_type_conv = message_type;
17707         LDKu8slice buffer_var = buffer;
17708         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
17709         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
17710         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17711         CHECK(obj != NULL);
17712         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
17713         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17714                 (*env)->ExceptionDescribe(env);
17715                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
17716         }
17717         void* ret_ptr = untag_ptr(ret);
17718         CHECK_ACCESS(ret_ptr);
17719         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
17720         FREE(untag_ptr(ret));
17721         if (get_jenv_res == JNI_EDETACHED) {
17722                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17723         }
17724         return ret_conv;
17725 }
17726 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
17727         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
17728         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17729 }
17730 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
17731         jclass c = (*env)->GetObjectClass(env, o);
17732         CHECK(c != NULL);
17733         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
17734         atomic_init(&calls->refcnt, 1);
17735         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17736         calls->o = (*env)->NewWeakGlobalRef(env, o);
17737         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
17738         CHECK(calls->read_meth != NULL);
17739
17740         LDKCustomMessageReader ret = {
17741                 .this_arg = (void*) calls,
17742                 .read = read_LDKCustomMessageReader_jcall,
17743                 .free = LDKCustomMessageReader_JCalls_free,
17744         };
17745         return ret;
17746 }
17747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
17748         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
17749         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
17750         return tag_ptr(res_ptr, true);
17751 }
17752 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) {
17753         void* this_arg_ptr = untag_ptr(this_arg);
17754         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17755         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
17756         LDKu8slice buffer_ref;
17757         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
17758         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
17759         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17760         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
17761         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
17762         return tag_ptr(ret_conv, true);
17763 }
17764
17765 typedef struct LDKCustomMessageHandler_JCalls {
17766         atomic_size_t refcnt;
17767         JavaVM *vm;
17768         jweak o;
17769         LDKCustomMessageReader_JCalls* CustomMessageReader;
17770         jmethodID handle_custom_message_meth;
17771         jmethodID get_and_clear_pending_msg_meth;
17772         jmethodID provided_node_features_meth;
17773         jmethodID provided_init_features_meth;
17774 } LDKCustomMessageHandler_JCalls;
17775 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
17776         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17777         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17778                 JNIEnv *env;
17779                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17780                 if (get_jenv_res == JNI_EDETACHED) {
17781                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17782                 } else {
17783                         DO_ASSERT(get_jenv_res == JNI_OK);
17784                 }
17785                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17786                 if (get_jenv_res == JNI_EDETACHED) {
17787                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17788                 }
17789                 FREE(j_calls);
17790         }
17791 }
17792 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
17793         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17794         JNIEnv *env;
17795         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17796         if (get_jenv_res == JNI_EDETACHED) {
17797                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17798         } else {
17799                 DO_ASSERT(get_jenv_res == JNI_OK);
17800         }
17801         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
17802         *msg_ret = msg;
17803         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
17804         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
17805         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17806         CHECK(obj != NULL);
17807         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
17808         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17809                 (*env)->ExceptionDescribe(env);
17810                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
17811         }
17812         void* ret_ptr = untag_ptr(ret);
17813         CHECK_ACCESS(ret_ptr);
17814         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
17815         FREE(untag_ptr(ret));
17816         if (get_jenv_res == JNI_EDETACHED) {
17817                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17818         }
17819         return ret_conv;
17820 }
17821 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
17822         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17823         JNIEnv *env;
17824         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17825         if (get_jenv_res == JNI_EDETACHED) {
17826                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17827         } else {
17828                 DO_ASSERT(get_jenv_res == JNI_OK);
17829         }
17830         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17831         CHECK(obj != NULL);
17832         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
17833         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17834                 (*env)->ExceptionDescribe(env);
17835                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
17836         }
17837         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
17838         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
17839         if (ret_constr.datalen > 0)
17840                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
17841         else
17842                 ret_constr.data = NULL;
17843         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
17844         for (size_t z = 0; z < ret_constr.datalen; z++) {
17845                 int64_t ret_conv_25 = ret_vals[z];
17846                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
17847                 CHECK_ACCESS(ret_conv_25_ptr);
17848                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
17849                 FREE(untag_ptr(ret_conv_25));
17850                 ret_constr.data[z] = ret_conv_25_conv;
17851         }
17852         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
17853         if (get_jenv_res == JNI_EDETACHED) {
17854                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17855         }
17856         return ret_constr;
17857 }
17858 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
17859         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17860         JNIEnv *env;
17861         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17862         if (get_jenv_res == JNI_EDETACHED) {
17863                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17864         } else {
17865                 DO_ASSERT(get_jenv_res == JNI_OK);
17866         }
17867         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17868         CHECK(obj != NULL);
17869         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
17870         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17871                 (*env)->ExceptionDescribe(env);
17872                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
17873         }
17874         LDKNodeFeatures ret_conv;
17875         ret_conv.inner = untag_ptr(ret);
17876         ret_conv.is_owned = ptr_is_owned(ret);
17877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17878         if (get_jenv_res == JNI_EDETACHED) {
17879                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17880         }
17881         return ret_conv;
17882 }
17883 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
17884         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
17885         JNIEnv *env;
17886         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17887         if (get_jenv_res == JNI_EDETACHED) {
17888                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17889         } else {
17890                 DO_ASSERT(get_jenv_res == JNI_OK);
17891         }
17892         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
17893         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
17894         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17895         CHECK(obj != NULL);
17896         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
17897         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17898                 (*env)->ExceptionDescribe(env);
17899                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
17900         }
17901         LDKInitFeatures ret_conv;
17902         ret_conv.inner = untag_ptr(ret);
17903         ret_conv.is_owned = ptr_is_owned(ret);
17904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
17905         if (get_jenv_res == JNI_EDETACHED) {
17906                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17907         }
17908         return ret_conv;
17909 }
17910 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
17911         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
17912         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17913         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
17914 }
17915 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
17916         jclass c = (*env)->GetObjectClass(env, o);
17917         CHECK(c != NULL);
17918         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
17919         atomic_init(&calls->refcnt, 1);
17920         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17921         calls->o = (*env)->NewWeakGlobalRef(env, o);
17922         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
17923         CHECK(calls->handle_custom_message_meth != NULL);
17924         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
17925         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
17926         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
17927         CHECK(calls->provided_node_features_meth != NULL);
17928         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
17929         CHECK(calls->provided_init_features_meth != NULL);
17930
17931         LDKCustomMessageHandler ret = {
17932                 .this_arg = (void*) calls,
17933                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
17934                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
17935                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
17936                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
17937                 .free = LDKCustomMessageHandler_JCalls_free,
17938                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
17939         };
17940         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
17941         return ret;
17942 }
17943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
17944         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
17945         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
17946         return tag_ptr(res_ptr, true);
17947 }
17948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
17949         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
17950         return tag_ptr(&inp->CustomMessageReader, false);
17951 }
17952 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) {
17953         void* this_arg_ptr = untag_ptr(this_arg);
17954         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17955         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17956         void* msg_ptr = untag_ptr(msg);
17957         CHECK_ACCESS(msg_ptr);
17958         LDKType msg_conv = *(LDKType*)(msg_ptr);
17959         if (msg_conv.free == LDKType_JCalls_free) {
17960                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17961                 LDKType_JCalls_cloned(&msg_conv);
17962         }
17963         LDKPublicKey sender_node_id_ref;
17964         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
17965         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
17966         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17967         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
17968         return tag_ptr(ret_conv, true);
17969 }
17970
17971 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
17972         void* this_arg_ptr = untag_ptr(this_arg);
17973         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17974         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17975         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
17976         int64_tArray ret_arr = NULL;
17977         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17978         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17979         for (size_t z = 0; z < ret_var.datalen; z++) {
17980                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
17981                 *ret_conv_25_conv = ret_var.data[z];
17982                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
17983         }
17984         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17985         FREE(ret_var.data);
17986         return ret_arr;
17987 }
17988
17989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
17990         void* this_arg_ptr = untag_ptr(this_arg);
17991         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17992         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
17993         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
17994         int64_t ret_ref = 0;
17995         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17996         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17997         return ret_ref;
17998 }
17999
18000 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) {
18001         void* this_arg_ptr = untag_ptr(this_arg);
18002         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18003         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
18004         LDKPublicKey their_node_id_ref;
18005         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
18006         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
18007         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
18008         int64_t ret_ref = 0;
18009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
18010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
18011         return ret_ref;
18012 }
18013
18014 typedef struct LDKOffersMessageHandler_JCalls {
18015         atomic_size_t refcnt;
18016         JavaVM *vm;
18017         jweak o;
18018         jmethodID handle_message_meth;
18019 } LDKOffersMessageHandler_JCalls;
18020 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
18021         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
18022         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18023                 JNIEnv *env;
18024                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18025                 if (get_jenv_res == JNI_EDETACHED) {
18026                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18027                 } else {
18028                         DO_ASSERT(get_jenv_res == JNI_OK);
18029                 }
18030                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18031                 if (get_jenv_res == JNI_EDETACHED) {
18032                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18033                 }
18034                 FREE(j_calls);
18035         }
18036 }
18037 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
18038         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
18039         JNIEnv *env;
18040         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18041         if (get_jenv_res == JNI_EDETACHED) {
18042                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18043         } else {
18044                 DO_ASSERT(get_jenv_res == JNI_OK);
18045         }
18046         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
18047         *message_copy = message;
18048         int64_t message_ref = tag_ptr(message_copy, true);
18049         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18050         CHECK(obj != NULL);
18051         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
18052         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18053                 (*env)->ExceptionDescribe(env);
18054                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
18055         }
18056         void* ret_ptr = untag_ptr(ret);
18057         CHECK_ACCESS(ret_ptr);
18058         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
18059         FREE(untag_ptr(ret));
18060         if (get_jenv_res == JNI_EDETACHED) {
18061                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18062         }
18063         return ret_conv;
18064 }
18065 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
18066         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
18067         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18068 }
18069 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
18070         jclass c = (*env)->GetObjectClass(env, o);
18071         CHECK(c != NULL);
18072         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
18073         atomic_init(&calls->refcnt, 1);
18074         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18075         calls->o = (*env)->NewWeakGlobalRef(env, o);
18076         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
18077         CHECK(calls->handle_message_meth != NULL);
18078
18079         LDKOffersMessageHandler ret = {
18080                 .this_arg = (void*) calls,
18081                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
18082                 .free = LDKOffersMessageHandler_JCalls_free,
18083         };
18084         return ret;
18085 }
18086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18087         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
18088         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
18089         return tag_ptr(res_ptr, true);
18090 }
18091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
18092         void* this_arg_ptr = untag_ptr(this_arg);
18093         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18094         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
18095         void* message_ptr = untag_ptr(message);
18096         CHECK_ACCESS(message_ptr);
18097         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
18098         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
18099         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
18100         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
18101         int64_t ret_ref = tag_ptr(ret_copy, true);
18102         return ret_ref;
18103 }
18104
18105 typedef struct LDKCustomOnionMessageHandler_JCalls {
18106         atomic_size_t refcnt;
18107         JavaVM *vm;
18108         jweak o;
18109         jmethodID handle_custom_message_meth;
18110         jmethodID read_custom_message_meth;
18111 } LDKCustomOnionMessageHandler_JCalls;
18112 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
18113         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
18114         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18115                 JNIEnv *env;
18116                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18117                 if (get_jenv_res == JNI_EDETACHED) {
18118                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18119                 } else {
18120                         DO_ASSERT(get_jenv_res == JNI_OK);
18121                 }
18122                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18123                 if (get_jenv_res == JNI_EDETACHED) {
18124                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18125                 }
18126                 FREE(j_calls);
18127         }
18128 }
18129 LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
18130         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
18131         JNIEnv *env;
18132         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18133         if (get_jenv_res == JNI_EDETACHED) {
18134                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18135         } else {
18136                 DO_ASSERT(get_jenv_res == JNI_OK);
18137         }
18138         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
18139         *msg_ret = msg;
18140         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18141         CHECK(obj != NULL);
18142         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
18143         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18144                 (*env)->ExceptionDescribe(env);
18145                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
18146         }
18147         void* ret_ptr = untag_ptr(ret);
18148         CHECK_ACCESS(ret_ptr);
18149         LDKCOption_CustomOnionMessageContentsZ ret_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(ret_ptr);
18150         FREE(untag_ptr(ret));
18151         if (get_jenv_res == JNI_EDETACHED) {
18152                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18153         }
18154         return ret_conv;
18155 }
18156 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
18157         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
18158         JNIEnv *env;
18159         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18160         if (get_jenv_res == JNI_EDETACHED) {
18161                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18162         } else {
18163                 DO_ASSERT(get_jenv_res == JNI_OK);
18164         }
18165         int64_t message_type_conv = message_type;
18166         LDKu8slice buffer_var = buffer;
18167         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
18168         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
18169         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18170         CHECK(obj != NULL);
18171         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
18172         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18173                 (*env)->ExceptionDescribe(env);
18174                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
18175         }
18176         void* ret_ptr = untag_ptr(ret);
18177         CHECK_ACCESS(ret_ptr);
18178         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
18179         FREE(untag_ptr(ret));
18180         if (get_jenv_res == JNI_EDETACHED) {
18181                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18182         }
18183         return ret_conv;
18184 }
18185 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
18186         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
18187         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18188 }
18189 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
18190         jclass c = (*env)->GetObjectClass(env, o);
18191         CHECK(c != NULL);
18192         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
18193         atomic_init(&calls->refcnt, 1);
18194         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18195         calls->o = (*env)->NewWeakGlobalRef(env, o);
18196         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
18197         CHECK(calls->handle_custom_message_meth != NULL);
18198         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
18199         CHECK(calls->read_custom_message_meth != NULL);
18200
18201         LDKCustomOnionMessageHandler ret = {
18202                 .this_arg = (void*) calls,
18203                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
18204                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
18205                 .free = LDKCustomOnionMessageHandler_JCalls_free,
18206         };
18207         return ret;
18208 }
18209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18210         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
18211         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
18212         return tag_ptr(res_ptr, true);
18213 }
18214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
18215         void* this_arg_ptr = untag_ptr(this_arg);
18216         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18217         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
18218         void* msg_ptr = untag_ptr(msg);
18219         CHECK_ACCESS(msg_ptr);
18220         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
18221         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
18222                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18223                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
18224         }
18225         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18226         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
18227         int64_t ret_ref = tag_ptr(ret_copy, true);
18228         return ret_ref;
18229 }
18230
18231 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) {
18232         void* this_arg_ptr = untag_ptr(this_arg);
18233         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18234         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
18235         LDKu8slice buffer_ref;
18236         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
18237         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
18238         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18239         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
18240         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
18241         return tag_ptr(ret_conv, true);
18242 }
18243
18244 typedef struct LDKSocketDescriptor_JCalls {
18245         atomic_size_t refcnt;
18246         JavaVM *vm;
18247         jweak o;
18248         jmethodID send_data_meth;
18249         jmethodID disconnect_socket_meth;
18250         jmethodID eq_meth;
18251         jmethodID hash_meth;
18252 } LDKSocketDescriptor_JCalls;
18253 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
18254         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18255         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18256                 JNIEnv *env;
18257                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18258                 if (get_jenv_res == JNI_EDETACHED) {
18259                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18260                 } else {
18261                         DO_ASSERT(get_jenv_res == JNI_OK);
18262                 }
18263                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18264                 if (get_jenv_res == JNI_EDETACHED) {
18265                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18266                 }
18267                 FREE(j_calls);
18268         }
18269 }
18270 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
18271         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18272         JNIEnv *env;
18273         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18274         if (get_jenv_res == JNI_EDETACHED) {
18275                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18276         } else {
18277                 DO_ASSERT(get_jenv_res == JNI_OK);
18278         }
18279         LDKu8slice data_var = data;
18280         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
18281         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
18282         jboolean resume_read_conv = resume_read;
18283         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18284         CHECK(obj != NULL);
18285         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
18286         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18287                 (*env)->ExceptionDescribe(env);
18288                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
18289         }
18290         if (get_jenv_res == JNI_EDETACHED) {
18291                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18292         }
18293         return ret;
18294 }
18295 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
18296         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18297         JNIEnv *env;
18298         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18299         if (get_jenv_res == JNI_EDETACHED) {
18300                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18301         } else {
18302                 DO_ASSERT(get_jenv_res == JNI_OK);
18303         }
18304         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18305         CHECK(obj != NULL);
18306         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
18307         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18308                 (*env)->ExceptionDescribe(env);
18309                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
18310         }
18311         if (get_jenv_res == JNI_EDETACHED) {
18312                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18313         }
18314 }
18315 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
18316         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18317         JNIEnv *env;
18318         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18319         if (get_jenv_res == JNI_EDETACHED) {
18320                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18321         } else {
18322                 DO_ASSERT(get_jenv_res == JNI_OK);
18323         }
18324         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
18325         *other_arg_clone = SocketDescriptor_clone(other_arg);
18326         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18327         CHECK(obj != NULL);
18328         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
18329         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18330                 (*env)->ExceptionDescribe(env);
18331                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
18332         }
18333         if (get_jenv_res == JNI_EDETACHED) {
18334                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18335         }
18336         return ret;
18337 }
18338 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
18339         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
18340         JNIEnv *env;
18341         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18342         if (get_jenv_res == JNI_EDETACHED) {
18343                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18344         } else {
18345                 DO_ASSERT(get_jenv_res == JNI_OK);
18346         }
18347         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18348         CHECK(obj != NULL);
18349         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
18350         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18351                 (*env)->ExceptionDescribe(env);
18352                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
18353         }
18354         if (get_jenv_res == JNI_EDETACHED) {
18355                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18356         }
18357         return ret;
18358 }
18359 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
18360         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
18361         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18362 }
18363 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
18364         jclass c = (*env)->GetObjectClass(env, o);
18365         CHECK(c != NULL);
18366         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
18367         atomic_init(&calls->refcnt, 1);
18368         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18369         calls->o = (*env)->NewWeakGlobalRef(env, o);
18370         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
18371         CHECK(calls->send_data_meth != NULL);
18372         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
18373         CHECK(calls->disconnect_socket_meth != NULL);
18374         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
18375         CHECK(calls->eq_meth != NULL);
18376         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
18377         CHECK(calls->hash_meth != NULL);
18378
18379         LDKSocketDescriptor ret = {
18380                 .this_arg = (void*) calls,
18381                 .send_data = send_data_LDKSocketDescriptor_jcall,
18382                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
18383                 .eq = eq_LDKSocketDescriptor_jcall,
18384                 .hash = hash_LDKSocketDescriptor_jcall,
18385                 .cloned = LDKSocketDescriptor_JCalls_cloned,
18386                 .free = LDKSocketDescriptor_JCalls_free,
18387         };
18388         return ret;
18389 }
18390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
18391         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
18392         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
18393         return tag_ptr(res_ptr, true);
18394 }
18395 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) {
18396         void* this_arg_ptr = untag_ptr(this_arg);
18397         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18398         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
18399         LDKu8slice data_ref;
18400         data_ref.datalen = (*env)->GetArrayLength(env, data);
18401         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
18402         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
18403         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
18404         return ret_conv;
18405 }
18406
18407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
18408         void* this_arg_ptr = untag_ptr(this_arg);
18409         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18410         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
18411         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
18412 }
18413
18414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
18415         void* this_arg_ptr = untag_ptr(this_arg);
18416         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18417         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
18418         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
18419         return ret_conv;
18420 }
18421
18422 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
18423 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
18424 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
18425 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
18426 static jclass LDKEffectiveCapacity_Total_class = NULL;
18427 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
18428 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
18429 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
18430 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
18431 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
18432 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
18433 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
18434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
18435         LDKEffectiveCapacity_ExactLiquidity_class =
18436                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
18437         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
18438         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
18439         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
18440         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
18441                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
18442         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
18443         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
18444         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
18445         LDKEffectiveCapacity_Total_class =
18446                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
18447         CHECK(LDKEffectiveCapacity_Total_class != NULL);
18448         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
18449         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
18450         LDKEffectiveCapacity_Infinite_class =
18451                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
18452         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
18453         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
18454         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
18455         LDKEffectiveCapacity_HintMaxHTLC_class =
18456                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
18457         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
18458         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
18459         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
18460         LDKEffectiveCapacity_Unknown_class =
18461                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
18462         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
18463         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
18464         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
18465 }
18466 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18467         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
18468         switch(obj->tag) {
18469                 case LDKEffectiveCapacity_ExactLiquidity: {
18470                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
18471                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
18472                 }
18473                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
18474                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
18475                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
18476                 }
18477                 case LDKEffectiveCapacity_Total: {
18478                         int64_t capacity_msat_conv = obj->total.capacity_msat;
18479                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
18480                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
18481                 }
18482                 case LDKEffectiveCapacity_Infinite: {
18483                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
18484                 }
18485                 case LDKEffectiveCapacity_HintMaxHTLC: {
18486                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
18487                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
18488                 }
18489                 case LDKEffectiveCapacity_Unknown: {
18490                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
18491                 }
18492                 default: abort();
18493         }
18494 }
18495 static jclass LDKPayee_Blinded_class = NULL;
18496 static jmethodID LDKPayee_Blinded_meth = NULL;
18497 static jclass LDKPayee_Clear_class = NULL;
18498 static jmethodID LDKPayee_Clear_meth = NULL;
18499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
18500         LDKPayee_Blinded_class =
18501                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
18502         CHECK(LDKPayee_Blinded_class != NULL);
18503         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
18504         CHECK(LDKPayee_Blinded_meth != NULL);
18505         LDKPayee_Clear_class =
18506                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
18507         CHECK(LDKPayee_Clear_class != NULL);
18508         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
18509         CHECK(LDKPayee_Clear_meth != NULL);
18510 }
18511 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18512         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
18513         switch(obj->tag) {
18514                 case LDKPayee_Blinded: {
18515                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
18516                         int64_tArray route_hints_arr = NULL;
18517                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
18518                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
18519                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
18520                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
18521                                 *route_hints_conv_37_conv = route_hints_var.data[l];
18522                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
18523                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
18524                         }
18525                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
18526                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
18527                         int64_t features_ref = 0;
18528                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
18529                         features_ref = tag_ptr(features_var.inner, false);
18530                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
18531                 }
18532                 case LDKPayee_Clear: {
18533                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
18534                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
18535                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
18536                         int64_tArray route_hints_arr = NULL;
18537                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
18538                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
18539                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
18540                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
18541                                 int64_t route_hints_conv_11_ref = 0;
18542                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
18543                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
18544                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
18545                         }
18546                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
18547                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
18548                         int64_t features_ref = 0;
18549                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
18550                         features_ref = tag_ptr(features_var.inner, false);
18551                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
18552                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
18553                 }
18554                 default: abort();
18555         }
18556 }
18557 static jclass LDKDestination_Node_class = NULL;
18558 static jmethodID LDKDestination_Node_meth = NULL;
18559 static jclass LDKDestination_BlindedPath_class = NULL;
18560 static jmethodID LDKDestination_BlindedPath_meth = NULL;
18561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
18562         LDKDestination_Node_class =
18563                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
18564         CHECK(LDKDestination_Node_class != NULL);
18565         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
18566         CHECK(LDKDestination_Node_meth != NULL);
18567         LDKDestination_BlindedPath_class =
18568                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
18569         CHECK(LDKDestination_BlindedPath_class != NULL);
18570         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
18571         CHECK(LDKDestination_BlindedPath_meth != NULL);
18572 }
18573 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18574         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
18575         switch(obj->tag) {
18576                 case LDKDestination_Node: {
18577                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
18578                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
18579                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
18580                 }
18581                 case LDKDestination_BlindedPath: {
18582                         LDKBlindedPath blinded_path_var = obj->blinded_path;
18583                         int64_t blinded_path_ref = 0;
18584                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
18585                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
18586                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
18587                 }
18588                 default: abort();
18589         }
18590 }
18591 typedef struct LDKMessageRouter_JCalls {
18592         atomic_size_t refcnt;
18593         JavaVM *vm;
18594         jweak o;
18595         jmethodID find_path_meth;
18596 } LDKMessageRouter_JCalls;
18597 static void LDKMessageRouter_JCalls_free(void* this_arg) {
18598         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
18599         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18600                 JNIEnv *env;
18601                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18602                 if (get_jenv_res == JNI_EDETACHED) {
18603                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18604                 } else {
18605                         DO_ASSERT(get_jenv_res == JNI_OK);
18606                 }
18607                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18608                 if (get_jenv_res == JNI_EDETACHED) {
18609                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18610                 }
18611                 FREE(j_calls);
18612         }
18613 }
18614 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
18615         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
18616         JNIEnv *env;
18617         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18618         if (get_jenv_res == JNI_EDETACHED) {
18619                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18620         } else {
18621                 DO_ASSERT(get_jenv_res == JNI_OK);
18622         }
18623         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
18624         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
18625         LDKCVec_PublicKeyZ peers_var = peers;
18626         jobjectArray peers_arr = NULL;
18627         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
18628         ;
18629         for (size_t i = 0; i < peers_var.datalen; i++) {
18630                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
18631                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
18632                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
18633         }
18634         
18635         FREE(peers_var.data);
18636         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
18637         *destination_copy = destination;
18638         int64_t destination_ref = tag_ptr(destination_copy, true);
18639         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18640         CHECK(obj != NULL);
18641         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
18642         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18643                 (*env)->ExceptionDescribe(env);
18644                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
18645         }
18646         void* ret_ptr = untag_ptr(ret);
18647         CHECK_ACCESS(ret_ptr);
18648         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
18649         FREE(untag_ptr(ret));
18650         if (get_jenv_res == JNI_EDETACHED) {
18651                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18652         }
18653         return ret_conv;
18654 }
18655 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
18656         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
18657         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18658 }
18659 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
18660         jclass c = (*env)->GetObjectClass(env, o);
18661         CHECK(c != NULL);
18662         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
18663         atomic_init(&calls->refcnt, 1);
18664         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18665         calls->o = (*env)->NewWeakGlobalRef(env, o);
18666         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
18667         CHECK(calls->find_path_meth != NULL);
18668
18669         LDKMessageRouter ret = {
18670                 .this_arg = (void*) calls,
18671                 .find_path = find_path_LDKMessageRouter_jcall,
18672                 .free = LDKMessageRouter_JCalls_free,
18673         };
18674         return ret;
18675 }
18676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
18677         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
18678         *res_ptr = LDKMessageRouter_init(env, clz, o);
18679         return tag_ptr(res_ptr, true);
18680 }
18681 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) {
18682         void* this_arg_ptr = untag_ptr(this_arg);
18683         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18684         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
18685         LDKPublicKey sender_ref;
18686         CHECK((*env)->GetArrayLength(env, sender) == 33);
18687         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
18688         LDKCVec_PublicKeyZ peers_constr;
18689         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
18690         if (peers_constr.datalen > 0)
18691                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
18692         else
18693                 peers_constr.data = NULL;
18694         for (size_t i = 0; i < peers_constr.datalen; i++) {
18695                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
18696                 LDKPublicKey peers_conv_8_ref;
18697                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
18698                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
18699                 peers_constr.data[i] = peers_conv_8_ref;
18700         }
18701         void* destination_ptr = untag_ptr(destination);
18702         CHECK_ACCESS(destination_ptr);
18703         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
18704         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
18705         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
18706         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
18707         return tag_ptr(ret_conv, true);
18708 }
18709
18710 static jclass LDKOnionMessageContents_Offers_class = NULL;
18711 static jmethodID LDKOnionMessageContents_Offers_meth = NULL;
18712 static jclass LDKOnionMessageContents_Custom_class = NULL;
18713 static jmethodID LDKOnionMessageContents_Custom_meth = NULL;
18714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOnionMessageContents_init (JNIEnv *env, jclass clz) {
18715         LDKOnionMessageContents_Offers_class =
18716                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Offers"));
18717         CHECK(LDKOnionMessageContents_Offers_class != NULL);
18718         LDKOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Offers_class, "<init>", "(J)V");
18719         CHECK(LDKOnionMessageContents_Offers_meth != NULL);
18720         LDKOnionMessageContents_Custom_class =
18721                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Custom"));
18722         CHECK(LDKOnionMessageContents_Custom_class != NULL);
18723         LDKOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Custom_class, "<init>", "(J)V");
18724         CHECK(LDKOnionMessageContents_Custom_meth != NULL);
18725 }
18726 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18727         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
18728         switch(obj->tag) {
18729                 case LDKOnionMessageContents_Offers: {
18730                         int64_t offers_ref = tag_ptr(&obj->offers, false);
18731                         return (*env)->NewObject(env, LDKOnionMessageContents_Offers_class, LDKOnionMessageContents_Offers_meth, offers_ref);
18732                 }
18733                 case LDKOnionMessageContents_Custom: {
18734                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
18735                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
18736                         return (*env)->NewObject(env, LDKOnionMessageContents_Custom_class, LDKOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
18737                 }
18738                 default: abort();
18739         }
18740 }
18741 typedef struct LDKCoinSelectionSource_JCalls {
18742         atomic_size_t refcnt;
18743         JavaVM *vm;
18744         jweak o;
18745         jmethodID select_confirmed_utxos_meth;
18746         jmethodID sign_tx_meth;
18747 } LDKCoinSelectionSource_JCalls;
18748 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
18749         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
18750         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18751                 JNIEnv *env;
18752                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18753                 if (get_jenv_res == JNI_EDETACHED) {
18754                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18755                 } else {
18756                         DO_ASSERT(get_jenv_res == JNI_OK);
18757                 }
18758                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18759                 if (get_jenv_res == JNI_EDETACHED) {
18760                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18761                 }
18762                 FREE(j_calls);
18763         }
18764 }
18765 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) {
18766         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
18767         JNIEnv *env;
18768         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18769         if (get_jenv_res == JNI_EDETACHED) {
18770                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18771         } else {
18772                 DO_ASSERT(get_jenv_res == JNI_OK);
18773         }
18774         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
18775         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
18776         LDKCVec_InputZ must_spend_var = must_spend;
18777         int64_tArray must_spend_arr = NULL;
18778         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
18779         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
18780         for (size_t h = 0; h < must_spend_var.datalen; h++) {
18781                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
18782                 int64_t must_spend_conv_7_ref = 0;
18783                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
18784                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
18785                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
18786         }
18787         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
18788         FREE(must_spend_var.data);
18789         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
18790         int64_tArray must_pay_to_arr = NULL;
18791         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
18792         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
18793         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
18794                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
18795                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
18796                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
18797         }
18798         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
18799         FREE(must_pay_to_var.data);
18800         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
18801         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18802         CHECK(obj != NULL);
18803         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);
18804         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18805                 (*env)->ExceptionDescribe(env);
18806                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
18807         }
18808         void* ret_ptr = untag_ptr(ret);
18809         CHECK_ACCESS(ret_ptr);
18810         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
18811         FREE(untag_ptr(ret));
18812         if (get_jenv_res == JNI_EDETACHED) {
18813                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18814         }
18815         return ret_conv;
18816 }
18817 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
18818         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
18819         JNIEnv *env;
18820         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18821         if (get_jenv_res == JNI_EDETACHED) {
18822                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18823         } else {
18824                 DO_ASSERT(get_jenv_res == JNI_OK);
18825         }
18826         LDKTransaction tx_var = tx;
18827         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
18828         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
18829         Transaction_free(tx_var);
18830         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18831         CHECK(obj != NULL);
18832         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
18833         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18834                 (*env)->ExceptionDescribe(env);
18835                 (*env)->FatalError(env, "A call to sign_tx in LDKCoinSelectionSource from rust threw an exception.");
18836         }
18837         void* ret_ptr = untag_ptr(ret);
18838         CHECK_ACCESS(ret_ptr);
18839         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
18840         FREE(untag_ptr(ret));
18841         if (get_jenv_res == JNI_EDETACHED) {
18842                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18843         }
18844         return ret_conv;
18845 }
18846 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
18847         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
18848         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18849 }
18850 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
18851         jclass c = (*env)->GetObjectClass(env, o);
18852         CHECK(c != NULL);
18853         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
18854         atomic_init(&calls->refcnt, 1);
18855         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18856         calls->o = (*env)->NewWeakGlobalRef(env, o);
18857         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
18858         CHECK(calls->select_confirmed_utxos_meth != NULL);
18859         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
18860         CHECK(calls->sign_tx_meth != NULL);
18861
18862         LDKCoinSelectionSource ret = {
18863                 .this_arg = (void*) calls,
18864                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
18865                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
18866                 .free = LDKCoinSelectionSource_JCalls_free,
18867         };
18868         return ret;
18869 }
18870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
18871         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
18872         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
18873         return tag_ptr(res_ptr, true);
18874 }
18875 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) {
18876         void* this_arg_ptr = untag_ptr(this_arg);
18877         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18878         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
18879         LDKThirtyTwoBytes claim_id_ref;
18880         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
18881         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
18882         LDKCVec_InputZ must_spend_constr;
18883         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
18884         if (must_spend_constr.datalen > 0)
18885                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
18886         else
18887                 must_spend_constr.data = NULL;
18888         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
18889         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
18890                 int64_t must_spend_conv_7 = must_spend_vals[h];
18891                 LDKInput must_spend_conv_7_conv;
18892                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
18893                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
18894                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
18895                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
18896                 must_spend_constr.data[h] = must_spend_conv_7_conv;
18897         }
18898         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
18899         LDKCVec_TxOutZ must_pay_to_constr;
18900         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
18901         if (must_pay_to_constr.datalen > 0)
18902                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
18903         else
18904                 must_pay_to_constr.data = NULL;
18905         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
18906         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
18907                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
18908                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
18909                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
18910                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
18911                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
18912                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
18913         }
18914         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
18915         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
18916         *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);
18917         return tag_ptr(ret_conv, true);
18918 }
18919
18920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
18921         void* this_arg_ptr = untag_ptr(this_arg);
18922         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18923         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
18924         LDKTransaction tx_ref;
18925         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
18926         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
18927         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
18928         tx_ref.data_is_owned = true;
18929         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18930         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
18931         return tag_ptr(ret_conv, true);
18932 }
18933
18934 typedef struct LDKWalletSource_JCalls {
18935         atomic_size_t refcnt;
18936         JavaVM *vm;
18937         jweak o;
18938         jmethodID list_confirmed_utxos_meth;
18939         jmethodID get_change_script_meth;
18940         jmethodID sign_tx_meth;
18941 } LDKWalletSource_JCalls;
18942 static void LDKWalletSource_JCalls_free(void* this_arg) {
18943         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18944         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18945                 JNIEnv *env;
18946                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18947                 if (get_jenv_res == JNI_EDETACHED) {
18948                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18949                 } else {
18950                         DO_ASSERT(get_jenv_res == JNI_OK);
18951                 }
18952                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18953                 if (get_jenv_res == JNI_EDETACHED) {
18954                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18955                 }
18956                 FREE(j_calls);
18957         }
18958 }
18959 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
18960         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18961         JNIEnv *env;
18962         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18963         if (get_jenv_res == JNI_EDETACHED) {
18964                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18965         } else {
18966                 DO_ASSERT(get_jenv_res == JNI_OK);
18967         }
18968         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18969         CHECK(obj != NULL);
18970         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
18971         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18972                 (*env)->ExceptionDescribe(env);
18973                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
18974         }
18975         void* ret_ptr = untag_ptr(ret);
18976         CHECK_ACCESS(ret_ptr);
18977         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
18978         FREE(untag_ptr(ret));
18979         if (get_jenv_res == JNI_EDETACHED) {
18980                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18981         }
18982         return ret_conv;
18983 }
18984 LDKCResult_ScriptNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
18985         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
18986         JNIEnv *env;
18987         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18988         if (get_jenv_res == JNI_EDETACHED) {
18989                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18990         } else {
18991                 DO_ASSERT(get_jenv_res == JNI_OK);
18992         }
18993         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18994         CHECK(obj != NULL);
18995         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
18996         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18997                 (*env)->ExceptionDescribe(env);
18998                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
18999         }
19000         void* ret_ptr = untag_ptr(ret);
19001         CHECK_ACCESS(ret_ptr);
19002         LDKCResult_ScriptNoneZ ret_conv = *(LDKCResult_ScriptNoneZ*)(ret_ptr);
19003         FREE(untag_ptr(ret));
19004         if (get_jenv_res == JNI_EDETACHED) {
19005                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19006         }
19007         return ret_conv;
19008 }
19009 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
19010         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
19011         JNIEnv *env;
19012         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19013         if (get_jenv_res == JNI_EDETACHED) {
19014                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19015         } else {
19016                 DO_ASSERT(get_jenv_res == JNI_OK);
19017         }
19018         LDKTransaction tx_var = tx;
19019         int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
19020         (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
19021         Transaction_free(tx_var);
19022         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19023         CHECK(obj != NULL);
19024         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_tx_meth, tx_arr);
19025         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19026                 (*env)->ExceptionDescribe(env);
19027                 (*env)->FatalError(env, "A call to sign_tx in LDKWalletSource from rust threw an exception.");
19028         }
19029         void* ret_ptr = untag_ptr(ret);
19030         CHECK_ACCESS(ret_ptr);
19031         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
19032         FREE(untag_ptr(ret));
19033         if (get_jenv_res == JNI_EDETACHED) {
19034                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19035         }
19036         return ret_conv;
19037 }
19038 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
19039         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
19040         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
19041 }
19042 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
19043         jclass c = (*env)->GetObjectClass(env, o);
19044         CHECK(c != NULL);
19045         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
19046         atomic_init(&calls->refcnt, 1);
19047         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
19048         calls->o = (*env)->NewWeakGlobalRef(env, o);
19049         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
19050         CHECK(calls->list_confirmed_utxos_meth != NULL);
19051         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
19052         CHECK(calls->get_change_script_meth != NULL);
19053         calls->sign_tx_meth = (*env)->GetMethodID(env, c, "sign_tx", "([B)J");
19054         CHECK(calls->sign_tx_meth != NULL);
19055
19056         LDKWalletSource ret = {
19057                 .this_arg = (void*) calls,
19058                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
19059                 .get_change_script = get_change_script_LDKWalletSource_jcall,
19060                 .sign_tx = sign_tx_LDKWalletSource_jcall,
19061                 .free = LDKWalletSource_JCalls_free,
19062         };
19063         return ret;
19064 }
19065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
19066         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
19067         *res_ptr = LDKWalletSource_init(env, clz, o);
19068         return tag_ptr(res_ptr, true);
19069 }
19070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
19071         void* this_arg_ptr = untag_ptr(this_arg);
19072         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19073         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
19074         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
19075         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
19076         return tag_ptr(ret_conv, true);
19077 }
19078
19079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
19080         void* this_arg_ptr = untag_ptr(this_arg);
19081         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19082         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
19083         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
19084         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
19085         return tag_ptr(ret_conv, true);
19086 }
19087
19088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
19089         void* this_arg_ptr = untag_ptr(this_arg);
19090         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
19091         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
19092         LDKTransaction tx_ref;
19093         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
19094         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
19095         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
19096         tx_ref.data_is_owned = true;
19097         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
19098         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
19099         return tag_ptr(ret_conv, true);
19100 }
19101
19102 static jclass LDKGossipSync_P2P_class = NULL;
19103 static jmethodID LDKGossipSync_P2P_meth = NULL;
19104 static jclass LDKGossipSync_Rapid_class = NULL;
19105 static jmethodID LDKGossipSync_Rapid_meth = NULL;
19106 static jclass LDKGossipSync_None_class = NULL;
19107 static jmethodID LDKGossipSync_None_meth = NULL;
19108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
19109         LDKGossipSync_P2P_class =
19110                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
19111         CHECK(LDKGossipSync_P2P_class != NULL);
19112         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
19113         CHECK(LDKGossipSync_P2P_meth != NULL);
19114         LDKGossipSync_Rapid_class =
19115                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
19116         CHECK(LDKGossipSync_Rapid_class != NULL);
19117         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
19118         CHECK(LDKGossipSync_Rapid_meth != NULL);
19119         LDKGossipSync_None_class =
19120                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
19121         CHECK(LDKGossipSync_None_class != NULL);
19122         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
19123         CHECK(LDKGossipSync_None_meth != NULL);
19124 }
19125 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19126         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
19127         switch(obj->tag) {
19128                 case LDKGossipSync_P2P: {
19129                         LDKP2PGossipSync p2p_var = obj->p2p;
19130                         int64_t p2p_ref = 0;
19131                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
19132                         p2p_ref = tag_ptr(p2p_var.inner, false);
19133                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
19134                 }
19135                 case LDKGossipSync_Rapid: {
19136                         LDKRapidGossipSync rapid_var = obj->rapid;
19137                         int64_t rapid_ref = 0;
19138                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
19139                         rapid_ref = tag_ptr(rapid_var.inner, false);
19140                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
19141                 }
19142                 case LDKGossipSync_None: {
19143                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
19144                 }
19145                 default: abort();
19146         }
19147 }
19148 static jclass LDKFallback_SegWitProgram_class = NULL;
19149 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
19150 static jclass LDKFallback_PubKeyHash_class = NULL;
19151 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
19152 static jclass LDKFallback_ScriptHash_class = NULL;
19153 static jmethodID LDKFallback_ScriptHash_meth = NULL;
19154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
19155         LDKFallback_SegWitProgram_class =
19156                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
19157         CHECK(LDKFallback_SegWitProgram_class != NULL);
19158         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
19159         CHECK(LDKFallback_SegWitProgram_meth != NULL);
19160         LDKFallback_PubKeyHash_class =
19161                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
19162         CHECK(LDKFallback_PubKeyHash_class != NULL);
19163         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
19164         CHECK(LDKFallback_PubKeyHash_meth != NULL);
19165         LDKFallback_ScriptHash_class =
19166                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
19167         CHECK(LDKFallback_ScriptHash_class != NULL);
19168         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
19169         CHECK(LDKFallback_ScriptHash_meth != NULL);
19170 }
19171 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
19172         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
19173         switch(obj->tag) {
19174                 case LDKFallback_SegWitProgram: {
19175                         uint8_t version_val = obj->seg_wit_program.version._0;
19176                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
19177                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
19178                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
19179                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
19180                 }
19181                 case LDKFallback_PubKeyHash: {
19182                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
19183                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
19184                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
19185                 }
19186                 case LDKFallback_ScriptHash: {
19187                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
19188                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
19189                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
19190                 }
19191                 default: abort();
19192         }
19193 }
19194 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
19195         LDKStr ret_str = _ldk_get_compiled_version();
19196         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19197         Str_free(ret_str);
19198         return ret_conv;
19199 }
19200
19201 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
19202         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
19203         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19204         Str_free(ret_str);
19205         return ret_conv;
19206 }
19207
19208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
19209         LDKU128 val_ref;
19210         CHECK((*env)->GetArrayLength(env, val) == 16);
19211         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
19212         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
19213         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
19214         return ret_arr;
19215 }
19216
19217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
19218         LDKSixteenBytes le_bytes_ref;
19219         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
19220         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
19221         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
19222         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
19223         return ret_arr;
19224 }
19225
19226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
19227         LDKThirtyTwoBytes big_endian_bytes_ref;
19228         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
19229         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
19230         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
19231         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
19232         return tag_ptr(ret_ref, true);
19233 }
19234
19235 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
19236         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
19237         *ret_copy = Bech32Error_clone(arg);
19238         int64_t ret_ref = tag_ptr(ret_copy, true);
19239         return ret_ref;
19240 }
19241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19242         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
19243         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
19244         return ret_conv;
19245 }
19246
19247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19248         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
19249         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
19250         *ret_copy = Bech32Error_clone(orig_conv);
19251         int64_t ret_ref = tag_ptr(ret_copy, true);
19252         return ret_ref;
19253 }
19254
19255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
19256         if (!ptr_is_owned(o)) return;
19257         void* o_ptr = untag_ptr(o);
19258         CHECK_ACCESS(o_ptr);
19259         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
19260         FREE(untag_ptr(o));
19261         Bech32Error_free(o_conv);
19262 }
19263
19264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
19265         LDKTransaction _res_ref;
19266         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
19267         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
19268         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
19269         _res_ref.data_is_owned = true;
19270         Transaction_free(_res_ref);
19271 }
19272
19273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
19274         LDKWitness _res_ref;
19275         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
19276         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
19277         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
19278         _res_ref.data_is_owned = true;
19279         Witness_free(_res_ref);
19280 }
19281
19282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
19283         if (!ptr_is_owned(_res)) return;
19284         void* _res_ptr = untag_ptr(_res);
19285         CHECK_ACCESS(_res_ptr);
19286         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
19287         FREE(untag_ptr(_res));
19288         TxIn_free(_res_conv);
19289 }
19290
19291 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) {
19292         LDKWitness witness_ref;
19293         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
19294         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
19295         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
19296         witness_ref.data_is_owned = true;
19297         LDKCVec_u8Z script_sig_ref;
19298         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
19299         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
19300         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
19301         LDKThirtyTwoBytes previous_txid_ref;
19302         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
19303         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
19304         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
19305         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
19306         return tag_ptr(ret_ref, true);
19307 }
19308
19309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
19310         LDKCVec_u8Z script_pubkey_ref;
19311         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
19312         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
19313         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
19314         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
19315         *ret_ref = TxOut_new(script_pubkey_ref, value);
19316         return tag_ptr(ret_ref, true);
19317 }
19318
19319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
19320         if (!ptr_is_owned(_res)) return;
19321         void* _res_ptr = untag_ptr(_res);
19322         CHECK_ACCESS(_res_ptr);
19323         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
19324         FREE(untag_ptr(_res));
19325         TxOut_free(_res_conv);
19326 }
19327
19328 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
19329         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
19330         *ret_ref = TxOut_clone(arg);
19331         return tag_ptr(ret_ref, true);
19332 }
19333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19334         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
19335         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
19336         return ret_conv;
19337 }
19338
19339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19340         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
19341         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
19342         *ret_ref = TxOut_clone(orig_conv);
19343         return tag_ptr(ret_ref, true);
19344 }
19345
19346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
19347         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
19348         Str_free(dummy);
19349 }
19350
19351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19352         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
19353         *ret_copy = COption_DurationZ_some(o);
19354         int64_t ret_ref = tag_ptr(ret_copy, true);
19355         return ret_ref;
19356 }
19357
19358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1none(JNIEnv *env, jclass clz) {
19359         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
19360         *ret_copy = COption_DurationZ_none();
19361         int64_t ret_ref = tag_ptr(ret_copy, true);
19362         return ret_ref;
19363 }
19364
19365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19366         if (!ptr_is_owned(_res)) return;
19367         void* _res_ptr = untag_ptr(_res);
19368         CHECK_ACCESS(_res_ptr);
19369         LDKCOption_DurationZ _res_conv = *(LDKCOption_DurationZ*)(_res_ptr);
19370         FREE(untag_ptr(_res));
19371         COption_DurationZ_free(_res_conv);
19372 }
19373
19374 static inline uint64_t COption_DurationZ_clone_ptr(LDKCOption_DurationZ *NONNULL_PTR arg) {
19375         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
19376         *ret_copy = COption_DurationZ_clone(arg);
19377         int64_t ret_ref = tag_ptr(ret_copy, true);
19378         return ret_ref;
19379 }
19380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19381         LDKCOption_DurationZ* arg_conv = (LDKCOption_DurationZ*)untag_ptr(arg);
19382         int64_t ret_conv = COption_DurationZ_clone_ptr(arg_conv);
19383         return ret_conv;
19384 }
19385
19386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1DurationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19387         LDKCOption_DurationZ* orig_conv = (LDKCOption_DurationZ*)untag_ptr(orig);
19388         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
19389         *ret_copy = COption_DurationZ_clone(orig_conv);
19390         int64_t ret_ref = tag_ptr(ret_copy, true);
19391         return ret_ref;
19392 }
19393
19394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19395         LDKCVec_BlindedPathZ _res_constr;
19396         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19397         if (_res_constr.datalen > 0)
19398                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
19399         else
19400                 _res_constr.data = NULL;
19401         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19402         for (size_t n = 0; n < _res_constr.datalen; n++) {
19403                 int64_t _res_conv_13 = _res_vals[n];
19404                 LDKBlindedPath _res_conv_13_conv;
19405                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
19406                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
19407                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
19408                 _res_constr.data[n] = _res_conv_13_conv;
19409         }
19410         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19411         CVec_BlindedPathZ_free(_res_constr);
19412 }
19413
19414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
19415         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19416         *ret_copy = COption_u64Z_some(o);
19417         int64_t ret_ref = tag_ptr(ret_copy, true);
19418         return ret_ref;
19419 }
19420
19421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
19422         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19423         *ret_copy = COption_u64Z_none();
19424         int64_t ret_ref = tag_ptr(ret_copy, true);
19425         return ret_ref;
19426 }
19427
19428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
19429         if (!ptr_is_owned(_res)) return;
19430         void* _res_ptr = untag_ptr(_res);
19431         CHECK_ACCESS(_res_ptr);
19432         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
19433         FREE(untag_ptr(_res));
19434         COption_u64Z_free(_res_conv);
19435 }
19436
19437 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
19438         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19439         *ret_copy = COption_u64Z_clone(arg);
19440         int64_t ret_ref = tag_ptr(ret_copy, true);
19441         return ret_ref;
19442 }
19443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19444         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
19445         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
19446         return ret_conv;
19447 }
19448
19449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19450         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
19451         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
19452         *ret_copy = COption_u64Z_clone(orig_conv);
19453         int64_t ret_ref = tag_ptr(ret_copy, true);
19454         return ret_ref;
19455 }
19456
19457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19458         LDKRefund o_conv;
19459         o_conv.inner = untag_ptr(o);
19460         o_conv.is_owned = ptr_is_owned(o);
19461         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19462         o_conv = Refund_clone(&o_conv);
19463         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
19464         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
19465         return tag_ptr(ret_conv, true);
19466 }
19467
19468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19469         LDKBolt12ParseError e_conv;
19470         e_conv.inner = untag_ptr(e);
19471         e_conv.is_owned = ptr_is_owned(e);
19472         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19473         e_conv = Bolt12ParseError_clone(&e_conv);
19474         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
19475         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
19476         return tag_ptr(ret_conv, true);
19477 }
19478
19479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19480         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
19481         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
19482         return ret_conv;
19483 }
19484
19485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19486         if (!ptr_is_owned(_res)) return;
19487         void* _res_ptr = untag_ptr(_res);
19488         CHECK_ACCESS(_res_ptr);
19489         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
19490         FREE(untag_ptr(_res));
19491         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
19492 }
19493
19494 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
19495         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
19496         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
19497         return tag_ptr(ret_conv, true);
19498 }
19499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19500         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
19501         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
19502         return ret_conv;
19503 }
19504
19505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19506         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
19507         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
19508         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
19509         return tag_ptr(ret_conv, true);
19510 }
19511
19512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
19513         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19514         *ret_conv = CResult_NoneAPIErrorZ_ok();
19515         return tag_ptr(ret_conv, true);
19516 }
19517
19518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19519         void* e_ptr = untag_ptr(e);
19520         CHECK_ACCESS(e_ptr);
19521         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
19522         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
19523         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19524         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
19525         return tag_ptr(ret_conv, true);
19526 }
19527
19528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19529         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
19530         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
19531         return ret_conv;
19532 }
19533
19534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19535         if (!ptr_is_owned(_res)) return;
19536         void* _res_ptr = untag_ptr(_res);
19537         CHECK_ACCESS(_res_ptr);
19538         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
19539         FREE(untag_ptr(_res));
19540         CResult_NoneAPIErrorZ_free(_res_conv);
19541 }
19542
19543 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
19544         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19545         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
19546         return tag_ptr(ret_conv, true);
19547 }
19548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19549         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
19550         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
19551         return ret_conv;
19552 }
19553
19554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19555         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
19556         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
19557         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
19558         return tag_ptr(ret_conv, true);
19559 }
19560
19561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19562         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
19563         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19564         if (_res_constr.datalen > 0)
19565                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
19566         else
19567                 _res_constr.data = NULL;
19568         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19569         for (size_t w = 0; w < _res_constr.datalen; w++) {
19570                 int64_t _res_conv_22 = _res_vals[w];
19571                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
19572                 CHECK_ACCESS(_res_conv_22_ptr);
19573                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
19574                 FREE(untag_ptr(_res_conv_22));
19575                 _res_constr.data[w] = _res_conv_22_conv;
19576         }
19577         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19578         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
19579 }
19580
19581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19582         LDKCVec_APIErrorZ _res_constr;
19583         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19584         if (_res_constr.datalen > 0)
19585                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
19586         else
19587                 _res_constr.data = NULL;
19588         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19589         for (size_t k = 0; k < _res_constr.datalen; k++) {
19590                 int64_t _res_conv_10 = _res_vals[k];
19591                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
19592                 CHECK_ACCESS(_res_conv_10_ptr);
19593                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
19594                 FREE(untag_ptr(_res_conv_10));
19595                 _res_constr.data[k] = _res_conv_10_conv;
19596         }
19597         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19598         CVec_APIErrorZ_free(_res_constr);
19599 }
19600
19601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
19602         LDKThirtyTwoBytes o_ref;
19603         CHECK((*env)->GetArrayLength(env, o) == 32);
19604         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
19605         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
19606         *ret_copy = COption_PaymentSecretZ_some(o_ref);
19607         int64_t ret_ref = tag_ptr(ret_copy, true);
19608         return ret_ref;
19609 }
19610
19611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1none(JNIEnv *env, jclass clz) {
19612         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
19613         *ret_copy = COption_PaymentSecretZ_none();
19614         int64_t ret_ref = tag_ptr(ret_copy, true);
19615         return ret_ref;
19616 }
19617
19618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19619         if (!ptr_is_owned(_res)) return;
19620         void* _res_ptr = untag_ptr(_res);
19621         CHECK_ACCESS(_res_ptr);
19622         LDKCOption_PaymentSecretZ _res_conv = *(LDKCOption_PaymentSecretZ*)(_res_ptr);
19623         FREE(untag_ptr(_res));
19624         COption_PaymentSecretZ_free(_res_conv);
19625 }
19626
19627 static inline uint64_t COption_PaymentSecretZ_clone_ptr(LDKCOption_PaymentSecretZ *NONNULL_PTR arg) {
19628         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
19629         *ret_copy = COption_PaymentSecretZ_clone(arg);
19630         int64_t ret_ref = tag_ptr(ret_copy, true);
19631         return ret_ref;
19632 }
19633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19634         LDKCOption_PaymentSecretZ* arg_conv = (LDKCOption_PaymentSecretZ*)untag_ptr(arg);
19635         int64_t ret_conv = COption_PaymentSecretZ_clone_ptr(arg_conv);
19636         return ret_conv;
19637 }
19638
19639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19640         LDKCOption_PaymentSecretZ* orig_conv = (LDKCOption_PaymentSecretZ*)untag_ptr(orig);
19641         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
19642         *ret_copy = COption_PaymentSecretZ_clone(orig_conv);
19643         int64_t ret_ref = tag_ptr(ret_copy, true);
19644         return ret_ref;
19645 }
19646
19647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
19648         LDKCVec_u8Z _res_ref;
19649         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
19650         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
19651         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
19652         CVec_u8Z_free(_res_ref);
19653 }
19654
19655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
19656         LDKCVec_u8Z o_ref;
19657         o_ref.datalen = (*env)->GetArrayLength(env, o);
19658         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19659         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
19660         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
19661         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
19662         int64_t ret_ref = tag_ptr(ret_copy, true);
19663         return ret_ref;
19664 }
19665
19666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
19667         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
19668         *ret_copy = COption_CVec_u8ZZ_none();
19669         int64_t ret_ref = tag_ptr(ret_copy, true);
19670         return ret_ref;
19671 }
19672
19673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19674         if (!ptr_is_owned(_res)) return;
19675         void* _res_ptr = untag_ptr(_res);
19676         CHECK_ACCESS(_res_ptr);
19677         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
19678         FREE(untag_ptr(_res));
19679         COption_CVec_u8ZZ_free(_res_conv);
19680 }
19681
19682 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
19683         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
19684         *ret_copy = COption_CVec_u8ZZ_clone(arg);
19685         int64_t ret_ref = tag_ptr(ret_copy, true);
19686         return ret_ref;
19687 }
19688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19689         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
19690         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
19691         return ret_conv;
19692 }
19693
19694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19695         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
19696         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
19697         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
19698         int64_t ret_ref = tag_ptr(ret_copy, true);
19699         return ret_ref;
19700 }
19701
19702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19703         LDKRecipientOnionFields o_conv;
19704         o_conv.inner = untag_ptr(o);
19705         o_conv.is_owned = ptr_is_owned(o);
19706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19707         o_conv = RecipientOnionFields_clone(&o_conv);
19708         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19709         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
19710         return tag_ptr(ret_conv, true);
19711 }
19712
19713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19714         void* e_ptr = untag_ptr(e);
19715         CHECK_ACCESS(e_ptr);
19716         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19717         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19718         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19719         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
19720         return tag_ptr(ret_conv, true);
19721 }
19722
19723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19724         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
19725         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
19726         return ret_conv;
19727 }
19728
19729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19730         if (!ptr_is_owned(_res)) return;
19731         void* _res_ptr = untag_ptr(_res);
19732         CHECK_ACCESS(_res_ptr);
19733         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
19734         FREE(untag_ptr(_res));
19735         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
19736 }
19737
19738 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
19739         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19740         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
19741         return tag_ptr(ret_conv, true);
19742 }
19743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19744         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
19745         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
19746         return ret_conv;
19747 }
19748
19749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19750         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
19751         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
19752         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
19753         return tag_ptr(ret_conv, true);
19754 }
19755
19756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19757         LDKBlindedPayInfo o_conv;
19758         o_conv.inner = untag_ptr(o);
19759         o_conv.is_owned = ptr_is_owned(o);
19760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19761         o_conv = BlindedPayInfo_clone(&o_conv);
19762         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19763         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
19764         return tag_ptr(ret_conv, true);
19765 }
19766
19767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19768         void* e_ptr = untag_ptr(e);
19769         CHECK_ACCESS(e_ptr);
19770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19772         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19773         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
19774         return tag_ptr(ret_conv, true);
19775 }
19776
19777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19778         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
19779         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
19780         return ret_conv;
19781 }
19782
19783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19784         if (!ptr_is_owned(_res)) return;
19785         void* _res_ptr = untag_ptr(_res);
19786         CHECK_ACCESS(_res_ptr);
19787         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
19788         FREE(untag_ptr(_res));
19789         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
19790 }
19791
19792 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
19793         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19794         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
19795         return tag_ptr(ret_conv, true);
19796 }
19797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19798         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
19799         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
19800         return ret_conv;
19801 }
19802
19803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19804         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
19805         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
19806         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
19807         return tag_ptr(ret_conv, true);
19808 }
19809
19810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19811         LDKDelayedPaymentOutputDescriptor o_conv;
19812         o_conv.inner = untag_ptr(o);
19813         o_conv.is_owned = ptr_is_owned(o);
19814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19815         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
19816         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19817         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19818         return tag_ptr(ret_conv, true);
19819 }
19820
19821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19822         void* e_ptr = untag_ptr(e);
19823         CHECK_ACCESS(e_ptr);
19824         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19825         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19826         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19827         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19828         return tag_ptr(ret_conv, true);
19829 }
19830
19831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19832         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19833         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19834         return ret_conv;
19835 }
19836
19837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19838         if (!ptr_is_owned(_res)) return;
19839         void* _res_ptr = untag_ptr(_res);
19840         CHECK_ACCESS(_res_ptr);
19841         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19842         FREE(untag_ptr(_res));
19843         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19844 }
19845
19846 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19847         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19848         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19849         return tag_ptr(ret_conv, true);
19850 }
19851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19852         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19853         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19854         return ret_conv;
19855 }
19856
19857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19858         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19859         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
19860         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19861         return tag_ptr(ret_conv, true);
19862 }
19863
19864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19865         LDKStaticPaymentOutputDescriptor o_conv;
19866         o_conv.inner = untag_ptr(o);
19867         o_conv.is_owned = ptr_is_owned(o);
19868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19869         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
19870         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19871         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
19872         return tag_ptr(ret_conv, true);
19873 }
19874
19875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19876         void* e_ptr = untag_ptr(e);
19877         CHECK_ACCESS(e_ptr);
19878         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19879         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19880         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19881         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
19882         return tag_ptr(ret_conv, true);
19883 }
19884
19885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19886         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19887         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19888         return ret_conv;
19889 }
19890
19891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19892         if (!ptr_is_owned(_res)) return;
19893         void* _res_ptr = untag_ptr(_res);
19894         CHECK_ACCESS(_res_ptr);
19895         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
19896         FREE(untag_ptr(_res));
19897         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
19898 }
19899
19900 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19901         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19902         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
19903         return tag_ptr(ret_conv, true);
19904 }
19905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19906         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19907         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19908         return ret_conv;
19909 }
19910
19911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19912         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19913         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
19914         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
19915         return tag_ptr(ret_conv, true);
19916 }
19917
19918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19919         void* o_ptr = untag_ptr(o);
19920         CHECK_ACCESS(o_ptr);
19921         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
19922         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
19923         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19924         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
19925         return tag_ptr(ret_conv, true);
19926 }
19927
19928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19929         void* e_ptr = untag_ptr(e);
19930         CHECK_ACCESS(e_ptr);
19931         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19932         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19933         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19934         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
19935         return tag_ptr(ret_conv, true);
19936 }
19937
19938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19939         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
19940         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
19941         return ret_conv;
19942 }
19943
19944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19945         if (!ptr_is_owned(_res)) return;
19946         void* _res_ptr = untag_ptr(_res);
19947         CHECK_ACCESS(_res_ptr);
19948         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
19949         FREE(untag_ptr(_res));
19950         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
19951 }
19952
19953 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
19954         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19955         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
19956         return tag_ptr(ret_conv, true);
19957 }
19958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19959         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
19960         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
19961         return ret_conv;
19962 }
19963
19964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19965         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
19966         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
19967         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
19968         return tag_ptr(ret_conv, true);
19969 }
19970
19971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19972         LDKCVec_SpendableOutputDescriptorZ _res_constr;
19973         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19974         if (_res_constr.datalen > 0)
19975                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
19976         else
19977                 _res_constr.data = NULL;
19978         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19979         for (size_t b = 0; b < _res_constr.datalen; b++) {
19980                 int64_t _res_conv_27 = _res_vals[b];
19981                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
19982                 CHECK_ACCESS(_res_conv_27_ptr);
19983                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
19984                 FREE(untag_ptr(_res_conv_27));
19985                 _res_constr.data[b] = _res_conv_27_conv;
19986         }
19987         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19988         CVec_SpendableOutputDescriptorZ_free(_res_constr);
19989 }
19990
19991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19992         LDKCVec_TxOutZ _res_constr;
19993         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19994         if (_res_constr.datalen > 0)
19995                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
19996         else
19997                 _res_constr.data = NULL;
19998         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19999         for (size_t h = 0; h < _res_constr.datalen; h++) {
20000                 int64_t _res_conv_7 = _res_vals[h];
20001                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
20002                 CHECK_ACCESS(_res_conv_7_ptr);
20003                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
20004                 FREE(untag_ptr(_res_conv_7));
20005                 _res_constr.data[h] = _res_conv_7_conv;
20006         }
20007         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20008         CVec_TxOutZ_free(_res_constr);
20009 }
20010
20011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1some(JNIEnv *env, jclass clz, int32_t o) {
20012         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
20013         *ret_copy = COption_PackedLockTimeZ_some(o);
20014         int64_t ret_ref = tag_ptr(ret_copy, true);
20015         return ret_ref;
20016 }
20017
20018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1none(JNIEnv *env, jclass clz) {
20019         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
20020         *ret_copy = COption_PackedLockTimeZ_none();
20021         int64_t ret_ref = tag_ptr(ret_copy, true);
20022         return ret_ref;
20023 }
20024
20025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20026         if (!ptr_is_owned(_res)) return;
20027         void* _res_ptr = untag_ptr(_res);
20028         CHECK_ACCESS(_res_ptr);
20029         LDKCOption_PackedLockTimeZ _res_conv = *(LDKCOption_PackedLockTimeZ*)(_res_ptr);
20030         FREE(untag_ptr(_res));
20031         COption_PackedLockTimeZ_free(_res_conv);
20032 }
20033
20034 static inline uint64_t COption_PackedLockTimeZ_clone_ptr(LDKCOption_PackedLockTimeZ *NONNULL_PTR arg) {
20035         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
20036         *ret_copy = COption_PackedLockTimeZ_clone(arg);
20037         int64_t ret_ref = tag_ptr(ret_copy, true);
20038         return ret_ref;
20039 }
20040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20041         LDKCOption_PackedLockTimeZ* arg_conv = (LDKCOption_PackedLockTimeZ*)untag_ptr(arg);
20042         int64_t ret_conv = COption_PackedLockTimeZ_clone_ptr(arg_conv);
20043         return ret_conv;
20044 }
20045
20046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PackedLockTimeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20047         LDKCOption_PackedLockTimeZ* orig_conv = (LDKCOption_PackedLockTimeZ*)untag_ptr(orig);
20048         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
20049         *ret_copy = COption_PackedLockTimeZ_clone(orig_conv);
20050         int64_t ret_ref = tag_ptr(ret_copy, true);
20051         return ret_ref;
20052 }
20053
20054 static inline uint64_t C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR arg) {
20055         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
20056         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone(arg);
20057         return tag_ptr(ret_conv, true);
20058 }
20059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20060         LDKC2Tuple_PartiallySignedTransactionusizeZ* arg_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(arg);
20061         int64_t ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(arg_conv);
20062         return ret_conv;
20063 }
20064
20065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20066         LDKC2Tuple_PartiallySignedTransactionusizeZ* orig_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(orig);
20067         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
20068         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone(orig_conv);
20069         return tag_ptr(ret_conv, true);
20070 }
20071
20072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20073         LDKCVec_u8Z a_ref;
20074         a_ref.datalen = (*env)->GetArrayLength(env, a);
20075         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
20076         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
20077         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
20078         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_new(a_ref, b);
20079         return tag_ptr(ret_conv, true);
20080 }
20081
20082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PartiallySignedTransactionusizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20083         if (!ptr_is_owned(_res)) return;
20084         void* _res_ptr = untag_ptr(_res);
20085         CHECK_ACCESS(_res_ptr);
20086         LDKC2Tuple_PartiallySignedTransactionusizeZ _res_conv = *(LDKC2Tuple_PartiallySignedTransactionusizeZ*)(_res_ptr);
20087         FREE(untag_ptr(_res));
20088         C2Tuple_PartiallySignedTransactionusizeZ_free(_res_conv);
20089 }
20090
20091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20092         void* o_ptr = untag_ptr(o);
20093         CHECK_ACCESS(o_ptr);
20094         LDKC2Tuple_PartiallySignedTransactionusizeZ o_conv = *(LDKC2Tuple_PartiallySignedTransactionusizeZ*)(o_ptr);
20095         o_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone((LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(o));
20096         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
20097         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(o_conv);
20098         return tag_ptr(ret_conv, true);
20099 }
20100
20101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1err(JNIEnv *env, jclass clz) {
20102         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
20103         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err();
20104         return tag_ptr(ret_conv, true);
20105 }
20106
20107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20108         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(o);
20109         jboolean ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(o_conv);
20110         return ret_conv;
20111 }
20112
20113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20114         if (!ptr_is_owned(_res)) return;
20115         void* _res_ptr = untag_ptr(_res);
20116         CHECK_ACCESS(_res_ptr);
20117         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)(_res_ptr);
20118         FREE(untag_ptr(_res));
20119         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(_res_conv);
20120 }
20121
20122 static inline uint64_t CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR arg) {
20123         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
20124         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(arg);
20125         return tag_ptr(ret_conv, true);
20126 }
20127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20128         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(arg);
20129         int64_t ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(arg_conv);
20130         return ret_conv;
20131 }
20132
20133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PartiallySignedTransactionusizeZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20134         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(orig);
20135         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
20136         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(orig_conv);
20137         return tag_ptr(ret_conv, true);
20138 }
20139
20140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20141         LDKCVec_PaymentPreimageZ _res_constr;
20142         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20143         if (_res_constr.datalen > 0)
20144                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
20145         else
20146                 _res_constr.data = NULL;
20147         for (size_t i = 0; i < _res_constr.datalen; i++) {
20148                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20149                 LDKThirtyTwoBytes _res_conv_8_ref;
20150                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
20151                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
20152                 _res_constr.data[i] = _res_conv_8_ref;
20153         }
20154         CVec_PaymentPreimageZ_free(_res_constr);
20155 }
20156
20157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
20158         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20159         *ret_conv = CResult_NoneNoneZ_ok();
20160         return tag_ptr(ret_conv, true);
20161 }
20162
20163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
20164         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20165         *ret_conv = CResult_NoneNoneZ_err();
20166         return tag_ptr(ret_conv, true);
20167 }
20168
20169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20170         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
20171         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
20172         return ret_conv;
20173 }
20174
20175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20176         if (!ptr_is_owned(_res)) return;
20177         void* _res_ptr = untag_ptr(_res);
20178         CHECK_ACCESS(_res_ptr);
20179         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
20180         FREE(untag_ptr(_res));
20181         CResult_NoneNoneZ_free(_res_conv);
20182 }
20183
20184 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
20185         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20186         *ret_conv = CResult_NoneNoneZ_clone(arg);
20187         return tag_ptr(ret_conv, true);
20188 }
20189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20190         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
20191         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
20192         return ret_conv;
20193 }
20194
20195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20196         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
20197         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20198         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
20199         return tag_ptr(ret_conv, true);
20200 }
20201
20202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20203         LDKCVec_SignatureZ _res_constr;
20204         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20205         if (_res_constr.datalen > 0)
20206                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20207         else
20208                 _res_constr.data = NULL;
20209         for (size_t i = 0; i < _res_constr.datalen; i++) {
20210                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20211                 LDKSignature _res_conv_8_ref;
20212                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
20213                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
20214                 _res_constr.data[i] = _res_conv_8_ref;
20215         }
20216         CVec_SignatureZ_free(_res_constr);
20217 }
20218
20219 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
20220         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
20221         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
20222         return tag_ptr(ret_conv, true);
20223 }
20224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20225         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
20226         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
20227         return ret_conv;
20228 }
20229
20230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20231         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
20232         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
20233         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
20234         return tag_ptr(ret_conv, true);
20235 }
20236
20237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
20238         LDKSignature a_ref;
20239         CHECK((*env)->GetArrayLength(env, a) == 64);
20240         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
20241         LDKCVec_SignatureZ b_constr;
20242         b_constr.datalen = (*env)->GetArrayLength(env, b);
20243         if (b_constr.datalen > 0)
20244                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20245         else
20246                 b_constr.data = NULL;
20247         for (size_t i = 0; i < b_constr.datalen; i++) {
20248                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
20249                 LDKSignature b_conv_8_ref;
20250                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
20251                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
20252                 b_constr.data[i] = b_conv_8_ref;
20253         }
20254         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
20255         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
20256         return tag_ptr(ret_conv, true);
20257 }
20258
20259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20260         if (!ptr_is_owned(_res)) return;
20261         void* _res_ptr = untag_ptr(_res);
20262         CHECK_ACCESS(_res_ptr);
20263         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
20264         FREE(untag_ptr(_res));
20265         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
20266 }
20267
20268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20269         void* o_ptr = untag_ptr(o);
20270         CHECK_ACCESS(o_ptr);
20271         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
20272         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
20273         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20274         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
20275         return tag_ptr(ret_conv, true);
20276 }
20277
20278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
20279         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20280         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
20281         return tag_ptr(ret_conv, true);
20282 }
20283
20284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20285         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
20286         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
20287         return ret_conv;
20288 }
20289
20290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20291         if (!ptr_is_owned(_res)) return;
20292         void* _res_ptr = untag_ptr(_res);
20293         CHECK_ACCESS(_res_ptr);
20294         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
20295         FREE(untag_ptr(_res));
20296         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
20297 }
20298
20299 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
20300         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20301         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
20302         return tag_ptr(ret_conv, true);
20303 }
20304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20305         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
20306         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
20307         return ret_conv;
20308 }
20309
20310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20311         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
20312         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
20313         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
20314         return tag_ptr(ret_conv, true);
20315 }
20316
20317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20318         LDKSignature o_ref;
20319         CHECK((*env)->GetArrayLength(env, o) == 64);
20320         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
20321         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20322         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
20323         return tag_ptr(ret_conv, true);
20324 }
20325
20326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
20327         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20328         *ret_conv = CResult_SignatureNoneZ_err();
20329         return tag_ptr(ret_conv, true);
20330 }
20331
20332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20333         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
20334         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
20335         return ret_conv;
20336 }
20337
20338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20339         if (!ptr_is_owned(_res)) return;
20340         void* _res_ptr = untag_ptr(_res);
20341         CHECK_ACCESS(_res_ptr);
20342         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
20343         FREE(untag_ptr(_res));
20344         CResult_SignatureNoneZ_free(_res_conv);
20345 }
20346
20347 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
20348         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20349         *ret_conv = CResult_SignatureNoneZ_clone(arg);
20350         return tag_ptr(ret_conv, true);
20351 }
20352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20353         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
20354         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
20355         return ret_conv;
20356 }
20357
20358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20359         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
20360         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
20361         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
20362         return tag_ptr(ret_conv, true);
20363 }
20364
20365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20366         LDKPublicKey o_ref;
20367         CHECK((*env)->GetArrayLength(env, o) == 33);
20368         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
20369         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20370         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
20371         return tag_ptr(ret_conv, true);
20372 }
20373
20374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
20375         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20376         *ret_conv = CResult_PublicKeyNoneZ_err();
20377         return tag_ptr(ret_conv, true);
20378 }
20379
20380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20381         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
20382         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
20383         return ret_conv;
20384 }
20385
20386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20387         if (!ptr_is_owned(_res)) return;
20388         void* _res_ptr = untag_ptr(_res);
20389         CHECK_ACCESS(_res_ptr);
20390         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
20391         FREE(untag_ptr(_res));
20392         CResult_PublicKeyNoneZ_free(_res_conv);
20393 }
20394
20395 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
20396         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20397         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
20398         return tag_ptr(ret_conv, true);
20399 }
20400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20401         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
20402         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
20403         return ret_conv;
20404 }
20405
20406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20407         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
20408         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
20409         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
20410         return tag_ptr(ret_conv, true);
20411 }
20412
20413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20414         void* o_ptr = untag_ptr(o);
20415         CHECK_ACCESS(o_ptr);
20416         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
20417         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
20418         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20419         *ret_copy = COption_ScalarZ_some(o_conv);
20420         int64_t ret_ref = tag_ptr(ret_copy, true);
20421         return ret_ref;
20422 }
20423
20424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1none(JNIEnv *env, jclass clz) {
20425         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20426         *ret_copy = COption_ScalarZ_none();
20427         int64_t ret_ref = tag_ptr(ret_copy, true);
20428         return ret_ref;
20429 }
20430
20431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20432         if (!ptr_is_owned(_res)) return;
20433         void* _res_ptr = untag_ptr(_res);
20434         CHECK_ACCESS(_res_ptr);
20435         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
20436         FREE(untag_ptr(_res));
20437         COption_ScalarZ_free(_res_conv);
20438 }
20439
20440 static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) {
20441         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20442         *ret_copy = COption_ScalarZ_clone(arg);
20443         int64_t ret_ref = tag_ptr(ret_copy, true);
20444         return ret_ref;
20445 }
20446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20447         LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg);
20448         int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv);
20449         return ret_conv;
20450 }
20451
20452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20453         LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig);
20454         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
20455         *ret_copy = COption_ScalarZ_clone(orig_conv);
20456         int64_t ret_ref = tag_ptr(ret_copy, true);
20457         return ret_ref;
20458 }
20459
20460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20461         LDKThirtyTwoBytes o_ref;
20462         CHECK((*env)->GetArrayLength(env, o) == 32);
20463         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
20464         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20465         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
20466         return tag_ptr(ret_conv, true);
20467 }
20468
20469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1err(JNIEnv *env, jclass clz) {
20470         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20471         *ret_conv = CResult_SharedSecretNoneZ_err();
20472         return tag_ptr(ret_conv, true);
20473 }
20474
20475 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20476         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
20477         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
20478         return ret_conv;
20479 }
20480
20481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20482         if (!ptr_is_owned(_res)) return;
20483         void* _res_ptr = untag_ptr(_res);
20484         CHECK_ACCESS(_res_ptr);
20485         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
20486         FREE(untag_ptr(_res));
20487         CResult_SharedSecretNoneZ_free(_res_conv);
20488 }
20489
20490 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
20491         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20492         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
20493         return tag_ptr(ret_conv, true);
20494 }
20495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20496         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
20497         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
20498         return ret_conv;
20499 }
20500
20501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SharedSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20502         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
20503         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
20504         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
20505         return tag_ptr(ret_conv, true);
20506 }
20507
20508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20509         LDKCVec_U5Z _res_constr;
20510         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20511         if (_res_constr.datalen > 0)
20512                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
20513         else
20514                 _res_constr.data = NULL;
20515         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
20516         for (size_t h = 0; h < _res_constr.datalen; h++) {
20517                 int8_t _res_conv_7 = _res_vals[h];
20518                 
20519                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
20520         }
20521         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
20522         CVec_U5Z_free(_res_constr);
20523 }
20524
20525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20526         LDKRecoverableSignature o_ref;
20527         CHECK((*env)->GetArrayLength(env, o) == 68);
20528         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
20529         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20530         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
20531         return tag_ptr(ret_conv, true);
20532 }
20533
20534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
20535         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20536         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
20537         return tag_ptr(ret_conv, true);
20538 }
20539
20540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20541         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
20542         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
20543         return ret_conv;
20544 }
20545
20546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20547         if (!ptr_is_owned(_res)) return;
20548         void* _res_ptr = untag_ptr(_res);
20549         CHECK_ACCESS(_res_ptr);
20550         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
20551         FREE(untag_ptr(_res));
20552         CResult_RecoverableSignatureNoneZ_free(_res_conv);
20553 }
20554
20555 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
20556         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20557         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
20558         return tag_ptr(ret_conv, true);
20559 }
20560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20561         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
20562         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
20563         return ret_conv;
20564 }
20565
20566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20567         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
20568         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
20569         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
20570         return tag_ptr(ret_conv, true);
20571 }
20572
20573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20574         void* o_ptr = untag_ptr(o);
20575         CHECK_ACCESS(o_ptr);
20576         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
20577         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
20578                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20579                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
20580         }
20581         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20582         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
20583         return tag_ptr(ret_conv, true);
20584 }
20585
20586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20587         void* e_ptr = untag_ptr(e);
20588         CHECK_ACCESS(e_ptr);
20589         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20590         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20591         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20592         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
20593         return tag_ptr(ret_conv, true);
20594 }
20595
20596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20597         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
20598         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
20599         return ret_conv;
20600 }
20601
20602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20603         if (!ptr_is_owned(_res)) return;
20604         void* _res_ptr = untag_ptr(_res);
20605         CHECK_ACCESS(_res_ptr);
20606         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
20607         FREE(untag_ptr(_res));
20608         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
20609 }
20610
20611 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
20612         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20613         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
20614         return tag_ptr(ret_conv, true);
20615 }
20616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20617         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
20618         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
20619         return ret_conv;
20620 }
20621
20622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20623         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
20624         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
20625         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
20626         return tag_ptr(ret_conv, true);
20627 }
20628
20629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20630         LDKCVec_u8Z o_ref;
20631         o_ref.datalen = (*env)->GetArrayLength(env, o);
20632         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20633         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20634         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
20635         *ret_conv = CResult_ScriptNoneZ_ok(o_ref);
20636         return tag_ptr(ret_conv, true);
20637 }
20638
20639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1err(JNIEnv *env, jclass clz) {
20640         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
20641         *ret_conv = CResult_ScriptNoneZ_err();
20642         return tag_ptr(ret_conv, true);
20643 }
20644
20645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20646         LDKCResult_ScriptNoneZ* o_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(o);
20647         jboolean ret_conv = CResult_ScriptNoneZ_is_ok(o_conv);
20648         return ret_conv;
20649 }
20650
20651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20652         if (!ptr_is_owned(_res)) return;
20653         void* _res_ptr = untag_ptr(_res);
20654         CHECK_ACCESS(_res_ptr);
20655         LDKCResult_ScriptNoneZ _res_conv = *(LDKCResult_ScriptNoneZ*)(_res_ptr);
20656         FREE(untag_ptr(_res));
20657         CResult_ScriptNoneZ_free(_res_conv);
20658 }
20659
20660 static inline uint64_t CResult_ScriptNoneZ_clone_ptr(LDKCResult_ScriptNoneZ *NONNULL_PTR arg) {
20661         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
20662         *ret_conv = CResult_ScriptNoneZ_clone(arg);
20663         return tag_ptr(ret_conv, true);
20664 }
20665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20666         LDKCResult_ScriptNoneZ* arg_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(arg);
20667         int64_t ret_conv = CResult_ScriptNoneZ_clone_ptr(arg_conv);
20668         return ret_conv;
20669 }
20670
20671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20672         LDKCResult_ScriptNoneZ* orig_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(orig);
20673         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
20674         *ret_conv = CResult_ScriptNoneZ_clone(orig_conv);
20675         return tag_ptr(ret_conv, true);
20676 }
20677
20678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20679         LDKShutdownScript o_conv;
20680         o_conv.inner = untag_ptr(o);
20681         o_conv.is_owned = ptr_is_owned(o);
20682         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20683         o_conv = ShutdownScript_clone(&o_conv);
20684         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20685         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
20686         return tag_ptr(ret_conv, true);
20687 }
20688
20689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
20690         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20691         *ret_conv = CResult_ShutdownScriptNoneZ_err();
20692         return tag_ptr(ret_conv, true);
20693 }
20694
20695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20696         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
20697         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
20698         return ret_conv;
20699 }
20700
20701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20702         if (!ptr_is_owned(_res)) return;
20703         void* _res_ptr = untag_ptr(_res);
20704         CHECK_ACCESS(_res_ptr);
20705         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
20706         FREE(untag_ptr(_res));
20707         CResult_ShutdownScriptNoneZ_free(_res_conv);
20708 }
20709
20710 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
20711         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20712         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
20713         return tag_ptr(ret_conv, true);
20714 }
20715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20716         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
20717         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
20718         return ret_conv;
20719 }
20720
20721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20722         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
20723         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
20724         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
20725         return tag_ptr(ret_conv, true);
20726 }
20727
20728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20729         LDKCVec_CVec_u8ZZ _res_constr;
20730         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20731         if (_res_constr.datalen > 0)
20732                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
20733         else
20734                 _res_constr.data = NULL;
20735         for (size_t i = 0; i < _res_constr.datalen; i++) {
20736                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20737                 LDKCVec_u8Z _res_conv_8_ref;
20738                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
20739                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
20740                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
20741                 _res_constr.data[i] = _res_conv_8_ref;
20742         }
20743         CVec_CVec_u8ZZ_free(_res_constr);
20744 }
20745
20746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
20747         LDKCVec_CVec_u8ZZ o_constr;
20748         o_constr.datalen = (*env)->GetArrayLength(env, o);
20749         if (o_constr.datalen > 0)
20750                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
20751         else
20752                 o_constr.data = NULL;
20753         for (size_t i = 0; i < o_constr.datalen; i++) {
20754                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
20755                 LDKCVec_u8Z o_conv_8_ref;
20756                 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
20757                 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
20758                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
20759                 o_constr.data[i] = o_conv_8_ref;
20760         }
20761         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20762         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
20763         return tag_ptr(ret_conv, true);
20764 }
20765
20766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
20767         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20768         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
20769         return tag_ptr(ret_conv, true);
20770 }
20771
20772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20773         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
20774         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
20775         return ret_conv;
20776 }
20777
20778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20779         if (!ptr_is_owned(_res)) return;
20780         void* _res_ptr = untag_ptr(_res);
20781         CHECK_ACCESS(_res_ptr);
20782         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
20783         FREE(untag_ptr(_res));
20784         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
20785 }
20786
20787 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
20788         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20789         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
20790         return tag_ptr(ret_conv, true);
20791 }
20792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20793         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
20794         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
20795         return ret_conv;
20796 }
20797
20798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20799         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
20800         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
20801         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
20802         return tag_ptr(ret_conv, true);
20803 }
20804
20805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20806         LDKInMemorySigner o_conv;
20807         o_conv.inner = untag_ptr(o);
20808         o_conv.is_owned = ptr_is_owned(o);
20809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20810         o_conv = InMemorySigner_clone(&o_conv);
20811         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20812         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
20813         return tag_ptr(ret_conv, true);
20814 }
20815
20816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20817         void* e_ptr = untag_ptr(e);
20818         CHECK_ACCESS(e_ptr);
20819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20821         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20822         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
20823         return tag_ptr(ret_conv, true);
20824 }
20825
20826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20827         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
20828         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
20829         return ret_conv;
20830 }
20831
20832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20833         if (!ptr_is_owned(_res)) return;
20834         void* _res_ptr = untag_ptr(_res);
20835         CHECK_ACCESS(_res_ptr);
20836         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
20837         FREE(untag_ptr(_res));
20838         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
20839 }
20840
20841 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
20842         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20843         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
20844         return tag_ptr(ret_conv, true);
20845 }
20846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20847         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
20848         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
20849         return ret_conv;
20850 }
20851
20852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20853         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
20854         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
20855         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
20856         return tag_ptr(ret_conv, true);
20857 }
20858
20859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20860         LDKCVec_u8Z o_ref;
20861         o_ref.datalen = (*env)->GetArrayLength(env, o);
20862         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20863         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20864         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
20865         *ret_conv = CResult_PartiallySignedTransactionNoneZ_ok(o_ref);
20866         return tag_ptr(ret_conv, true);
20867 }
20868
20869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
20870         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
20871         *ret_conv = CResult_PartiallySignedTransactionNoneZ_err();
20872         return tag_ptr(ret_conv, true);
20873 }
20874
20875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20876         LDKCResult_PartiallySignedTransactionNoneZ* o_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(o);
20877         jboolean ret_conv = CResult_PartiallySignedTransactionNoneZ_is_ok(o_conv);
20878         return ret_conv;
20879 }
20880
20881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20882         if (!ptr_is_owned(_res)) return;
20883         void* _res_ptr = untag_ptr(_res);
20884         CHECK_ACCESS(_res_ptr);
20885         LDKCResult_PartiallySignedTransactionNoneZ _res_conv = *(LDKCResult_PartiallySignedTransactionNoneZ*)(_res_ptr);
20886         FREE(untag_ptr(_res));
20887         CResult_PartiallySignedTransactionNoneZ_free(_res_conv);
20888 }
20889
20890 static inline uint64_t CResult_PartiallySignedTransactionNoneZ_clone_ptr(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR arg) {
20891         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
20892         *ret_conv = CResult_PartiallySignedTransactionNoneZ_clone(arg);
20893         return tag_ptr(ret_conv, true);
20894 }
20895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20896         LDKCResult_PartiallySignedTransactionNoneZ* arg_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(arg);
20897         int64_t ret_conv = CResult_PartiallySignedTransactionNoneZ_clone_ptr(arg_conv);
20898         return ret_conv;
20899 }
20900
20901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PartiallySignedTransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20902         LDKCResult_PartiallySignedTransactionNoneZ* orig_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(orig);
20903         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
20904         *ret_conv = CResult_PartiallySignedTransactionNoneZ_clone(orig_conv);
20905         return tag_ptr(ret_conv, true);
20906 }
20907
20908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20909         LDKTransaction o_ref;
20910         o_ref.datalen = (*env)->GetArrayLength(env, o);
20911         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
20912         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20913         o_ref.data_is_owned = true;
20914         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20915         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
20916         return tag_ptr(ret_conv, true);
20917 }
20918
20919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
20920         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20921         *ret_conv = CResult_TransactionNoneZ_err();
20922         return tag_ptr(ret_conv, true);
20923 }
20924
20925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20926         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
20927         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
20928         return ret_conv;
20929 }
20930
20931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20932         if (!ptr_is_owned(_res)) return;
20933         void* _res_ptr = untag_ptr(_res);
20934         CHECK_ACCESS(_res_ptr);
20935         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
20936         FREE(untag_ptr(_res));
20937         CResult_TransactionNoneZ_free(_res_conv);
20938 }
20939
20940 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
20941         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20942         *ret_conv = CResult_TransactionNoneZ_clone(arg);
20943         return tag_ptr(ret_conv, true);
20944 }
20945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20946         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
20947         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
20948         return ret_conv;
20949 }
20950
20951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20952         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
20953         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
20954         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
20955         return tag_ptr(ret_conv, true);
20956 }
20957
20958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20959         void* o_ptr = untag_ptr(o);
20960         CHECK_ACCESS(o_ptr);
20961         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
20962         if (o_conv.free == LDKWriteableScore_JCalls_free) {
20963                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20964                 LDKWriteableScore_JCalls_cloned(&o_conv);
20965         }
20966         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
20967         *ret_copy = COption_WriteableScoreZ_some(o_conv);
20968         int64_t ret_ref = tag_ptr(ret_copy, true);
20969         return ret_ref;
20970 }
20971
20972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
20973         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
20974         *ret_copy = COption_WriteableScoreZ_none();
20975         int64_t ret_ref = tag_ptr(ret_copy, true);
20976         return ret_ref;
20977 }
20978
20979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20980         if (!ptr_is_owned(_res)) return;
20981         void* _res_ptr = untag_ptr(_res);
20982         CHECK_ACCESS(_res_ptr);
20983         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
20984         FREE(untag_ptr(_res));
20985         COption_WriteableScoreZ_free(_res_conv);
20986 }
20987
20988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
20989         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
20990         *ret_conv = CResult_NoneErrorZ_ok();
20991         return tag_ptr(ret_conv, true);
20992 }
20993
20994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
20995         LDKIOError e_conv = LDKIOError_from_java(env, e);
20996         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
20997         *ret_conv = CResult_NoneErrorZ_err(e_conv);
20998         return tag_ptr(ret_conv, true);
20999 }
21000
21001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21002         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
21003         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
21004         return ret_conv;
21005 }
21006
21007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21008         if (!ptr_is_owned(_res)) return;
21009         void* _res_ptr = untag_ptr(_res);
21010         CHECK_ACCESS(_res_ptr);
21011         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
21012         FREE(untag_ptr(_res));
21013         CResult_NoneErrorZ_free(_res_conv);
21014 }
21015
21016 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
21017         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
21018         *ret_conv = CResult_NoneErrorZ_clone(arg);
21019         return tag_ptr(ret_conv, true);
21020 }
21021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21022         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
21023         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
21024         return ret_conv;
21025 }
21026
21027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21028         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
21029         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
21030         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
21031         return tag_ptr(ret_conv, true);
21032 }
21033
21034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21035         LDKCVec_ChannelDetailsZ _res_constr;
21036         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21037         if (_res_constr.datalen > 0)
21038                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
21039         else
21040                 _res_constr.data = NULL;
21041         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21042         for (size_t q = 0; q < _res_constr.datalen; q++) {
21043                 int64_t _res_conv_16 = _res_vals[q];
21044                 LDKChannelDetails _res_conv_16_conv;
21045                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21046                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21047                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21048                 _res_constr.data[q] = _res_conv_16_conv;
21049         }
21050         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21051         CVec_ChannelDetailsZ_free(_res_constr);
21052 }
21053
21054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21055         LDKRoute o_conv;
21056         o_conv.inner = untag_ptr(o);
21057         o_conv.is_owned = ptr_is_owned(o);
21058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21059         o_conv = Route_clone(&o_conv);
21060         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21061         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
21062         return tag_ptr(ret_conv, true);
21063 }
21064
21065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21066         LDKLightningError e_conv;
21067         e_conv.inner = untag_ptr(e);
21068         e_conv.is_owned = ptr_is_owned(e);
21069         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21070         e_conv = LightningError_clone(&e_conv);
21071         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21072         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
21073         return tag_ptr(ret_conv, true);
21074 }
21075
21076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21077         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
21078         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
21079         return ret_conv;
21080 }
21081
21082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21083         if (!ptr_is_owned(_res)) return;
21084         void* _res_ptr = untag_ptr(_res);
21085         CHECK_ACCESS(_res_ptr);
21086         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
21087         FREE(untag_ptr(_res));
21088         CResult_RouteLightningErrorZ_free(_res_conv);
21089 }
21090
21091 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
21092         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21093         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
21094         return tag_ptr(ret_conv, true);
21095 }
21096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21097         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
21098         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
21099         return ret_conv;
21100 }
21101
21102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21103         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
21104         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
21105         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
21106         return tag_ptr(ret_conv, true);
21107 }
21108
21109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21110         LDKInFlightHtlcs o_conv;
21111         o_conv.inner = untag_ptr(o);
21112         o_conv.is_owned = ptr_is_owned(o);
21113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21114         o_conv = InFlightHtlcs_clone(&o_conv);
21115         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21116         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
21117         return tag_ptr(ret_conv, true);
21118 }
21119
21120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21121         void* e_ptr = untag_ptr(e);
21122         CHECK_ACCESS(e_ptr);
21123         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21124         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21125         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21126         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
21127         return tag_ptr(ret_conv, true);
21128 }
21129
21130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21131         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
21132         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
21133         return ret_conv;
21134 }
21135
21136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21137         if (!ptr_is_owned(_res)) return;
21138         void* _res_ptr = untag_ptr(_res);
21139         CHECK_ACCESS(_res_ptr);
21140         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
21141         FREE(untag_ptr(_res));
21142         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
21143 }
21144
21145 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
21146         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21147         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
21148         return tag_ptr(ret_conv, true);
21149 }
21150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21151         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
21152         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
21153         return ret_conv;
21154 }
21155
21156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21157         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
21158         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
21159         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
21160         return tag_ptr(ret_conv, true);
21161 }
21162
21163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21164         LDKRouteHop o_conv;
21165         o_conv.inner = untag_ptr(o);
21166         o_conv.is_owned = ptr_is_owned(o);
21167         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21168         o_conv = RouteHop_clone(&o_conv);
21169         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21170         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
21171         return tag_ptr(ret_conv, true);
21172 }
21173
21174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21175         void* e_ptr = untag_ptr(e);
21176         CHECK_ACCESS(e_ptr);
21177         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21178         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21179         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21180         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
21181         return tag_ptr(ret_conv, true);
21182 }
21183
21184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21185         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
21186         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
21187         return ret_conv;
21188 }
21189
21190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21191         if (!ptr_is_owned(_res)) return;
21192         void* _res_ptr = untag_ptr(_res);
21193         CHECK_ACCESS(_res_ptr);
21194         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
21195         FREE(untag_ptr(_res));
21196         CResult_RouteHopDecodeErrorZ_free(_res_conv);
21197 }
21198
21199 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
21200         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21201         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
21202         return tag_ptr(ret_conv, true);
21203 }
21204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21205         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
21206         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
21207         return ret_conv;
21208 }
21209
21210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21211         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
21212         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
21213         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
21214         return tag_ptr(ret_conv, true);
21215 }
21216
21217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21218         LDKCVec_BlindedHopZ _res_constr;
21219         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21220         if (_res_constr.datalen > 0)
21221                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
21222         else
21223                 _res_constr.data = NULL;
21224         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21225         for (size_t m = 0; m < _res_constr.datalen; m++) {
21226                 int64_t _res_conv_12 = _res_vals[m];
21227                 LDKBlindedHop _res_conv_12_conv;
21228                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
21229                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
21230                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
21231                 _res_constr.data[m] = _res_conv_12_conv;
21232         }
21233         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21234         CVec_BlindedHopZ_free(_res_constr);
21235 }
21236
21237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21238         LDKBlindedTail o_conv;
21239         o_conv.inner = untag_ptr(o);
21240         o_conv.is_owned = ptr_is_owned(o);
21241         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21242         o_conv = BlindedTail_clone(&o_conv);
21243         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21244         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
21245         return tag_ptr(ret_conv, true);
21246 }
21247
21248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21249         void* e_ptr = untag_ptr(e);
21250         CHECK_ACCESS(e_ptr);
21251         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21252         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21253         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21254         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
21255         return tag_ptr(ret_conv, true);
21256 }
21257
21258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21259         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
21260         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
21261         return ret_conv;
21262 }
21263
21264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21265         if (!ptr_is_owned(_res)) return;
21266         void* _res_ptr = untag_ptr(_res);
21267         CHECK_ACCESS(_res_ptr);
21268         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
21269         FREE(untag_ptr(_res));
21270         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
21271 }
21272
21273 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
21274         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21275         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
21276         return tag_ptr(ret_conv, true);
21277 }
21278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21279         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
21280         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
21281         return ret_conv;
21282 }
21283
21284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21285         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
21286         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
21287         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
21288         return tag_ptr(ret_conv, true);
21289 }
21290
21291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21292         LDKCVec_RouteHopZ _res_constr;
21293         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21294         if (_res_constr.datalen > 0)
21295                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21296         else
21297                 _res_constr.data = NULL;
21298         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21299         for (size_t k = 0; k < _res_constr.datalen; k++) {
21300                 int64_t _res_conv_10 = _res_vals[k];
21301                 LDKRouteHop _res_conv_10_conv;
21302                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21303                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21304                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21305                 _res_constr.data[k] = _res_conv_10_conv;
21306         }
21307         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21308         CVec_RouteHopZ_free(_res_constr);
21309 }
21310
21311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
21312         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21313         *ret_copy = COption_u32Z_some(o);
21314         int64_t ret_ref = tag_ptr(ret_copy, true);
21315         return ret_ref;
21316 }
21317
21318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
21319         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21320         *ret_copy = COption_u32Z_none();
21321         int64_t ret_ref = tag_ptr(ret_copy, true);
21322         return ret_ref;
21323 }
21324
21325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21326         if (!ptr_is_owned(_res)) return;
21327         void* _res_ptr = untag_ptr(_res);
21328         CHECK_ACCESS(_res_ptr);
21329         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
21330         FREE(untag_ptr(_res));
21331         COption_u32Z_free(_res_conv);
21332 }
21333
21334 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
21335         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21336         *ret_copy = COption_u32Z_clone(arg);
21337         int64_t ret_ref = tag_ptr(ret_copy, true);
21338         return ret_ref;
21339 }
21340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21341         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
21342         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
21343         return ret_conv;
21344 }
21345
21346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21347         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
21348         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21349         *ret_copy = COption_u32Z_clone(orig_conv);
21350         int64_t ret_ref = tag_ptr(ret_copy, true);
21351         return ret_ref;
21352 }
21353
21354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21355         LDKCVec_PathZ _res_constr;
21356         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21357         if (_res_constr.datalen > 0)
21358                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
21359         else
21360                 _res_constr.data = NULL;
21361         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21362         for (size_t g = 0; g < _res_constr.datalen; g++) {
21363                 int64_t _res_conv_6 = _res_vals[g];
21364                 LDKPath _res_conv_6_conv;
21365                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
21366                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
21367                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
21368                 _res_constr.data[g] = _res_conv_6_conv;
21369         }
21370         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21371         CVec_PathZ_free(_res_constr);
21372 }
21373
21374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21375         LDKRoute o_conv;
21376         o_conv.inner = untag_ptr(o);
21377         o_conv.is_owned = ptr_is_owned(o);
21378         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21379         o_conv = Route_clone(&o_conv);
21380         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21381         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
21382         return tag_ptr(ret_conv, true);
21383 }
21384
21385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21386         void* e_ptr = untag_ptr(e);
21387         CHECK_ACCESS(e_ptr);
21388         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21389         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21390         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21391         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
21392         return tag_ptr(ret_conv, true);
21393 }
21394
21395 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21396         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
21397         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
21398         return ret_conv;
21399 }
21400
21401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21402         if (!ptr_is_owned(_res)) return;
21403         void* _res_ptr = untag_ptr(_res);
21404         CHECK_ACCESS(_res_ptr);
21405         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
21406         FREE(untag_ptr(_res));
21407         CResult_RouteDecodeErrorZ_free(_res_conv);
21408 }
21409
21410 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
21411         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21412         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
21413         return tag_ptr(ret_conv, true);
21414 }
21415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21416         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
21417         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
21418         return ret_conv;
21419 }
21420
21421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21422         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
21423         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
21424         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
21425         return tag_ptr(ret_conv, true);
21426 }
21427
21428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21429         LDKRouteParameters o_conv;
21430         o_conv.inner = untag_ptr(o);
21431         o_conv.is_owned = ptr_is_owned(o);
21432         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21433         o_conv = RouteParameters_clone(&o_conv);
21434         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21435         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
21436         return tag_ptr(ret_conv, true);
21437 }
21438
21439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21440         void* e_ptr = untag_ptr(e);
21441         CHECK_ACCESS(e_ptr);
21442         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21443         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21444         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21445         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
21446         return tag_ptr(ret_conv, true);
21447 }
21448
21449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21450         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
21451         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
21452         return ret_conv;
21453 }
21454
21455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21456         if (!ptr_is_owned(_res)) return;
21457         void* _res_ptr = untag_ptr(_res);
21458         CHECK_ACCESS(_res_ptr);
21459         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
21460         FREE(untag_ptr(_res));
21461         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
21462 }
21463
21464 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
21465         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21466         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
21467         return tag_ptr(ret_conv, true);
21468 }
21469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21470         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
21471         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
21472         return ret_conv;
21473 }
21474
21475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21476         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
21477         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
21478         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
21479         return tag_ptr(ret_conv, true);
21480 }
21481
21482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21483         LDKCVec_u64Z _res_constr;
21484         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21485         if (_res_constr.datalen > 0)
21486                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21487         else
21488                 _res_constr.data = NULL;
21489         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21490         for (size_t g = 0; g < _res_constr.datalen; g++) {
21491                 int64_t _res_conv_6 = _res_vals[g];
21492                 _res_constr.data[g] = _res_conv_6;
21493         }
21494         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21495         CVec_u64Z_free(_res_constr);
21496 }
21497
21498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21499         LDKPaymentParameters o_conv;
21500         o_conv.inner = untag_ptr(o);
21501         o_conv.is_owned = ptr_is_owned(o);
21502         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21503         o_conv = PaymentParameters_clone(&o_conv);
21504         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21505         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
21506         return tag_ptr(ret_conv, true);
21507 }
21508
21509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21510         void* e_ptr = untag_ptr(e);
21511         CHECK_ACCESS(e_ptr);
21512         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21513         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21514         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21515         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
21516         return tag_ptr(ret_conv, true);
21517 }
21518
21519 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21520         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
21521         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
21522         return ret_conv;
21523 }
21524
21525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21526         if (!ptr_is_owned(_res)) return;
21527         void* _res_ptr = untag_ptr(_res);
21528         CHECK_ACCESS(_res_ptr);
21529         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
21530         FREE(untag_ptr(_res));
21531         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
21532 }
21533
21534 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
21535         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21536         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
21537         return tag_ptr(ret_conv, true);
21538 }
21539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21540         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
21541         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
21542         return ret_conv;
21543 }
21544
21545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21546         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
21547         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
21548         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
21549         return tag_ptr(ret_conv, true);
21550 }
21551
21552 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
21553         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
21554         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
21555         return tag_ptr(ret_conv, true);
21556 }
21557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21558         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
21559         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
21560         return ret_conv;
21561 }
21562
21563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21564         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
21565         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
21566         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
21567         return tag_ptr(ret_conv, true);
21568 }
21569
21570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
21571         LDKBlindedPayInfo a_conv;
21572         a_conv.inner = untag_ptr(a);
21573         a_conv.is_owned = ptr_is_owned(a);
21574         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21575         a_conv = BlindedPayInfo_clone(&a_conv);
21576         LDKBlindedPath b_conv;
21577         b_conv.inner = untag_ptr(b);
21578         b_conv.is_owned = ptr_is_owned(b);
21579         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21580         b_conv = BlindedPath_clone(&b_conv);
21581         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
21582         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
21583         return tag_ptr(ret_conv, true);
21584 }
21585
21586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21587         if (!ptr_is_owned(_res)) return;
21588         void* _res_ptr = untag_ptr(_res);
21589         CHECK_ACCESS(_res_ptr);
21590         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
21591         FREE(untag_ptr(_res));
21592         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
21593 }
21594
21595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21596         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
21597         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21598         if (_res_constr.datalen > 0)
21599                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
21600         else
21601                 _res_constr.data = NULL;
21602         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21603         for (size_t l = 0; l < _res_constr.datalen; l++) {
21604                 int64_t _res_conv_37 = _res_vals[l];
21605                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
21606                 CHECK_ACCESS(_res_conv_37_ptr);
21607                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
21608                 FREE(untag_ptr(_res_conv_37));
21609                 _res_constr.data[l] = _res_conv_37_conv;
21610         }
21611         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21612         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
21613 }
21614
21615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21616         LDKCVec_RouteHintZ _res_constr;
21617         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21618         if (_res_constr.datalen > 0)
21619                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
21620         else
21621                 _res_constr.data = NULL;
21622         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21623         for (size_t l = 0; l < _res_constr.datalen; l++) {
21624                 int64_t _res_conv_11 = _res_vals[l];
21625                 LDKRouteHint _res_conv_11_conv;
21626                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
21627                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
21628                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
21629                 _res_constr.data[l] = _res_conv_11_conv;
21630         }
21631         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21632         CVec_RouteHintZ_free(_res_constr);
21633 }
21634
21635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21636         LDKCVec_RouteHintHopZ _res_constr;
21637         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21638         if (_res_constr.datalen > 0)
21639                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
21640         else
21641                 _res_constr.data = NULL;
21642         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21643         for (size_t o = 0; o < _res_constr.datalen; o++) {
21644                 int64_t _res_conv_14 = _res_vals[o];
21645                 LDKRouteHintHop _res_conv_14_conv;
21646                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
21647                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
21648                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
21649                 _res_constr.data[o] = _res_conv_14_conv;
21650         }
21651         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21652         CVec_RouteHintHopZ_free(_res_constr);
21653 }
21654
21655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21656         LDKRouteHint o_conv;
21657         o_conv.inner = untag_ptr(o);
21658         o_conv.is_owned = ptr_is_owned(o);
21659         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21660         o_conv = RouteHint_clone(&o_conv);
21661         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21662         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
21663         return tag_ptr(ret_conv, true);
21664 }
21665
21666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21667         void* e_ptr = untag_ptr(e);
21668         CHECK_ACCESS(e_ptr);
21669         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21670         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21671         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21672         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
21673         return tag_ptr(ret_conv, true);
21674 }
21675
21676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21677         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
21678         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
21679         return ret_conv;
21680 }
21681
21682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21683         if (!ptr_is_owned(_res)) return;
21684         void* _res_ptr = untag_ptr(_res);
21685         CHECK_ACCESS(_res_ptr);
21686         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
21687         FREE(untag_ptr(_res));
21688         CResult_RouteHintDecodeErrorZ_free(_res_conv);
21689 }
21690
21691 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
21692         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21693         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
21694         return tag_ptr(ret_conv, true);
21695 }
21696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21697         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
21698         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
21699         return ret_conv;
21700 }
21701
21702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21703         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
21704         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
21705         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
21706         return tag_ptr(ret_conv, true);
21707 }
21708
21709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21710         LDKRouteHintHop o_conv;
21711         o_conv.inner = untag_ptr(o);
21712         o_conv.is_owned = ptr_is_owned(o);
21713         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21714         o_conv = RouteHintHop_clone(&o_conv);
21715         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21716         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
21717         return tag_ptr(ret_conv, true);
21718 }
21719
21720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21721         void* e_ptr = untag_ptr(e);
21722         CHECK_ACCESS(e_ptr);
21723         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21724         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21725         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21726         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
21727         return tag_ptr(ret_conv, true);
21728 }
21729
21730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21731         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
21732         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
21733         return ret_conv;
21734 }
21735
21736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21737         if (!ptr_is_owned(_res)) return;
21738         void* _res_ptr = untag_ptr(_res);
21739         CHECK_ACCESS(_res_ptr);
21740         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
21741         FREE(untag_ptr(_res));
21742         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
21743 }
21744
21745 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
21746         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21747         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
21748         return tag_ptr(ret_conv, true);
21749 }
21750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21751         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
21752         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
21753         return ret_conv;
21754 }
21755
21756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21757         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
21758         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
21759         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
21760         return tag_ptr(ret_conv, true);
21761 }
21762
21763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
21764         LDKCVec_PublicKeyZ _res_constr;
21765         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21766         if (_res_constr.datalen > 0)
21767                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
21768         else
21769                 _res_constr.data = NULL;
21770         for (size_t i = 0; i < _res_constr.datalen; i++) {
21771                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
21772                 LDKPublicKey _res_conv_8_ref;
21773                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
21774                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
21775                 _res_constr.data[i] = _res_conv_8_ref;
21776         }
21777         CVec_PublicKeyZ_free(_res_constr);
21778 }
21779
21780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21781         LDKFixedPenaltyScorer o_conv;
21782         o_conv.inner = untag_ptr(o);
21783         o_conv.is_owned = ptr_is_owned(o);
21784         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21785         o_conv = FixedPenaltyScorer_clone(&o_conv);
21786         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21787         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
21788         return tag_ptr(ret_conv, true);
21789 }
21790
21791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21792         void* e_ptr = untag_ptr(e);
21793         CHECK_ACCESS(e_ptr);
21794         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21795         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21796         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21797         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
21798         return tag_ptr(ret_conv, true);
21799 }
21800
21801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21802         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
21803         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
21804         return ret_conv;
21805 }
21806
21807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21808         if (!ptr_is_owned(_res)) return;
21809         void* _res_ptr = untag_ptr(_res);
21810         CHECK_ACCESS(_res_ptr);
21811         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
21812         FREE(untag_ptr(_res));
21813         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
21814 }
21815
21816 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
21817         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21818         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
21819         return tag_ptr(ret_conv, true);
21820 }
21821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21822         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
21823         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
21824         return ret_conv;
21825 }
21826
21827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21828         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
21829         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
21830         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
21831         return tag_ptr(ret_conv, true);
21832 }
21833
21834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21835         LDKCVec_NodeIdZ _res_constr;
21836         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21837         if (_res_constr.datalen > 0)
21838                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
21839         else
21840                 _res_constr.data = NULL;
21841         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21842         for (size_t i = 0; i < _res_constr.datalen; i++) {
21843                 int64_t _res_conv_8 = _res_vals[i];
21844                 LDKNodeId _res_conv_8_conv;
21845                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
21846                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
21847                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
21848                 _res_constr.data[i] = _res_conv_8_conv;
21849         }
21850         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21851         CVec_NodeIdZ_free(_res_constr);
21852 }
21853
21854 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
21855         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21856         *ret_conv = C2Tuple_u64u64Z_clone(arg);
21857         return tag_ptr(ret_conv, true);
21858 }
21859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21860         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
21861         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
21862         return ret_conv;
21863 }
21864
21865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21866         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
21867         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21868         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
21869         return tag_ptr(ret_conv, true);
21870 }
21871
21872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
21873         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
21874         *ret_conv = C2Tuple_u64u64Z_new(a, b);
21875         return tag_ptr(ret_conv, true);
21876 }
21877
21878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21879         if (!ptr_is_owned(_res)) return;
21880         void* _res_ptr = untag_ptr(_res);
21881         CHECK_ACCESS(_res_ptr);
21882         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
21883         FREE(untag_ptr(_res));
21884         C2Tuple_u64u64Z_free(_res_conv);
21885 }
21886
21887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21888         void* o_ptr = untag_ptr(o);
21889         CHECK_ACCESS(o_ptr);
21890         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
21891         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
21892         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21893         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
21894         int64_t ret_ref = tag_ptr(ret_copy, true);
21895         return ret_ref;
21896 }
21897
21898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
21899         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21900         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
21901         int64_t ret_ref = tag_ptr(ret_copy, true);
21902         return ret_ref;
21903 }
21904
21905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21906         if (!ptr_is_owned(_res)) return;
21907         void* _res_ptr = untag_ptr(_res);
21908         CHECK_ACCESS(_res_ptr);
21909         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
21910         FREE(untag_ptr(_res));
21911         COption_C2Tuple_u64u64ZZ_free(_res_conv);
21912 }
21913
21914 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
21915         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21916         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
21917         int64_t ret_ref = tag_ptr(ret_copy, true);
21918         return ret_ref;
21919 }
21920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21921         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
21922         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
21923         return ret_conv;
21924 }
21925
21926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21927         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
21928         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
21929         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
21930         int64_t ret_ref = tag_ptr(ret_copy, true);
21931         return ret_ref;
21932 }
21933
21934 static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) {
21935         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21936         *ret_conv = C2Tuple_Z_clone(arg);
21937         return tag_ptr(ret_conv, true);
21938 }
21939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21940         LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg);
21941         int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv);
21942         return ret_conv;
21943 }
21944
21945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21946         LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig);
21947         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21948         *ret_conv = C2Tuple_Z_clone(orig_conv);
21949         return tag_ptr(ret_conv, true);
21950 }
21951
21952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
21953         LDKEightU16s a_ref;
21954         CHECK((*env)->GetArrayLength(env, a) == 8);
21955         (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data);
21956         LDKEightU16s b_ref;
21957         CHECK((*env)->GetArrayLength(env, b) == 8);
21958         (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data);
21959         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
21960         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
21961         return tag_ptr(ret_conv, true);
21962 }
21963
21964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
21965         if (!ptr_is_owned(_res)) return;
21966         void* _res_ptr = untag_ptr(_res);
21967         CHECK_ACCESS(_res_ptr);
21968         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
21969         FREE(untag_ptr(_res));
21970         C2Tuple_Z_free(_res_conv);
21971 }
21972
21973 static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) {
21974         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
21975         *ret_conv = C2Tuple__u168_u168Z_clone(arg);
21976         return tag_ptr(ret_conv, true);
21977 }
21978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21979         LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg);
21980         int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv);
21981         return ret_conv;
21982 }
21983
21984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21985         LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig);
21986         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
21987         *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv);
21988         return tag_ptr(ret_conv, true);
21989 }
21990
21991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
21992         LDKEightU16s a_ref;
21993         CHECK((*env)->GetArrayLength(env, a) == 8);
21994         (*env)->GetShortArrayRegion(env, a, 0, 8, a_ref.data);
21995         LDKEightU16s b_ref;
21996         CHECK((*env)->GetArrayLength(env, b) == 8);
21997         (*env)->GetShortArrayRegion(env, b, 0, 8, b_ref.data);
21998         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
21999         *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref);
22000         return tag_ptr(ret_conv, true);
22001 }
22002
22003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u168_1u168Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
22004         if (!ptr_is_owned(_res)) return;
22005         void* _res_ptr = untag_ptr(_res);
22006         CHECK_ACCESS(_res_ptr);
22007         LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr);
22008         FREE(untag_ptr(_res));
22009         C2Tuple__u168_u168Z_free(_res_conv);
22010 }
22011
22012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22013         void* o_ptr = untag_ptr(o);
22014         CHECK_ACCESS(o_ptr);
22015         LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr);
22016         o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o));
22017         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
22018         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv);
22019         int64_t ret_ref = tag_ptr(ret_copy, true);
22020         return ret_ref;
22021 }
22022
22023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1none(JNIEnv *env, jclass clz) {
22024         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
22025         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none();
22026         int64_t ret_ref = tag_ptr(ret_copy, true);
22027         return ret_ref;
22028 }
22029
22030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22031         if (!ptr_is_owned(_res)) return;
22032         void* _res_ptr = untag_ptr(_res);
22033         CHECK_ACCESS(_res_ptr);
22034         LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr);
22035         FREE(untag_ptr(_res));
22036         COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv);
22037 }
22038
22039 static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) {
22040         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
22041         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg);
22042         int64_t ret_ref = tag_ptr(ret_copy, true);
22043         return ret_ref;
22044 }
22045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22046         LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg);
22047         int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv);
22048         return ret_conv;
22049 }
22050
22051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1EightU16sEightU16sZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22052         LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig);
22053         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
22054         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv);
22055         int64_t ret_ref = tag_ptr(ret_copy, true);
22056         return ret_ref;
22057 }
22058
22059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22060         LDKProbabilisticScorer o_conv;
22061         o_conv.inner = untag_ptr(o);
22062         o_conv.is_owned = ptr_is_owned(o);
22063         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22064         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
22065         
22066         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
22067         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
22068         return tag_ptr(ret_conv, true);
22069 }
22070
22071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22072         void* e_ptr = untag_ptr(e);
22073         CHECK_ACCESS(e_ptr);
22074         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22075         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22076         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
22077         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
22078         return tag_ptr(ret_conv, true);
22079 }
22080
22081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22082         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
22083         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
22084         return ret_conv;
22085 }
22086
22087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22088         if (!ptr_is_owned(_res)) return;
22089         void* _res_ptr = untag_ptr(_res);
22090         CHECK_ACCESS(_res_ptr);
22091         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
22092         FREE(untag_ptr(_res));
22093         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
22094 }
22095
22096 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
22097         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
22098         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
22099         return tag_ptr(ret_conv, true);
22100 }
22101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22102         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
22103         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
22104         return ret_conv;
22105 }
22106
22107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22108         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
22109         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
22110         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
22111         return tag_ptr(ret_conv, true);
22112 }
22113
22114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
22115         LDKTransaction b_ref;
22116         b_ref.datalen = (*env)->GetArrayLength(env, b);
22117         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
22118         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
22119         b_ref.data_is_owned = true;
22120         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
22121         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
22122         return tag_ptr(ret_conv, true);
22123 }
22124
22125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22126         if (!ptr_is_owned(_res)) return;
22127         void* _res_ptr = untag_ptr(_res);
22128         CHECK_ACCESS(_res_ptr);
22129         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
22130         FREE(untag_ptr(_res));
22131         C2Tuple_usizeTransactionZ_free(_res_conv);
22132 }
22133
22134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22135         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
22136         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22137         if (_res_constr.datalen > 0)
22138                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
22139         else
22140                 _res_constr.data = NULL;
22141         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22142         for (size_t c = 0; c < _res_constr.datalen; c++) {
22143                 int64_t _res_conv_28 = _res_vals[c];
22144                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
22145                 CHECK_ACCESS(_res_conv_28_ptr);
22146                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
22147                 FREE(untag_ptr(_res_conv_28));
22148                 _res_constr.data[c] = _res_conv_28_conv;
22149         }
22150         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22151         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
22152 }
22153
22154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
22155         LDKThirtyTwoBytes o_ref;
22156         CHECK((*env)->GetArrayLength(env, o) == 32);
22157         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
22158         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
22159         *ret_copy = COption_BlockHashZ_some(o_ref);
22160         int64_t ret_ref = tag_ptr(ret_copy, true);
22161         return ret_ref;
22162 }
22163
22164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1none(JNIEnv *env, jclass clz) {
22165         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
22166         *ret_copy = COption_BlockHashZ_none();
22167         int64_t ret_ref = tag_ptr(ret_copy, true);
22168         return ret_ref;
22169 }
22170
22171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22172         if (!ptr_is_owned(_res)) return;
22173         void* _res_ptr = untag_ptr(_res);
22174         CHECK_ACCESS(_res_ptr);
22175         LDKCOption_BlockHashZ _res_conv = *(LDKCOption_BlockHashZ*)(_res_ptr);
22176         FREE(untag_ptr(_res));
22177         COption_BlockHashZ_free(_res_conv);
22178 }
22179
22180 static inline uint64_t COption_BlockHashZ_clone_ptr(LDKCOption_BlockHashZ *NONNULL_PTR arg) {
22181         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
22182         *ret_copy = COption_BlockHashZ_clone(arg);
22183         int64_t ret_ref = tag_ptr(ret_copy, true);
22184         return ret_ref;
22185 }
22186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22187         LDKCOption_BlockHashZ* arg_conv = (LDKCOption_BlockHashZ*)untag_ptr(arg);
22188         int64_t ret_conv = COption_BlockHashZ_clone_ptr(arg_conv);
22189         return ret_conv;
22190 }
22191
22192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BlockHashZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22193         LDKCOption_BlockHashZ* orig_conv = (LDKCOption_BlockHashZ*)untag_ptr(orig);
22194         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
22195         *ret_copy = COption_BlockHashZ_clone(orig_conv);
22196         int64_t ret_ref = tag_ptr(ret_copy, true);
22197         return ret_ref;
22198 }
22199
22200 static inline uint64_t C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR arg) {
22201         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
22202         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone(arg);
22203         return tag_ptr(ret_conv, true);
22204 }
22205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22206         LDKC2Tuple_TxidCOption_BlockHashZZ* arg_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(arg);
22207         int64_t ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(arg_conv);
22208         return ret_conv;
22209 }
22210
22211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22212         LDKC2Tuple_TxidCOption_BlockHashZZ* orig_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(orig);
22213         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
22214         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone(orig_conv);
22215         return tag_ptr(ret_conv, true);
22216 }
22217
22218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
22219         LDKThirtyTwoBytes a_ref;
22220         CHECK((*env)->GetArrayLength(env, a) == 32);
22221         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
22222         void* b_ptr = untag_ptr(b);
22223         CHECK_ACCESS(b_ptr);
22224         LDKCOption_BlockHashZ b_conv = *(LDKCOption_BlockHashZ*)(b_ptr);
22225         b_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(b));
22226         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
22227         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_new(a_ref, b_conv);
22228         return tag_ptr(ret_conv, true);
22229 }
22230
22231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCOption_1BlockHashZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22232         if (!ptr_is_owned(_res)) return;
22233         void* _res_ptr = untag_ptr(_res);
22234         CHECK_ACCESS(_res_ptr);
22235         LDKC2Tuple_TxidCOption_BlockHashZZ _res_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(_res_ptr);
22236         FREE(untag_ptr(_res));
22237         C2Tuple_TxidCOption_BlockHashZZ_free(_res_conv);
22238 }
22239
22240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCOption_1BlockHashZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22241         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ _res_constr;
22242         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22243         if (_res_constr.datalen > 0)
22244                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ Elements");
22245         else
22246                 _res_constr.data = NULL;
22247         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22248         for (size_t i = 0; i < _res_constr.datalen; i++) {
22249                 int64_t _res_conv_34 = _res_vals[i];
22250                 void* _res_conv_34_ptr = untag_ptr(_res_conv_34);
22251                 CHECK_ACCESS(_res_conv_34_ptr);
22252                 LDKC2Tuple_TxidCOption_BlockHashZZ _res_conv_34_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(_res_conv_34_ptr);
22253                 FREE(untag_ptr(_res_conv_34));
22254                 _res_constr.data[i] = _res_conv_34_conv;
22255         }
22256         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22257         CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(_res_constr);
22258 }
22259
22260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22261         LDKCVec_MonitorEventZ _res_constr;
22262         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22263         if (_res_constr.datalen > 0)
22264                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
22265         else
22266                 _res_constr.data = NULL;
22267         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22268         for (size_t o = 0; o < _res_constr.datalen; o++) {
22269                 int64_t _res_conv_14 = _res_vals[o];
22270                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
22271                 CHECK_ACCESS(_res_conv_14_ptr);
22272                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
22273                 FREE(untag_ptr(_res_conv_14));
22274                 _res_constr.data[o] = _res_conv_14_conv;
22275         }
22276         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22277         CVec_MonitorEventZ_free(_res_constr);
22278 }
22279
22280 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
22281         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
22282         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
22283         return tag_ptr(ret_conv, true);
22284 }
22285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22286         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
22287         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
22288         return ret_conv;
22289 }
22290
22291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22292         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
22293         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
22294         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
22295         return tag_ptr(ret_conv, true);
22296 }
22297
22298 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) {
22299         LDKOutPoint a_conv;
22300         a_conv.inner = untag_ptr(a);
22301         a_conv.is_owned = ptr_is_owned(a);
22302         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22303         a_conv = OutPoint_clone(&a_conv);
22304         LDKCVec_MonitorEventZ b_constr;
22305         b_constr.datalen = (*env)->GetArrayLength(env, b);
22306         if (b_constr.datalen > 0)
22307                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
22308         else
22309                 b_constr.data = NULL;
22310         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
22311         for (size_t o = 0; o < b_constr.datalen; o++) {
22312                 int64_t b_conv_14 = b_vals[o];
22313                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
22314                 CHECK_ACCESS(b_conv_14_ptr);
22315                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
22316                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
22317                 b_constr.data[o] = b_conv_14_conv;
22318         }
22319         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
22320         LDKPublicKey c_ref;
22321         CHECK((*env)->GetArrayLength(env, c) == 33);
22322         (*env)->GetByteArrayRegion(env, c, 0, 33, c_ref.compressed_form);
22323         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
22324         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
22325         return tag_ptr(ret_conv, true);
22326 }
22327
22328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22329         if (!ptr_is_owned(_res)) return;
22330         void* _res_ptr = untag_ptr(_res);
22331         CHECK_ACCESS(_res_ptr);
22332         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
22333         FREE(untag_ptr(_res));
22334         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
22335 }
22336
22337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OutPointCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22338         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
22339         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22340         if (_res_constr.datalen > 0)
22341                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
22342         else
22343                 _res_constr.data = NULL;
22344         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22345         for (size_t x = 0; x < _res_constr.datalen; x++) {
22346                 int64_t _res_conv_49 = _res_vals[x];
22347                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
22348                 CHECK_ACCESS(_res_conv_49_ptr);
22349                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
22350                 FREE(untag_ptr(_res_conv_49));
22351                 _res_constr.data[x] = _res_conv_49_conv;
22352         }
22353         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22354         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
22355 }
22356
22357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22358         LDKInitFeatures o_conv;
22359         o_conv.inner = untag_ptr(o);
22360         o_conv.is_owned = ptr_is_owned(o);
22361         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22362         o_conv = InitFeatures_clone(&o_conv);
22363         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22364         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
22365         return tag_ptr(ret_conv, true);
22366 }
22367
22368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22369         void* e_ptr = untag_ptr(e);
22370         CHECK_ACCESS(e_ptr);
22371         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22372         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22373         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22374         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
22375         return tag_ptr(ret_conv, true);
22376 }
22377
22378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22379         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
22380         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
22381         return ret_conv;
22382 }
22383
22384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22385         if (!ptr_is_owned(_res)) return;
22386         void* _res_ptr = untag_ptr(_res);
22387         CHECK_ACCESS(_res_ptr);
22388         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
22389         FREE(untag_ptr(_res));
22390         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
22391 }
22392
22393 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22394         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22395         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
22396         return tag_ptr(ret_conv, true);
22397 }
22398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22399         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
22400         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22401         return ret_conv;
22402 }
22403
22404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22405         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
22406         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22407         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
22408         return tag_ptr(ret_conv, true);
22409 }
22410
22411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22412         LDKChannelFeatures o_conv;
22413         o_conv.inner = untag_ptr(o);
22414         o_conv.is_owned = ptr_is_owned(o);
22415         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22416         o_conv = ChannelFeatures_clone(&o_conv);
22417         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22418         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
22419         return tag_ptr(ret_conv, true);
22420 }
22421
22422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22423         void* e_ptr = untag_ptr(e);
22424         CHECK_ACCESS(e_ptr);
22425         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22426         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22427         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22428         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
22429         return tag_ptr(ret_conv, true);
22430 }
22431
22432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22433         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
22434         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
22435         return ret_conv;
22436 }
22437
22438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22439         if (!ptr_is_owned(_res)) return;
22440         void* _res_ptr = untag_ptr(_res);
22441         CHECK_ACCESS(_res_ptr);
22442         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
22443         FREE(untag_ptr(_res));
22444         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
22445 }
22446
22447 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22448         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22449         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
22450         return tag_ptr(ret_conv, true);
22451 }
22452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22453         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
22454         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22455         return ret_conv;
22456 }
22457
22458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22459         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
22460         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22461         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
22462         return tag_ptr(ret_conv, true);
22463 }
22464
22465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22466         LDKNodeFeatures o_conv;
22467         o_conv.inner = untag_ptr(o);
22468         o_conv.is_owned = ptr_is_owned(o);
22469         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22470         o_conv = NodeFeatures_clone(&o_conv);
22471         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22472         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
22473         return tag_ptr(ret_conv, true);
22474 }
22475
22476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22477         void* e_ptr = untag_ptr(e);
22478         CHECK_ACCESS(e_ptr);
22479         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22480         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22481         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22482         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
22483         return tag_ptr(ret_conv, true);
22484 }
22485
22486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22487         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
22488         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
22489         return ret_conv;
22490 }
22491
22492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22493         if (!ptr_is_owned(_res)) return;
22494         void* _res_ptr = untag_ptr(_res);
22495         CHECK_ACCESS(_res_ptr);
22496         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
22497         FREE(untag_ptr(_res));
22498         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
22499 }
22500
22501 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22502         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22503         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
22504         return tag_ptr(ret_conv, true);
22505 }
22506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22507         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
22508         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22509         return ret_conv;
22510 }
22511
22512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22513         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
22514         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22515         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
22516         return tag_ptr(ret_conv, true);
22517 }
22518
22519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22520         LDKBolt11InvoiceFeatures o_conv;
22521         o_conv.inner = untag_ptr(o);
22522         o_conv.is_owned = ptr_is_owned(o);
22523         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22524         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
22525         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22526         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22527         return tag_ptr(ret_conv, true);
22528 }
22529
22530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22531         void* e_ptr = untag_ptr(e);
22532         CHECK_ACCESS(e_ptr);
22533         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22534         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22535         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22536         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
22537         return tag_ptr(ret_conv, true);
22538 }
22539
22540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22541         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22542         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22543         return ret_conv;
22544 }
22545
22546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22547         if (!ptr_is_owned(_res)) return;
22548         void* _res_ptr = untag_ptr(_res);
22549         CHECK_ACCESS(_res_ptr);
22550         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22551         FREE(untag_ptr(_res));
22552         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22553 }
22554
22555 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22556         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22557         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
22558         return tag_ptr(ret_conv, true);
22559 }
22560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22561         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22562         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22563         return ret_conv;
22564 }
22565
22566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22567         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22568         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
22569         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22570         return tag_ptr(ret_conv, true);
22571 }
22572
22573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22574         LDKBolt12InvoiceFeatures o_conv;
22575         o_conv.inner = untag_ptr(o);
22576         o_conv.is_owned = ptr_is_owned(o);
22577         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22578         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
22579         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22580         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
22581         return tag_ptr(ret_conv, true);
22582 }
22583
22584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22585         void* e_ptr = untag_ptr(e);
22586         CHECK_ACCESS(e_ptr);
22587         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22588         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22589         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22590         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
22591         return tag_ptr(ret_conv, true);
22592 }
22593
22594 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22595         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
22596         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
22597         return ret_conv;
22598 }
22599
22600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22601         if (!ptr_is_owned(_res)) return;
22602         void* _res_ptr = untag_ptr(_res);
22603         CHECK_ACCESS(_res_ptr);
22604         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
22605         FREE(untag_ptr(_res));
22606         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
22607 }
22608
22609 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22610         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22611         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
22612         return tag_ptr(ret_conv, true);
22613 }
22614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22615         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
22616         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22617         return ret_conv;
22618 }
22619
22620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22621         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
22622         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
22623         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
22624         return tag_ptr(ret_conv, true);
22625 }
22626
22627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22628         LDKBlindedHopFeatures o_conv;
22629         o_conv.inner = untag_ptr(o);
22630         o_conv.is_owned = ptr_is_owned(o);
22631         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22632         o_conv = BlindedHopFeatures_clone(&o_conv);
22633         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22634         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
22635         return tag_ptr(ret_conv, true);
22636 }
22637
22638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22639         void* e_ptr = untag_ptr(e);
22640         CHECK_ACCESS(e_ptr);
22641         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22642         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22643         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22644         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
22645         return tag_ptr(ret_conv, true);
22646 }
22647
22648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22649         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
22650         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
22651         return ret_conv;
22652 }
22653
22654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22655         if (!ptr_is_owned(_res)) return;
22656         void* _res_ptr = untag_ptr(_res);
22657         CHECK_ACCESS(_res_ptr);
22658         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
22659         FREE(untag_ptr(_res));
22660         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
22661 }
22662
22663 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22664         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22665         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
22666         return tag_ptr(ret_conv, true);
22667 }
22668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22669         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
22670         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22671         return ret_conv;
22672 }
22673
22674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22675         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
22676         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
22677         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
22678         return tag_ptr(ret_conv, true);
22679 }
22680
22681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22682         LDKChannelTypeFeatures o_conv;
22683         o_conv.inner = untag_ptr(o);
22684         o_conv.is_owned = ptr_is_owned(o);
22685         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22686         o_conv = ChannelTypeFeatures_clone(&o_conv);
22687         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22688         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
22689         return tag_ptr(ret_conv, true);
22690 }
22691
22692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22693         void* e_ptr = untag_ptr(e);
22694         CHECK_ACCESS(e_ptr);
22695         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22696         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22697         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22698         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
22699         return tag_ptr(ret_conv, true);
22700 }
22701
22702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22703         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
22704         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
22705         return ret_conv;
22706 }
22707
22708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22709         if (!ptr_is_owned(_res)) return;
22710         void* _res_ptr = untag_ptr(_res);
22711         CHECK_ACCESS(_res_ptr);
22712         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
22713         FREE(untag_ptr(_res));
22714         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
22715 }
22716
22717 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
22718         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22719         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
22720         return tag_ptr(ret_conv, true);
22721 }
22722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22723         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
22724         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
22725         return ret_conv;
22726 }
22727
22728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22729         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
22730         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
22731         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
22732         return tag_ptr(ret_conv, true);
22733 }
22734
22735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChainHashZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
22736         LDKCVec_ChainHashZ _res_constr;
22737         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22738         if (_res_constr.datalen > 0)
22739                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
22740         else
22741                 _res_constr.data = NULL;
22742         for (size_t i = 0; i < _res_constr.datalen; i++) {
22743                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
22744                 LDKThirtyTwoBytes _res_conv_8_ref;
22745                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
22746                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
22747                 _res_constr.data[i] = _res_conv_8_ref;
22748         }
22749         CVec_ChainHashZ_free(_res_constr);
22750 }
22751
22752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22753         LDKOffer o_conv;
22754         o_conv.inner = untag_ptr(o);
22755         o_conv.is_owned = ptr_is_owned(o);
22756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22757         o_conv = Offer_clone(&o_conv);
22758         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22759         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
22760         return tag_ptr(ret_conv, true);
22761 }
22762
22763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22764         LDKBolt12ParseError e_conv;
22765         e_conv.inner = untag_ptr(e);
22766         e_conv.is_owned = ptr_is_owned(e);
22767         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22768         e_conv = Bolt12ParseError_clone(&e_conv);
22769         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22770         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
22771         return tag_ptr(ret_conv, true);
22772 }
22773
22774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22775         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
22776         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
22777         return ret_conv;
22778 }
22779
22780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22781         if (!ptr_is_owned(_res)) return;
22782         void* _res_ptr = untag_ptr(_res);
22783         CHECK_ACCESS(_res_ptr);
22784         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
22785         FREE(untag_ptr(_res));
22786         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
22787 }
22788
22789 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
22790         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22791         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
22792         return tag_ptr(ret_conv, true);
22793 }
22794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22795         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
22796         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
22797         return ret_conv;
22798 }
22799
22800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22801         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
22802         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
22803         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
22804         return tag_ptr(ret_conv, true);
22805 }
22806
22807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
22808         LDKPublicKey o_ref;
22809         CHECK((*env)->GetArrayLength(env, o) == 33);
22810         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
22811         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22812         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
22813         return tag_ptr(ret_conv, true);
22814 }
22815
22816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
22817         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
22818         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22819         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
22820         return tag_ptr(ret_conv, true);
22821 }
22822
22823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22824         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
22825         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
22826         return ret_conv;
22827 }
22828
22829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22830         if (!ptr_is_owned(_res)) return;
22831         void* _res_ptr = untag_ptr(_res);
22832         CHECK_ACCESS(_res_ptr);
22833         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
22834         FREE(untag_ptr(_res));
22835         CResult_PublicKeyErrorZ_free(_res_conv);
22836 }
22837
22838 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
22839         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22840         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
22841         return tag_ptr(ret_conv, true);
22842 }
22843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22844         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
22845         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
22846         return ret_conv;
22847 }
22848
22849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22850         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
22851         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22852         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
22853         return tag_ptr(ret_conv, true);
22854 }
22855
22856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22857         LDKNodeId o_conv;
22858         o_conv.inner = untag_ptr(o);
22859         o_conv.is_owned = ptr_is_owned(o);
22860         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22861         o_conv = NodeId_clone(&o_conv);
22862         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22863         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
22864         return tag_ptr(ret_conv, true);
22865 }
22866
22867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22868         void* e_ptr = untag_ptr(e);
22869         CHECK_ACCESS(e_ptr);
22870         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22871         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22872         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22873         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
22874         return tag_ptr(ret_conv, true);
22875 }
22876
22877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22878         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
22879         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
22880         return ret_conv;
22881 }
22882
22883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22884         if (!ptr_is_owned(_res)) return;
22885         void* _res_ptr = untag_ptr(_res);
22886         CHECK_ACCESS(_res_ptr);
22887         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
22888         FREE(untag_ptr(_res));
22889         CResult_NodeIdDecodeErrorZ_free(_res_conv);
22890 }
22891
22892 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
22893         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22894         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
22895         return tag_ptr(ret_conv, true);
22896 }
22897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22898         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
22899         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
22900         return ret_conv;
22901 }
22902
22903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22904         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
22905         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
22906         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
22907         return tag_ptr(ret_conv, true);
22908 }
22909
22910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22911         void* o_ptr = untag_ptr(o);
22912         CHECK_ACCESS(o_ptr);
22913         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
22914         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
22915         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22916         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
22917         int64_t ret_ref = tag_ptr(ret_copy, true);
22918         return ret_ref;
22919 }
22920
22921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
22922         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22923         *ret_copy = COption_NetworkUpdateZ_none();
22924         int64_t ret_ref = tag_ptr(ret_copy, true);
22925         return ret_ref;
22926 }
22927
22928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22929         if (!ptr_is_owned(_res)) return;
22930         void* _res_ptr = untag_ptr(_res);
22931         CHECK_ACCESS(_res_ptr);
22932         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
22933         FREE(untag_ptr(_res));
22934         COption_NetworkUpdateZ_free(_res_conv);
22935 }
22936
22937 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
22938         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22939         *ret_copy = COption_NetworkUpdateZ_clone(arg);
22940         int64_t ret_ref = tag_ptr(ret_copy, true);
22941         return ret_ref;
22942 }
22943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22944         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
22945         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
22946         return ret_conv;
22947 }
22948
22949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22950         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
22951         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
22952         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
22953         int64_t ret_ref = tag_ptr(ret_copy, true);
22954         return ret_ref;
22955 }
22956
22957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22958         void* o_ptr = untag_ptr(o);
22959         CHECK_ACCESS(o_ptr);
22960         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
22961         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
22962         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22963         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
22964         return tag_ptr(ret_conv, true);
22965 }
22966
22967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22968         void* e_ptr = untag_ptr(e);
22969         CHECK_ACCESS(e_ptr);
22970         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22971         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22972         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22973         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
22974         return tag_ptr(ret_conv, true);
22975 }
22976
22977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22978         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
22979         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
22980         return ret_conv;
22981 }
22982
22983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22984         if (!ptr_is_owned(_res)) return;
22985         void* _res_ptr = untag_ptr(_res);
22986         CHECK_ACCESS(_res_ptr);
22987         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
22988         FREE(untag_ptr(_res));
22989         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
22990 }
22991
22992 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
22993         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
22994         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
22995         return tag_ptr(ret_conv, true);
22996 }
22997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22998         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
22999         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
23000         return ret_conv;
23001 }
23002
23003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23004         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
23005         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
23006         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
23007         return tag_ptr(ret_conv, true);
23008 }
23009
23010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23011         void* o_ptr = untag_ptr(o);
23012         CHECK_ACCESS(o_ptr);
23013         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
23014         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
23015                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23016                 LDKUtxoLookup_JCalls_cloned(&o_conv);
23017         }
23018         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
23019         *ret_copy = COption_UtxoLookupZ_some(o_conv);
23020         int64_t ret_ref = tag_ptr(ret_copy, true);
23021         return ret_ref;
23022 }
23023
23024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
23025         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
23026         *ret_copy = COption_UtxoLookupZ_none();
23027         int64_t ret_ref = tag_ptr(ret_copy, true);
23028         return ret_ref;
23029 }
23030
23031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23032         if (!ptr_is_owned(_res)) return;
23033         void* _res_ptr = untag_ptr(_res);
23034         CHECK_ACCESS(_res_ptr);
23035         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
23036         FREE(untag_ptr(_res));
23037         COption_UtxoLookupZ_free(_res_conv);
23038 }
23039
23040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
23041         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23042         *ret_conv = CResult_NoneLightningErrorZ_ok();
23043         return tag_ptr(ret_conv, true);
23044 }
23045
23046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23047         LDKLightningError e_conv;
23048         e_conv.inner = untag_ptr(e);
23049         e_conv.is_owned = ptr_is_owned(e);
23050         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23051         e_conv = LightningError_clone(&e_conv);
23052         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23053         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
23054         return tag_ptr(ret_conv, true);
23055 }
23056
23057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23058         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
23059         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
23060         return ret_conv;
23061 }
23062
23063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23064         if (!ptr_is_owned(_res)) return;
23065         void* _res_ptr = untag_ptr(_res);
23066         CHECK_ACCESS(_res_ptr);
23067         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
23068         FREE(untag_ptr(_res));
23069         CResult_NoneLightningErrorZ_free(_res_conv);
23070 }
23071
23072 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
23073         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23074         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
23075         return tag_ptr(ret_conv, true);
23076 }
23077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23078         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
23079         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
23080         return ret_conv;
23081 }
23082
23083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23084         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
23085         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
23086         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
23087         return tag_ptr(ret_conv, true);
23088 }
23089
23090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
23091         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23092         *ret_conv = CResult_boolLightningErrorZ_ok(o);
23093         return tag_ptr(ret_conv, true);
23094 }
23095
23096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23097         LDKLightningError e_conv;
23098         e_conv.inner = untag_ptr(e);
23099         e_conv.is_owned = ptr_is_owned(e);
23100         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23101         e_conv = LightningError_clone(&e_conv);
23102         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23103         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
23104         return tag_ptr(ret_conv, true);
23105 }
23106
23107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23108         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
23109         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
23110         return ret_conv;
23111 }
23112
23113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23114         if (!ptr_is_owned(_res)) return;
23115         void* _res_ptr = untag_ptr(_res);
23116         CHECK_ACCESS(_res_ptr);
23117         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
23118         FREE(untag_ptr(_res));
23119         CResult_boolLightningErrorZ_free(_res_conv);
23120 }
23121
23122 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
23123         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23124         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
23125         return tag_ptr(ret_conv, true);
23126 }
23127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23128         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
23129         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
23130         return ret_conv;
23131 }
23132
23133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23134         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
23135         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
23136         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
23137         return tag_ptr(ret_conv, true);
23138 }
23139
23140 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
23141         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23142         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
23143         return tag_ptr(ret_conv, true);
23144 }
23145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23146         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
23147         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
23148         return ret_conv;
23149 }
23150
23151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23152         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
23153         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23154         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
23155         return tag_ptr(ret_conv, true);
23156 }
23157
23158 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) {
23159         LDKChannelAnnouncement a_conv;
23160         a_conv.inner = untag_ptr(a);
23161         a_conv.is_owned = ptr_is_owned(a);
23162         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23163         a_conv = ChannelAnnouncement_clone(&a_conv);
23164         LDKChannelUpdate b_conv;
23165         b_conv.inner = untag_ptr(b);
23166         b_conv.is_owned = ptr_is_owned(b);
23167         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23168         b_conv = ChannelUpdate_clone(&b_conv);
23169         LDKChannelUpdate c_conv;
23170         c_conv.inner = untag_ptr(c);
23171         c_conv.is_owned = ptr_is_owned(c);
23172         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
23173         c_conv = ChannelUpdate_clone(&c_conv);
23174         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
23175         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
23176         return tag_ptr(ret_conv, true);
23177 }
23178
23179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23180         if (!ptr_is_owned(_res)) return;
23181         void* _res_ptr = untag_ptr(_res);
23182         CHECK_ACCESS(_res_ptr);
23183         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
23184         FREE(untag_ptr(_res));
23185         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
23186 }
23187
23188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23189         void* o_ptr = untag_ptr(o);
23190         CHECK_ACCESS(o_ptr);
23191         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
23192         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
23193         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23194         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
23195         int64_t ret_ref = tag_ptr(ret_copy, true);
23196         return ret_ref;
23197 }
23198
23199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
23200         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23201         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
23202         int64_t ret_ref = tag_ptr(ret_copy, true);
23203         return ret_ref;
23204 }
23205
23206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23207         if (!ptr_is_owned(_res)) return;
23208         void* _res_ptr = untag_ptr(_res);
23209         CHECK_ACCESS(_res_ptr);
23210         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
23211         FREE(untag_ptr(_res));
23212         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
23213 }
23214
23215 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
23216         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23217         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
23218         int64_t ret_ref = tag_ptr(ret_copy, true);
23219         return ret_ref;
23220 }
23221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23222         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
23223         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
23224         return ret_conv;
23225 }
23226
23227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23228         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
23229         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
23230         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
23231         int64_t ret_ref = tag_ptr(ret_copy, true);
23232         return ret_ref;
23233 }
23234
23235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23236         LDKCVec_MessageSendEventZ _res_constr;
23237         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23238         if (_res_constr.datalen > 0)
23239                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
23240         else
23241                 _res_constr.data = NULL;
23242         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23243         for (size_t s = 0; s < _res_constr.datalen; s++) {
23244                 int64_t _res_conv_18 = _res_vals[s];
23245                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
23246                 CHECK_ACCESS(_res_conv_18_ptr);
23247                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
23248                 FREE(untag_ptr(_res_conv_18));
23249                 _res_constr.data[s] = _res_conv_18_conv;
23250         }
23251         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23252         CVec_MessageSendEventZ_free(_res_constr);
23253 }
23254
23255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23256         LDKChannelUpdateInfo o_conv;
23257         o_conv.inner = untag_ptr(o);
23258         o_conv.is_owned = ptr_is_owned(o);
23259         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23260         o_conv = ChannelUpdateInfo_clone(&o_conv);
23261         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23262         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
23263         return tag_ptr(ret_conv, true);
23264 }
23265
23266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23267         void* e_ptr = untag_ptr(e);
23268         CHECK_ACCESS(e_ptr);
23269         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23270         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23271         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23272         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
23273         return tag_ptr(ret_conv, true);
23274 }
23275
23276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23277         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
23278         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
23279         return ret_conv;
23280 }
23281
23282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23283         if (!ptr_is_owned(_res)) return;
23284         void* _res_ptr = untag_ptr(_res);
23285         CHECK_ACCESS(_res_ptr);
23286         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
23287         FREE(untag_ptr(_res));
23288         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
23289 }
23290
23291 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
23292         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23293         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
23294         return tag_ptr(ret_conv, true);
23295 }
23296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23297         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
23298         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
23299         return ret_conv;
23300 }
23301
23302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23303         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
23304         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
23305         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
23306         return tag_ptr(ret_conv, true);
23307 }
23308
23309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23310         LDKChannelInfo o_conv;
23311         o_conv.inner = untag_ptr(o);
23312         o_conv.is_owned = ptr_is_owned(o);
23313         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23314         o_conv = ChannelInfo_clone(&o_conv);
23315         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23316         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
23317         return tag_ptr(ret_conv, true);
23318 }
23319
23320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23321         void* e_ptr = untag_ptr(e);
23322         CHECK_ACCESS(e_ptr);
23323         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23324         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23325         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23326         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
23327         return tag_ptr(ret_conv, true);
23328 }
23329
23330 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23331         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
23332         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
23333         return ret_conv;
23334 }
23335
23336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23337         if (!ptr_is_owned(_res)) return;
23338         void* _res_ptr = untag_ptr(_res);
23339         CHECK_ACCESS(_res_ptr);
23340         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
23341         FREE(untag_ptr(_res));
23342         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
23343 }
23344
23345 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
23346         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23347         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
23348         return tag_ptr(ret_conv, true);
23349 }
23350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23351         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
23352         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
23353         return ret_conv;
23354 }
23355
23356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23357         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
23358         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23359         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
23360         return tag_ptr(ret_conv, true);
23361 }
23362
23363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23364         LDKRoutingFees o_conv;
23365         o_conv.inner = untag_ptr(o);
23366         o_conv.is_owned = ptr_is_owned(o);
23367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23368         o_conv = RoutingFees_clone(&o_conv);
23369         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23370         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
23371         return tag_ptr(ret_conv, true);
23372 }
23373
23374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23375         void* e_ptr = untag_ptr(e);
23376         CHECK_ACCESS(e_ptr);
23377         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23378         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23379         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23380         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
23381         return tag_ptr(ret_conv, true);
23382 }
23383
23384 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23385         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
23386         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
23387         return ret_conv;
23388 }
23389
23390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23391         if (!ptr_is_owned(_res)) return;
23392         void* _res_ptr = untag_ptr(_res);
23393         CHECK_ACCESS(_res_ptr);
23394         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
23395         FREE(untag_ptr(_res));
23396         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
23397 }
23398
23399 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
23400         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23401         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
23402         return tag_ptr(ret_conv, true);
23403 }
23404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23405         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
23406         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
23407         return ret_conv;
23408 }
23409
23410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23411         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
23412         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23413         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
23414         return tag_ptr(ret_conv, true);
23415 }
23416
23417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23418         LDKCVec_NetAddressZ _res_constr;
23419         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23420         if (_res_constr.datalen > 0)
23421                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23422         else
23423                 _res_constr.data = NULL;
23424         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23425         for (size_t m = 0; m < _res_constr.datalen; m++) {
23426                 int64_t _res_conv_12 = _res_vals[m];
23427                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
23428                 CHECK_ACCESS(_res_conv_12_ptr);
23429                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
23430                 FREE(untag_ptr(_res_conv_12));
23431                 _res_constr.data[m] = _res_conv_12_conv;
23432         }
23433         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23434         CVec_NetAddressZ_free(_res_constr);
23435 }
23436
23437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23438         LDKNodeAnnouncementInfo o_conv;
23439         o_conv.inner = untag_ptr(o);
23440         o_conv.is_owned = ptr_is_owned(o);
23441         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23442         o_conv = NodeAnnouncementInfo_clone(&o_conv);
23443         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23444         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
23445         return tag_ptr(ret_conv, true);
23446 }
23447
23448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23449         void* e_ptr = untag_ptr(e);
23450         CHECK_ACCESS(e_ptr);
23451         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23452         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23453         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23454         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
23455         return tag_ptr(ret_conv, true);
23456 }
23457
23458 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23459         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
23460         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
23461         return ret_conv;
23462 }
23463
23464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23465         if (!ptr_is_owned(_res)) return;
23466         void* _res_ptr = untag_ptr(_res);
23467         CHECK_ACCESS(_res_ptr);
23468         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
23469         FREE(untag_ptr(_res));
23470         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
23471 }
23472
23473 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
23474         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23475         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
23476         return tag_ptr(ret_conv, true);
23477 }
23478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23479         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
23480         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
23481         return ret_conv;
23482 }
23483
23484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23485         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
23486         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
23487         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
23488         return tag_ptr(ret_conv, true);
23489 }
23490
23491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23492         LDKNodeAlias o_conv;
23493         o_conv.inner = untag_ptr(o);
23494         o_conv.is_owned = ptr_is_owned(o);
23495         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23496         o_conv = NodeAlias_clone(&o_conv);
23497         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23498         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
23499         return tag_ptr(ret_conv, true);
23500 }
23501
23502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23503         void* e_ptr = untag_ptr(e);
23504         CHECK_ACCESS(e_ptr);
23505         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23506         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23507         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23508         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
23509         return tag_ptr(ret_conv, true);
23510 }
23511
23512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23513         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
23514         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
23515         return ret_conv;
23516 }
23517
23518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23519         if (!ptr_is_owned(_res)) return;
23520         void* _res_ptr = untag_ptr(_res);
23521         CHECK_ACCESS(_res_ptr);
23522         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
23523         FREE(untag_ptr(_res));
23524         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
23525 }
23526
23527 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
23528         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23529         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
23530         return tag_ptr(ret_conv, true);
23531 }
23532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23533         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
23534         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
23535         return ret_conv;
23536 }
23537
23538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23539         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
23540         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
23541         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
23542         return tag_ptr(ret_conv, true);
23543 }
23544
23545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23546         LDKNodeInfo o_conv;
23547         o_conv.inner = untag_ptr(o);
23548         o_conv.is_owned = ptr_is_owned(o);
23549         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23550         o_conv = NodeInfo_clone(&o_conv);
23551         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23552         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
23553         return tag_ptr(ret_conv, true);
23554 }
23555
23556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23557         void* e_ptr = untag_ptr(e);
23558         CHECK_ACCESS(e_ptr);
23559         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23560         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23561         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23562         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
23563         return tag_ptr(ret_conv, true);
23564 }
23565
23566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23567         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
23568         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
23569         return ret_conv;
23570 }
23571
23572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23573         if (!ptr_is_owned(_res)) return;
23574         void* _res_ptr = untag_ptr(_res);
23575         CHECK_ACCESS(_res_ptr);
23576         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
23577         FREE(untag_ptr(_res));
23578         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
23579 }
23580
23581 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
23582         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23583         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
23584         return tag_ptr(ret_conv, true);
23585 }
23586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23587         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
23588         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
23589         return ret_conv;
23590 }
23591
23592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23593         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
23594         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
23595         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
23596         return tag_ptr(ret_conv, true);
23597 }
23598
23599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23600         LDKNetworkGraph o_conv;
23601         o_conv.inner = untag_ptr(o);
23602         o_conv.is_owned = ptr_is_owned(o);
23603         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23604         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
23605         
23606         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23607         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
23608         return tag_ptr(ret_conv, true);
23609 }
23610
23611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
23612         void* e_ptr = untag_ptr(e);
23613         CHECK_ACCESS(e_ptr);
23614         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23615         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23616         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
23617         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
23618         return tag_ptr(ret_conv, true);
23619 }
23620
23621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23622         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
23623         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
23624         return ret_conv;
23625 }
23626
23627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23628         if (!ptr_is_owned(_res)) return;
23629         void* _res_ptr = untag_ptr(_res);
23630         CHECK_ACCESS(_res_ptr);
23631         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
23632         FREE(untag_ptr(_res));
23633         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
23634 }
23635
23636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
23637         LDKCVec_NetAddressZ o_constr;
23638         o_constr.datalen = (*env)->GetArrayLength(env, o);
23639         if (o_constr.datalen > 0)
23640                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23641         else
23642                 o_constr.data = NULL;
23643         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
23644         for (size_t m = 0; m < o_constr.datalen; m++) {
23645                 int64_t o_conv_12 = o_vals[m];
23646                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
23647                 CHECK_ACCESS(o_conv_12_ptr);
23648                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
23649                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
23650                 o_constr.data[m] = o_conv_12_conv;
23651         }
23652         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
23653         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
23654         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
23655         int64_t ret_ref = tag_ptr(ret_copy, true);
23656         return ret_ref;
23657 }
23658
23659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
23660         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
23661         *ret_copy = COption_CVec_NetAddressZZ_none();
23662         int64_t ret_ref = tag_ptr(ret_copy, true);
23663         return ret_ref;
23664 }
23665
23666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23667         if (!ptr_is_owned(_res)) return;
23668         void* _res_ptr = untag_ptr(_res);
23669         CHECK_ACCESS(_res_ptr);
23670         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
23671         FREE(untag_ptr(_res));
23672         COption_CVec_NetAddressZZ_free(_res_conv);
23673 }
23674
23675 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
23676         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
23677         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
23678         int64_t ret_ref = tag_ptr(ret_copy, true);
23679         return ret_ref;
23680 }
23681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23682         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
23683         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
23684         return ret_conv;
23685 }
23686
23687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23688         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
23689         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
23690         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
23691         int64_t ret_ref = tag_ptr(ret_copy, true);
23692         return ret_ref;
23693 }
23694
23695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
23696         LDKThirtyTwoBytes o_ref;
23697         CHECK((*env)->GetArrayLength(env, o) == 32);
23698         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
23699         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
23700         *ret_copy = COption_PaymentPreimageZ_some(o_ref);
23701         int64_t ret_ref = tag_ptr(ret_copy, true);
23702         return ret_ref;
23703 }
23704
23705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1none(JNIEnv *env, jclass clz) {
23706         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
23707         *ret_copy = COption_PaymentPreimageZ_none();
23708         int64_t ret_ref = tag_ptr(ret_copy, true);
23709         return ret_ref;
23710 }
23711
23712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23713         if (!ptr_is_owned(_res)) return;
23714         void* _res_ptr = untag_ptr(_res);
23715         CHECK_ACCESS(_res_ptr);
23716         LDKCOption_PaymentPreimageZ _res_conv = *(LDKCOption_PaymentPreimageZ*)(_res_ptr);
23717         FREE(untag_ptr(_res));
23718         COption_PaymentPreimageZ_free(_res_conv);
23719 }
23720
23721 static inline uint64_t COption_PaymentPreimageZ_clone_ptr(LDKCOption_PaymentPreimageZ *NONNULL_PTR arg) {
23722         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
23723         *ret_copy = COption_PaymentPreimageZ_clone(arg);
23724         int64_t ret_ref = tag_ptr(ret_copy, true);
23725         return ret_ref;
23726 }
23727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23728         LDKCOption_PaymentPreimageZ* arg_conv = (LDKCOption_PaymentPreimageZ*)untag_ptr(arg);
23729         int64_t ret_conv = COption_PaymentPreimageZ_clone_ptr(arg_conv);
23730         return ret_conv;
23731 }
23732
23733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentPreimageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23734         LDKCOption_PaymentPreimageZ* orig_conv = (LDKCOption_PaymentPreimageZ*)untag_ptr(orig);
23735         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
23736         *ret_copy = COption_PaymentPreimageZ_clone(orig_conv);
23737         int64_t ret_ref = tag_ptr(ret_copy, true);
23738         return ret_ref;
23739 }
23740
23741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23742         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
23743         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23744         if (_res_constr.datalen > 0)
23745                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
23746         else
23747                 _res_constr.data = NULL;
23748         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23749         for (size_t y = 0; y < _res_constr.datalen; y++) {
23750                 int64_t _res_conv_24 = _res_vals[y];
23751                 LDKHTLCOutputInCommitment _res_conv_24_conv;
23752                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
23753                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
23754                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
23755                 _res_constr.data[y] = _res_conv_24_conv;
23756         }
23757         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23758         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
23759 }
23760
23761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23762         LDKCVec_HTLCDescriptorZ _res_constr;
23763         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23764         if (_res_constr.datalen > 0)
23765                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
23766         else
23767                 _res_constr.data = NULL;
23768         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23769         for (size_t q = 0; q < _res_constr.datalen; q++) {
23770                 int64_t _res_conv_16 = _res_vals[q];
23771                 LDKHTLCDescriptor _res_conv_16_conv;
23772                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23773                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23774                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23775                 _res_constr.data[q] = _res_conv_16_conv;
23776         }
23777         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23778         CVec_HTLCDescriptorZ_free(_res_constr);
23779 }
23780
23781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23782         LDKCVec_UtxoZ _res_constr;
23783         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23784         if (_res_constr.datalen > 0)
23785                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23786         else
23787                 _res_constr.data = NULL;
23788         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23789         for (size_t g = 0; g < _res_constr.datalen; g++) {
23790                 int64_t _res_conv_6 = _res_vals[g];
23791                 LDKUtxo _res_conv_6_conv;
23792                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
23793                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
23794                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
23795                 _res_constr.data[g] = _res_conv_6_conv;
23796         }
23797         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23798         CVec_UtxoZ_free(_res_constr);
23799 }
23800
23801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23802         void* o_ptr = untag_ptr(o);
23803         CHECK_ACCESS(o_ptr);
23804         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
23805         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
23806         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23807         *ret_copy = COption_TxOutZ_some(o_conv);
23808         int64_t ret_ref = tag_ptr(ret_copy, true);
23809         return ret_ref;
23810 }
23811
23812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
23813         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23814         *ret_copy = COption_TxOutZ_none();
23815         int64_t ret_ref = tag_ptr(ret_copy, true);
23816         return ret_ref;
23817 }
23818
23819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23820         if (!ptr_is_owned(_res)) return;
23821         void* _res_ptr = untag_ptr(_res);
23822         CHECK_ACCESS(_res_ptr);
23823         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
23824         FREE(untag_ptr(_res));
23825         COption_TxOutZ_free(_res_conv);
23826 }
23827
23828 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
23829         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23830         *ret_copy = COption_TxOutZ_clone(arg);
23831         int64_t ret_ref = tag_ptr(ret_copy, true);
23832         return ret_ref;
23833 }
23834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23835         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
23836         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
23837         return ret_conv;
23838 }
23839
23840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23841         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
23842         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
23843         *ret_copy = COption_TxOutZ_clone(orig_conv);
23844         int64_t ret_ref = tag_ptr(ret_copy, true);
23845         return ret_ref;
23846 }
23847
23848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23849         LDKCVec_InputZ _res_constr;
23850         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23851         if (_res_constr.datalen > 0)
23852                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
23853         else
23854                 _res_constr.data = NULL;
23855         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23856         for (size_t h = 0; h < _res_constr.datalen; h++) {
23857                 int64_t _res_conv_7 = _res_vals[h];
23858                 LDKInput _res_conv_7_conv;
23859                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
23860                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
23861                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
23862                 _res_constr.data[h] = _res_conv_7_conv;
23863         }
23864         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23865         CVec_InputZ_free(_res_constr);
23866 }
23867
23868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23869         LDKCoinSelection o_conv;
23870         o_conv.inner = untag_ptr(o);
23871         o_conv.is_owned = ptr_is_owned(o);
23872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23873         o_conv = CoinSelection_clone(&o_conv);
23874         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23875         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
23876         return tag_ptr(ret_conv, true);
23877 }
23878
23879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
23880         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23881         *ret_conv = CResult_CoinSelectionNoneZ_err();
23882         return tag_ptr(ret_conv, true);
23883 }
23884
23885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23886         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
23887         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
23888         return ret_conv;
23889 }
23890
23891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23892         if (!ptr_is_owned(_res)) return;
23893         void* _res_ptr = untag_ptr(_res);
23894         CHECK_ACCESS(_res_ptr);
23895         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
23896         FREE(untag_ptr(_res));
23897         CResult_CoinSelectionNoneZ_free(_res_conv);
23898 }
23899
23900 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
23901         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23902         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
23903         return tag_ptr(ret_conv, true);
23904 }
23905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23906         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
23907         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
23908         return ret_conv;
23909 }
23910
23911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23912         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
23913         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23914         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
23915         return tag_ptr(ret_conv, true);
23916 }
23917
23918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
23919         LDKCVec_UtxoZ o_constr;
23920         o_constr.datalen = (*env)->GetArrayLength(env, o);
23921         if (o_constr.datalen > 0)
23922                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
23923         else
23924                 o_constr.data = NULL;
23925         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
23926         for (size_t g = 0; g < o_constr.datalen; g++) {
23927                 int64_t o_conv_6 = o_vals[g];
23928                 LDKUtxo o_conv_6_conv;
23929                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
23930                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
23931                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
23932                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
23933                 o_constr.data[g] = o_conv_6_conv;
23934         }
23935         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
23936         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23937         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
23938         return tag_ptr(ret_conv, true);
23939 }
23940
23941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
23942         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23943         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
23944         return tag_ptr(ret_conv, true);
23945 }
23946
23947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23948         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
23949         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
23950         return ret_conv;
23951 }
23952
23953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23954         if (!ptr_is_owned(_res)) return;
23955         void* _res_ptr = untag_ptr(_res);
23956         CHECK_ACCESS(_res_ptr);
23957         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
23958         FREE(untag_ptr(_res));
23959         CResult_CVec_UtxoZNoneZ_free(_res_conv);
23960 }
23961
23962 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
23963         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23964         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
23965         return tag_ptr(ret_conv, true);
23966 }
23967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23968         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
23969         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
23970         return ret_conv;
23971 }
23972
23973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23974         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
23975         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23976         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
23977         return tag_ptr(ret_conv, true);
23978 }
23979
23980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
23981         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23982         *ret_copy = COption_u16Z_some(o);
23983         int64_t ret_ref = tag_ptr(ret_copy, true);
23984         return ret_ref;
23985 }
23986
23987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
23988         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
23989         *ret_copy = COption_u16Z_none();
23990         int64_t ret_ref = tag_ptr(ret_copy, true);
23991         return ret_ref;
23992 }
23993
23994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
23995         if (!ptr_is_owned(_res)) return;
23996         void* _res_ptr = untag_ptr(_res);
23997         CHECK_ACCESS(_res_ptr);
23998         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
23999         FREE(untag_ptr(_res));
24000         COption_u16Z_free(_res_conv);
24001 }
24002
24003 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
24004         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
24005         *ret_copy = COption_u16Z_clone(arg);
24006         int64_t ret_ref = tag_ptr(ret_copy, true);
24007         return ret_ref;
24008 }
24009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24010         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
24011         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
24012         return ret_conv;
24013 }
24014
24015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24016         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
24017         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
24018         *ret_copy = COption_u16Z_clone(orig_conv);
24019         int64_t ret_ref = tag_ptr(ret_copy, true);
24020         return ret_ref;
24021 }
24022
24023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
24024         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
24025         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24026         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
24027         int64_t ret_ref = tag_ptr(ret_copy, true);
24028         return ret_ref;
24029 }
24030
24031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
24032         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24033         *ret_copy = COption_ChannelShutdownStateZ_none();
24034         int64_t ret_ref = tag_ptr(ret_copy, true);
24035         return ret_ref;
24036 }
24037
24038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24039         if (!ptr_is_owned(_res)) return;
24040         void* _res_ptr = untag_ptr(_res);
24041         CHECK_ACCESS(_res_ptr);
24042         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
24043         FREE(untag_ptr(_res));
24044         COption_ChannelShutdownStateZ_free(_res_conv);
24045 }
24046
24047 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
24048         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24049         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
24050         int64_t ret_ref = tag_ptr(ret_copy, true);
24051         return ret_ref;
24052 }
24053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24054         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
24055         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
24056         return ret_conv;
24057 }
24058
24059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24060         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
24061         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
24062         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
24063         int64_t ret_ref = tag_ptr(ret_copy, true);
24064         return ret_ref;
24065 }
24066
24067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
24068         LDKThirtyTwoBytes o_ref;
24069         CHECK((*env)->GetArrayLength(env, o) == 32);
24070         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24071         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
24072         *ret_copy = COption_PaymentHashZ_some(o_ref);
24073         int64_t ret_ref = tag_ptr(ret_copy, true);
24074         return ret_ref;
24075 }
24076
24077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1none(JNIEnv *env, jclass clz) {
24078         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
24079         *ret_copy = COption_PaymentHashZ_none();
24080         int64_t ret_ref = tag_ptr(ret_copy, true);
24081         return ret_ref;
24082 }
24083
24084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24085         if (!ptr_is_owned(_res)) return;
24086         void* _res_ptr = untag_ptr(_res);
24087         CHECK_ACCESS(_res_ptr);
24088         LDKCOption_PaymentHashZ _res_conv = *(LDKCOption_PaymentHashZ*)(_res_ptr);
24089         FREE(untag_ptr(_res));
24090         COption_PaymentHashZ_free(_res_conv);
24091 }
24092
24093 static inline uint64_t COption_PaymentHashZ_clone_ptr(LDKCOption_PaymentHashZ *NONNULL_PTR arg) {
24094         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
24095         *ret_copy = COption_PaymentHashZ_clone(arg);
24096         int64_t ret_ref = tag_ptr(ret_copy, true);
24097         return ret_ref;
24098 }
24099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24100         LDKCOption_PaymentHashZ* arg_conv = (LDKCOption_PaymentHashZ*)untag_ptr(arg);
24101         int64_t ret_conv = COption_PaymentHashZ_clone_ptr(arg_conv);
24102         return ret_conv;
24103 }
24104
24105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentHashZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24106         LDKCOption_PaymentHashZ* orig_conv = (LDKCOption_PaymentHashZ*)untag_ptr(orig);
24107         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
24108         *ret_copy = COption_PaymentHashZ_clone(orig_conv);
24109         int64_t ret_ref = tag_ptr(ret_copy, true);
24110         return ret_ref;
24111 }
24112
24113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24114         LDKThirtyTwoBytes o_ref;
24115         CHECK((*env)->GetArrayLength(env, o) == 32);
24116         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24117         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24118         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
24119         return tag_ptr(ret_conv, true);
24120 }
24121
24122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24123         void* e_ptr = untag_ptr(e);
24124         CHECK_ACCESS(e_ptr);
24125         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24126         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24127         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24128         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
24129         return tag_ptr(ret_conv, true);
24130 }
24131
24132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24133         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
24134         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
24135         return ret_conv;
24136 }
24137
24138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24139         if (!ptr_is_owned(_res)) return;
24140         void* _res_ptr = untag_ptr(_res);
24141         CHECK_ACCESS(_res_ptr);
24142         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
24143         FREE(untag_ptr(_res));
24144         CResult__u832APIErrorZ_free(_res_conv);
24145 }
24146
24147 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
24148         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24149         *ret_conv = CResult__u832APIErrorZ_clone(arg);
24150         return tag_ptr(ret_conv, true);
24151 }
24152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24153         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
24154         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
24155         return ret_conv;
24156 }
24157
24158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24159         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
24160         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
24161         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
24162         return tag_ptr(ret_conv, true);
24163 }
24164
24165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24166         LDKCVec_RecentPaymentDetailsZ _res_constr;
24167         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24168         if (_res_constr.datalen > 0)
24169                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
24170         else
24171                 _res_constr.data = NULL;
24172         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24173         for (size_t w = 0; w < _res_constr.datalen; w++) {
24174                 int64_t _res_conv_22 = _res_vals[w];
24175                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
24176                 CHECK_ACCESS(_res_conv_22_ptr);
24177                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
24178                 FREE(untag_ptr(_res_conv_22));
24179                 _res_constr.data[w] = _res_conv_22_conv;
24180         }
24181         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24182         CVec_RecentPaymentDetailsZ_free(_res_constr);
24183 }
24184
24185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
24186         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24187         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
24188         return tag_ptr(ret_conv, true);
24189 }
24190
24191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24192         void* e_ptr = untag_ptr(e);
24193         CHECK_ACCESS(e_ptr);
24194         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24195         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24196         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24197         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
24198         return tag_ptr(ret_conv, true);
24199 }
24200
24201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24202         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
24203         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
24204         return ret_conv;
24205 }
24206
24207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24208         if (!ptr_is_owned(_res)) return;
24209         void* _res_ptr = untag_ptr(_res);
24210         CHECK_ACCESS(_res_ptr);
24211         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
24212         FREE(untag_ptr(_res));
24213         CResult_NonePaymentSendFailureZ_free(_res_conv);
24214 }
24215
24216 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
24217         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24218         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
24219         return tag_ptr(ret_conv, true);
24220 }
24221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24222         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
24223         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
24224         return ret_conv;
24225 }
24226
24227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24228         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
24229         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
24230         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
24231         return tag_ptr(ret_conv, true);
24232 }
24233
24234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
24235         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24236         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
24237         return tag_ptr(ret_conv, true);
24238 }
24239
24240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
24241         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
24242         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24243         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
24244         return tag_ptr(ret_conv, true);
24245 }
24246
24247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24248         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
24249         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
24250         return ret_conv;
24251 }
24252
24253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24254         if (!ptr_is_owned(_res)) return;
24255         void* _res_ptr = untag_ptr(_res);
24256         CHECK_ACCESS(_res_ptr);
24257         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
24258         FREE(untag_ptr(_res));
24259         CResult_NoneRetryableSendFailureZ_free(_res_conv);
24260 }
24261
24262 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
24263         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24264         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
24265         return tag_ptr(ret_conv, true);
24266 }
24267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24268         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
24269         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
24270         return ret_conv;
24271 }
24272
24273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24274         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
24275         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
24276         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
24277         return tag_ptr(ret_conv, true);
24278 }
24279
24280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24281         LDKThirtyTwoBytes o_ref;
24282         CHECK((*env)->GetArrayLength(env, o) == 32);
24283         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24284         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
24285         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
24286         return tag_ptr(ret_conv, true);
24287 }
24288
24289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24290         void* e_ptr = untag_ptr(e);
24291         CHECK_ACCESS(e_ptr);
24292         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24293         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24294         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
24295         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
24296         return tag_ptr(ret_conv, true);
24297 }
24298
24299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24300         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
24301         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
24302         return ret_conv;
24303 }
24304
24305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24306         if (!ptr_is_owned(_res)) return;
24307         void* _res_ptr = untag_ptr(_res);
24308         CHECK_ACCESS(_res_ptr);
24309         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
24310         FREE(untag_ptr(_res));
24311         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
24312 }
24313
24314 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
24315         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
24316         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
24317         return tag_ptr(ret_conv, true);
24318 }
24319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24320         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
24321         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
24322         return ret_conv;
24323 }
24324
24325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24326         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
24327         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
24328         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
24329         return tag_ptr(ret_conv, true);
24330 }
24331
24332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24333         LDKThirtyTwoBytes o_ref;
24334         CHECK((*env)->GetArrayLength(env, o) == 32);
24335         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24336         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
24337         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
24338         return tag_ptr(ret_conv, true);
24339 }
24340
24341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
24342         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
24343         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
24344         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
24345         return tag_ptr(ret_conv, true);
24346 }
24347
24348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24349         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
24350         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
24351         return ret_conv;
24352 }
24353
24354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24355         if (!ptr_is_owned(_res)) return;
24356         void* _res_ptr = untag_ptr(_res);
24357         CHECK_ACCESS(_res_ptr);
24358         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
24359         FREE(untag_ptr(_res));
24360         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
24361 }
24362
24363 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
24364         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
24365         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
24366         return tag_ptr(ret_conv, true);
24367 }
24368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24369         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
24370         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
24371         return ret_conv;
24372 }
24373
24374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24375         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
24376         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
24377         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
24378         return tag_ptr(ret_conv, true);
24379 }
24380
24381 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
24382         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
24383         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
24384         return tag_ptr(ret_conv, true);
24385 }
24386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24387         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
24388         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
24389         return ret_conv;
24390 }
24391
24392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24393         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
24394         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
24395         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
24396         return tag_ptr(ret_conv, true);
24397 }
24398
24399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
24400         LDKThirtyTwoBytes a_ref;
24401         CHECK((*env)->GetArrayLength(env, a) == 32);
24402         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
24403         LDKThirtyTwoBytes b_ref;
24404         CHECK((*env)->GetArrayLength(env, b) == 32);
24405         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
24406         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
24407         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
24408         return tag_ptr(ret_conv, true);
24409 }
24410
24411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24412         if (!ptr_is_owned(_res)) return;
24413         void* _res_ptr = untag_ptr(_res);
24414         CHECK_ACCESS(_res_ptr);
24415         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
24416         FREE(untag_ptr(_res));
24417         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
24418 }
24419
24420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24421         void* o_ptr = untag_ptr(o);
24422         CHECK_ACCESS(o_ptr);
24423         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
24424         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
24425         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
24426         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
24427         return tag_ptr(ret_conv, true);
24428 }
24429
24430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24431         void* e_ptr = untag_ptr(e);
24432         CHECK_ACCESS(e_ptr);
24433         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
24434         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
24435         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
24436         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
24437         return tag_ptr(ret_conv, true);
24438 }
24439
24440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24441         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
24442         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
24443         return ret_conv;
24444 }
24445
24446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24447         if (!ptr_is_owned(_res)) return;
24448         void* _res_ptr = untag_ptr(_res);
24449         CHECK_ACCESS(_res_ptr);
24450         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
24451         FREE(untag_ptr(_res));
24452         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
24453 }
24454
24455 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
24456         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
24457         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
24458         return tag_ptr(ret_conv, true);
24459 }
24460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24461         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
24462         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
24463         return ret_conv;
24464 }
24465
24466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24467         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
24468         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
24469         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
24470         return tag_ptr(ret_conv, true);
24471 }
24472
24473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
24474         LDKCVec_ThirtyTwoBytesZ _res_constr;
24475         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24476         if (_res_constr.datalen > 0)
24477                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
24478         else
24479                 _res_constr.data = NULL;
24480         for (size_t i = 0; i < _res_constr.datalen; i++) {
24481                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
24482                 LDKThirtyTwoBytes _res_conv_8_ref;
24483                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
24484                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
24485                 _res_constr.data[i] = _res_conv_8_ref;
24486         }
24487         CVec_ThirtyTwoBytesZ_free(_res_constr);
24488 }
24489
24490 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
24491         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
24492         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
24493         return tag_ptr(ret_conv, true);
24494 }
24495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24496         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
24497         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
24498         return ret_conv;
24499 }
24500
24501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24502         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
24503         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
24504         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
24505         return tag_ptr(ret_conv, true);
24506 }
24507
24508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
24509         LDKThirtyTwoBytes a_ref;
24510         CHECK((*env)->GetArrayLength(env, a) == 32);
24511         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
24512         LDKThirtyTwoBytes b_ref;
24513         CHECK((*env)->GetArrayLength(env, b) == 32);
24514         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
24515         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
24516         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
24517         return tag_ptr(ret_conv, true);
24518 }
24519
24520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24521         if (!ptr_is_owned(_res)) return;
24522         void* _res_ptr = untag_ptr(_res);
24523         CHECK_ACCESS(_res_ptr);
24524         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
24525         FREE(untag_ptr(_res));
24526         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
24527 }
24528
24529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24530         void* o_ptr = untag_ptr(o);
24531         CHECK_ACCESS(o_ptr);
24532         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
24533         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
24534         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
24535         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
24536         return tag_ptr(ret_conv, true);
24537 }
24538
24539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
24540         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
24541         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
24542         return tag_ptr(ret_conv, true);
24543 }
24544
24545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24546         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
24547         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
24548         return ret_conv;
24549 }
24550
24551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24552         if (!ptr_is_owned(_res)) return;
24553         void* _res_ptr = untag_ptr(_res);
24554         CHECK_ACCESS(_res_ptr);
24555         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
24556         FREE(untag_ptr(_res));
24557         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
24558 }
24559
24560 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
24561         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
24562         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
24563         return tag_ptr(ret_conv, true);
24564 }
24565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24566         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
24567         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
24568         return ret_conv;
24569 }
24570
24571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24572         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
24573         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
24574         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
24575         return tag_ptr(ret_conv, true);
24576 }
24577
24578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24579         LDKThirtyTwoBytes o_ref;
24580         CHECK((*env)->GetArrayLength(env, o) == 32);
24581         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24582         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
24583         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
24584         return tag_ptr(ret_conv, true);
24585 }
24586
24587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
24588         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
24589         *ret_conv = CResult_PaymentSecretNoneZ_err();
24590         return tag_ptr(ret_conv, true);
24591 }
24592
24593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24594         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
24595         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
24596         return ret_conv;
24597 }
24598
24599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24600         if (!ptr_is_owned(_res)) return;
24601         void* _res_ptr = untag_ptr(_res);
24602         CHECK_ACCESS(_res_ptr);
24603         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
24604         FREE(untag_ptr(_res));
24605         CResult_PaymentSecretNoneZ_free(_res_conv);
24606 }
24607
24608 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
24609         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
24610         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
24611         return tag_ptr(ret_conv, true);
24612 }
24613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24614         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
24615         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
24616         return ret_conv;
24617 }
24618
24619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24620         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
24621         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
24622         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
24623         return tag_ptr(ret_conv, true);
24624 }
24625
24626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24627         LDKThirtyTwoBytes o_ref;
24628         CHECK((*env)->GetArrayLength(env, o) == 32);
24629         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24630         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
24631         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
24632         return tag_ptr(ret_conv, true);
24633 }
24634
24635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24636         void* e_ptr = untag_ptr(e);
24637         CHECK_ACCESS(e_ptr);
24638         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24639         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24640         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
24641         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
24642         return tag_ptr(ret_conv, true);
24643 }
24644
24645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24646         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
24647         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
24648         return ret_conv;
24649 }
24650
24651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24652         if (!ptr_is_owned(_res)) return;
24653         void* _res_ptr = untag_ptr(_res);
24654         CHECK_ACCESS(_res_ptr);
24655         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
24656         FREE(untag_ptr(_res));
24657         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
24658 }
24659
24660 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
24661         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
24662         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
24663         return tag_ptr(ret_conv, true);
24664 }
24665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24666         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
24667         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
24668         return ret_conv;
24669 }
24670
24671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24672         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
24673         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
24674         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
24675         return tag_ptr(ret_conv, true);
24676 }
24677
24678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
24679         LDKCVec_ChainHashZ o_constr;
24680         o_constr.datalen = (*env)->GetArrayLength(env, o);
24681         if (o_constr.datalen > 0)
24682                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
24683         else
24684                 o_constr.data = NULL;
24685         for (size_t i = 0; i < o_constr.datalen; i++) {
24686                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
24687                 LDKThirtyTwoBytes o_conv_8_ref;
24688                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
24689                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
24690                 o_constr.data[i] = o_conv_8_ref;
24691         }
24692         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
24693         *ret_copy = COption_CVec_ChainHashZZ_some(o_constr);
24694         int64_t ret_ref = tag_ptr(ret_copy, true);
24695         return ret_ref;
24696 }
24697
24698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1none(JNIEnv *env, jclass clz) {
24699         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
24700         *ret_copy = COption_CVec_ChainHashZZ_none();
24701         int64_t ret_ref = tag_ptr(ret_copy, true);
24702         return ret_ref;
24703 }
24704
24705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24706         if (!ptr_is_owned(_res)) return;
24707         void* _res_ptr = untag_ptr(_res);
24708         CHECK_ACCESS(_res_ptr);
24709         LDKCOption_CVec_ChainHashZZ _res_conv = *(LDKCOption_CVec_ChainHashZZ*)(_res_ptr);
24710         FREE(untag_ptr(_res));
24711         COption_CVec_ChainHashZZ_free(_res_conv);
24712 }
24713
24714 static inline uint64_t COption_CVec_ChainHashZZ_clone_ptr(LDKCOption_CVec_ChainHashZZ *NONNULL_PTR arg) {
24715         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
24716         *ret_copy = COption_CVec_ChainHashZZ_clone(arg);
24717         int64_t ret_ref = tag_ptr(ret_copy, true);
24718         return ret_ref;
24719 }
24720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24721         LDKCOption_CVec_ChainHashZZ* arg_conv = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(arg);
24722         int64_t ret_conv = COption_CVec_ChainHashZZ_clone_ptr(arg_conv);
24723         return ret_conv;
24724 }
24725
24726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ChainHashZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24727         LDKCOption_CVec_ChainHashZZ* orig_conv = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(orig);
24728         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
24729         *ret_copy = COption_CVec_ChainHashZZ_clone(orig_conv);
24730         int64_t ret_ref = tag_ptr(ret_copy, true);
24731         return ret_ref;
24732 }
24733
24734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24735         LDKCounterpartyForwardingInfo o_conv;
24736         o_conv.inner = untag_ptr(o);
24737         o_conv.is_owned = ptr_is_owned(o);
24738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24739         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
24740         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24741         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
24742         return tag_ptr(ret_conv, true);
24743 }
24744
24745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24746         void* e_ptr = untag_ptr(e);
24747         CHECK_ACCESS(e_ptr);
24748         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24749         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24750         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24751         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
24752         return tag_ptr(ret_conv, true);
24753 }
24754
24755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24756         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
24757         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
24758         return ret_conv;
24759 }
24760
24761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24762         if (!ptr_is_owned(_res)) return;
24763         void* _res_ptr = untag_ptr(_res);
24764         CHECK_ACCESS(_res_ptr);
24765         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
24766         FREE(untag_ptr(_res));
24767         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
24768 }
24769
24770 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
24771         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24772         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
24773         return tag_ptr(ret_conv, true);
24774 }
24775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24776         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
24777         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
24778         return ret_conv;
24779 }
24780
24781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24782         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
24783         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
24784         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
24785         return tag_ptr(ret_conv, true);
24786 }
24787
24788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24789         LDKChannelCounterparty o_conv;
24790         o_conv.inner = untag_ptr(o);
24791         o_conv.is_owned = ptr_is_owned(o);
24792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24793         o_conv = ChannelCounterparty_clone(&o_conv);
24794         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24795         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
24796         return tag_ptr(ret_conv, true);
24797 }
24798
24799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24800         void* e_ptr = untag_ptr(e);
24801         CHECK_ACCESS(e_ptr);
24802         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24803         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24804         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24805         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
24806         return tag_ptr(ret_conv, true);
24807 }
24808
24809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24810         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
24811         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
24812         return ret_conv;
24813 }
24814
24815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24816         if (!ptr_is_owned(_res)) return;
24817         void* _res_ptr = untag_ptr(_res);
24818         CHECK_ACCESS(_res_ptr);
24819         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
24820         FREE(untag_ptr(_res));
24821         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
24822 }
24823
24824 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
24825         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24826         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
24827         return tag_ptr(ret_conv, true);
24828 }
24829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24830         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
24831         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
24832         return ret_conv;
24833 }
24834
24835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24836         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
24837         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
24838         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
24839         return tag_ptr(ret_conv, true);
24840 }
24841
24842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24843         LDKChannelDetails o_conv;
24844         o_conv.inner = untag_ptr(o);
24845         o_conv.is_owned = ptr_is_owned(o);
24846         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24847         o_conv = ChannelDetails_clone(&o_conv);
24848         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24849         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
24850         return tag_ptr(ret_conv, true);
24851 }
24852
24853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24854         void* e_ptr = untag_ptr(e);
24855         CHECK_ACCESS(e_ptr);
24856         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24857         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24858         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24859         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
24860         return tag_ptr(ret_conv, true);
24861 }
24862
24863 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24864         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
24865         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
24866         return ret_conv;
24867 }
24868
24869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24870         if (!ptr_is_owned(_res)) return;
24871         void* _res_ptr = untag_ptr(_res);
24872         CHECK_ACCESS(_res_ptr);
24873         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
24874         FREE(untag_ptr(_res));
24875         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
24876 }
24877
24878 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
24879         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24880         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
24881         return tag_ptr(ret_conv, true);
24882 }
24883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24884         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
24885         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
24886         return ret_conv;
24887 }
24888
24889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24890         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
24891         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
24892         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
24893         return tag_ptr(ret_conv, true);
24894 }
24895
24896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24897         LDKPhantomRouteHints o_conv;
24898         o_conv.inner = untag_ptr(o);
24899         o_conv.is_owned = ptr_is_owned(o);
24900         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24901         o_conv = PhantomRouteHints_clone(&o_conv);
24902         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24903         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
24904         return tag_ptr(ret_conv, true);
24905 }
24906
24907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24908         void* e_ptr = untag_ptr(e);
24909         CHECK_ACCESS(e_ptr);
24910         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24911         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24912         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24913         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
24914         return tag_ptr(ret_conv, true);
24915 }
24916
24917 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24918         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
24919         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
24920         return ret_conv;
24921 }
24922
24923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24924         if (!ptr_is_owned(_res)) return;
24925         void* _res_ptr = untag_ptr(_res);
24926         CHECK_ACCESS(_res_ptr);
24927         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
24928         FREE(untag_ptr(_res));
24929         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
24930 }
24931
24932 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
24933         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24934         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
24935         return tag_ptr(ret_conv, true);
24936 }
24937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24938         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
24939         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
24940         return ret_conv;
24941 }
24942
24943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24944         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
24945         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
24946         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
24947         return tag_ptr(ret_conv, true);
24948 }
24949
24950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
24951         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
24952         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
24953         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
24954         return tag_ptr(ret_conv, true);
24955 }
24956
24957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24958         void* e_ptr = untag_ptr(e);
24959         CHECK_ACCESS(e_ptr);
24960         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24961         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24962         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
24963         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
24964         return tag_ptr(ret_conv, true);
24965 }
24966
24967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24968         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
24969         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
24970         return ret_conv;
24971 }
24972
24973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24974         if (!ptr_is_owned(_res)) return;
24975         void* _res_ptr = untag_ptr(_res);
24976         CHECK_ACCESS(_res_ptr);
24977         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
24978         FREE(untag_ptr(_res));
24979         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
24980 }
24981
24982 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
24983         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
24984         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
24985         return tag_ptr(ret_conv, true);
24986 }
24987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24988         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
24989         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
24990         return ret_conv;
24991 }
24992
24993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24994         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
24995         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
24996         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
24997         return tag_ptr(ret_conv, true);
24998 }
24999
25000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25001         LDKCVec_ChannelMonitorZ _res_constr;
25002         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25003         if (_res_constr.datalen > 0)
25004                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
25005         else
25006                 _res_constr.data = NULL;
25007         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25008         for (size_t q = 0; q < _res_constr.datalen; q++) {
25009                 int64_t _res_conv_16 = _res_vals[q];
25010                 LDKChannelMonitor _res_conv_16_conv;
25011                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
25012                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
25013                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
25014                 _res_constr.data[q] = _res_conv_16_conv;
25015         }
25016         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25017         CVec_ChannelMonitorZ_free(_res_constr);
25018 }
25019
25020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
25021         LDKThirtyTwoBytes a_ref;
25022         CHECK((*env)->GetArrayLength(env, a) == 32);
25023         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25024         LDKChannelManager b_conv;
25025         b_conv.inner = untag_ptr(b);
25026         b_conv.is_owned = ptr_is_owned(b);
25027         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25028         // WARNING: we need a move here but no clone is available for LDKChannelManager
25029         
25030         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
25031         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
25032         return tag_ptr(ret_conv, true);
25033 }
25034
25035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25036         if (!ptr_is_owned(_res)) return;
25037         void* _res_ptr = untag_ptr(_res);
25038         CHECK_ACCESS(_res_ptr);
25039         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
25040         FREE(untag_ptr(_res));
25041         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
25042 }
25043
25044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25045         void* o_ptr = untag_ptr(o);
25046         CHECK_ACCESS(o_ptr);
25047         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
25048         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
25049         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
25050         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
25051         return tag_ptr(ret_conv, true);
25052 }
25053
25054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25055         void* e_ptr = untag_ptr(e);
25056         CHECK_ACCESS(e_ptr);
25057         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25058         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25059         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
25060         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
25061         return tag_ptr(ret_conv, true);
25062 }
25063
25064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25065         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
25066         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
25067         return ret_conv;
25068 }
25069
25070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25071         if (!ptr_is_owned(_res)) return;
25072         void* _res_ptr = untag_ptr(_res);
25073         CHECK_ACCESS(_res_ptr);
25074         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
25075         FREE(untag_ptr(_res));
25076         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
25077 }
25078
25079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25080         void* o_ptr = untag_ptr(o);
25081         CHECK_ACCESS(o_ptr);
25082         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25083         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25084         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25085         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
25086         return tag_ptr(ret_conv, true);
25087 }
25088
25089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25090         void* e_ptr = untag_ptr(e);
25091         CHECK_ACCESS(e_ptr);
25092         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25093         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25094         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25095         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
25096         return tag_ptr(ret_conv, true);
25097 }
25098
25099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25100         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
25101         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
25102         return ret_conv;
25103 }
25104
25105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25106         if (!ptr_is_owned(_res)) return;
25107         void* _res_ptr = untag_ptr(_res);
25108         CHECK_ACCESS(_res_ptr);
25109         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
25110         FREE(untag_ptr(_res));
25111         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
25112 }
25113
25114 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
25115         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25116         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
25117         return tag_ptr(ret_conv, true);
25118 }
25119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25120         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
25121         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
25122         return ret_conv;
25123 }
25124
25125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25126         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
25127         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
25128         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
25129         return tag_ptr(ret_conv, true);
25130 }
25131
25132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25133         LDKChannelConfig o_conv;
25134         o_conv.inner = untag_ptr(o);
25135         o_conv.is_owned = ptr_is_owned(o);
25136         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25137         o_conv = ChannelConfig_clone(&o_conv);
25138         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25139         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
25140         return tag_ptr(ret_conv, true);
25141 }
25142
25143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25144         void* e_ptr = untag_ptr(e);
25145         CHECK_ACCESS(e_ptr);
25146         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25147         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25148         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25149         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
25150         return tag_ptr(ret_conv, true);
25151 }
25152
25153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25154         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
25155         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
25156         return ret_conv;
25157 }
25158
25159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25160         if (!ptr_is_owned(_res)) return;
25161         void* _res_ptr = untag_ptr(_res);
25162         CHECK_ACCESS(_res_ptr);
25163         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
25164         FREE(untag_ptr(_res));
25165         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
25166 }
25167
25168 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
25169         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25170         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
25171         return tag_ptr(ret_conv, true);
25172 }
25173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25174         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
25175         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
25176         return ret_conv;
25177 }
25178
25179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25180         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
25181         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
25182         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
25183         return tag_ptr(ret_conv, true);
25184 }
25185
25186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25187         void* o_ptr = untag_ptr(o);
25188         CHECK_ACCESS(o_ptr);
25189         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
25190         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
25191         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25192         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
25193         int64_t ret_ref = tag_ptr(ret_copy, true);
25194         return ret_ref;
25195 }
25196
25197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
25198         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25199         *ret_copy = COption_MaxDustHTLCExposureZ_none();
25200         int64_t ret_ref = tag_ptr(ret_copy, true);
25201         return ret_ref;
25202 }
25203
25204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25205         if (!ptr_is_owned(_res)) return;
25206         void* _res_ptr = untag_ptr(_res);
25207         CHECK_ACCESS(_res_ptr);
25208         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
25209         FREE(untag_ptr(_res));
25210         COption_MaxDustHTLCExposureZ_free(_res_conv);
25211 }
25212
25213 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
25214         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25215         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
25216         int64_t ret_ref = tag_ptr(ret_copy, true);
25217         return ret_ref;
25218 }
25219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25220         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
25221         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
25222         return ret_conv;
25223 }
25224
25225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25226         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
25227         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
25228         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
25229         int64_t ret_ref = tag_ptr(ret_copy, true);
25230         return ret_ref;
25231 }
25232
25233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25234         void* o_ptr = untag_ptr(o);
25235         CHECK_ACCESS(o_ptr);
25236         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
25237         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
25238         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25239         *ret_copy = COption_APIErrorZ_some(o_conv);
25240         int64_t ret_ref = tag_ptr(ret_copy, true);
25241         return ret_ref;
25242 }
25243
25244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
25245         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25246         *ret_copy = COption_APIErrorZ_none();
25247         int64_t ret_ref = tag_ptr(ret_copy, true);
25248         return ret_ref;
25249 }
25250
25251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25252         if (!ptr_is_owned(_res)) return;
25253         void* _res_ptr = untag_ptr(_res);
25254         CHECK_ACCESS(_res_ptr);
25255         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
25256         FREE(untag_ptr(_res));
25257         COption_APIErrorZ_free(_res_conv);
25258 }
25259
25260 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
25261         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25262         *ret_copy = COption_APIErrorZ_clone(arg);
25263         int64_t ret_ref = tag_ptr(ret_copy, true);
25264         return ret_ref;
25265 }
25266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25267         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
25268         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
25269         return ret_conv;
25270 }
25271
25272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25273         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
25274         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
25275         *ret_copy = COption_APIErrorZ_clone(orig_conv);
25276         int64_t ret_ref = tag_ptr(ret_copy, true);
25277         return ret_ref;
25278 }
25279
25280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25281         void* o_ptr = untag_ptr(o);
25282         CHECK_ACCESS(o_ptr);
25283         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
25284         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
25285         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25286         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
25287         return tag_ptr(ret_conv, true);
25288 }
25289
25290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25291         void* e_ptr = untag_ptr(e);
25292         CHECK_ACCESS(e_ptr);
25293         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25294         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25295         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25296         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
25297         return tag_ptr(ret_conv, true);
25298 }
25299
25300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25301         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
25302         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
25303         return ret_conv;
25304 }
25305
25306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25307         if (!ptr_is_owned(_res)) return;
25308         void* _res_ptr = untag_ptr(_res);
25309         CHECK_ACCESS(_res_ptr);
25310         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
25311         FREE(untag_ptr(_res));
25312         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
25313 }
25314
25315 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
25316         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25317         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
25318         return tag_ptr(ret_conv, true);
25319 }
25320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25321         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
25322         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
25323         return ret_conv;
25324 }
25325
25326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25327         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
25328         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
25329         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
25330         return tag_ptr(ret_conv, true);
25331 }
25332
25333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25334         LDKChannelMonitorUpdate o_conv;
25335         o_conv.inner = untag_ptr(o);
25336         o_conv.is_owned = ptr_is_owned(o);
25337         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25338         o_conv = ChannelMonitorUpdate_clone(&o_conv);
25339         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25340         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
25341         return tag_ptr(ret_conv, true);
25342 }
25343
25344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25345         void* e_ptr = untag_ptr(e);
25346         CHECK_ACCESS(e_ptr);
25347         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25348         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25349         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25350         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
25351         return tag_ptr(ret_conv, true);
25352 }
25353
25354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25355         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
25356         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
25357         return ret_conv;
25358 }
25359
25360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25361         if (!ptr_is_owned(_res)) return;
25362         void* _res_ptr = untag_ptr(_res);
25363         CHECK_ACCESS(_res_ptr);
25364         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
25365         FREE(untag_ptr(_res));
25366         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
25367 }
25368
25369 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
25370         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25371         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
25372         return tag_ptr(ret_conv, true);
25373 }
25374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25375         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
25376         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
25377         return ret_conv;
25378 }
25379
25380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25381         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
25382         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25383         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
25384         return tag_ptr(ret_conv, true);
25385 }
25386
25387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25388         void* o_ptr = untag_ptr(o);
25389         CHECK_ACCESS(o_ptr);
25390         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
25391         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
25392         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25393         *ret_copy = COption_MonitorEventZ_some(o_conv);
25394         int64_t ret_ref = tag_ptr(ret_copy, true);
25395         return ret_ref;
25396 }
25397
25398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
25399         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25400         *ret_copy = COption_MonitorEventZ_none();
25401         int64_t ret_ref = tag_ptr(ret_copy, true);
25402         return ret_ref;
25403 }
25404
25405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25406         if (!ptr_is_owned(_res)) return;
25407         void* _res_ptr = untag_ptr(_res);
25408         CHECK_ACCESS(_res_ptr);
25409         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
25410         FREE(untag_ptr(_res));
25411         COption_MonitorEventZ_free(_res_conv);
25412 }
25413
25414 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
25415         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25416         *ret_copy = COption_MonitorEventZ_clone(arg);
25417         int64_t ret_ref = tag_ptr(ret_copy, true);
25418         return ret_ref;
25419 }
25420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25421         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
25422         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
25423         return ret_conv;
25424 }
25425
25426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25427         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
25428         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
25429         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
25430         int64_t ret_ref = tag_ptr(ret_copy, true);
25431         return ret_ref;
25432 }
25433
25434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25435         void* o_ptr = untag_ptr(o);
25436         CHECK_ACCESS(o_ptr);
25437         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
25438         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
25439         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25440         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
25441         return tag_ptr(ret_conv, true);
25442 }
25443
25444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25445         void* e_ptr = untag_ptr(e);
25446         CHECK_ACCESS(e_ptr);
25447         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25448         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25449         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25450         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
25451         return tag_ptr(ret_conv, true);
25452 }
25453
25454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25455         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
25456         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
25457         return ret_conv;
25458 }
25459
25460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25461         if (!ptr_is_owned(_res)) return;
25462         void* _res_ptr = untag_ptr(_res);
25463         CHECK_ACCESS(_res_ptr);
25464         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
25465         FREE(untag_ptr(_res));
25466         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
25467 }
25468
25469 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
25470         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25471         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
25472         return tag_ptr(ret_conv, true);
25473 }
25474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25475         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
25476         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
25477         return ret_conv;
25478 }
25479
25480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25481         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
25482         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25483         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
25484         return tag_ptr(ret_conv, true);
25485 }
25486
25487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25488         LDKHTLCUpdate o_conv;
25489         o_conv.inner = untag_ptr(o);
25490         o_conv.is_owned = ptr_is_owned(o);
25491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25492         o_conv = HTLCUpdate_clone(&o_conv);
25493         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25494         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
25495         return tag_ptr(ret_conv, true);
25496 }
25497
25498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25499         void* e_ptr = untag_ptr(e);
25500         CHECK_ACCESS(e_ptr);
25501         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25502         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25503         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25504         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
25505         return tag_ptr(ret_conv, true);
25506 }
25507
25508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25509         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
25510         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
25511         return ret_conv;
25512 }
25513
25514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25515         if (!ptr_is_owned(_res)) return;
25516         void* _res_ptr = untag_ptr(_res);
25517         CHECK_ACCESS(_res_ptr);
25518         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
25519         FREE(untag_ptr(_res));
25520         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
25521 }
25522
25523 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
25524         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25525         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
25526         return tag_ptr(ret_conv, true);
25527 }
25528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25529         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
25530         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
25531         return ret_conv;
25532 }
25533
25534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25535         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
25536         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25537         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
25538         return tag_ptr(ret_conv, true);
25539 }
25540
25541 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
25542         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25543         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
25544         return tag_ptr(ret_conv, true);
25545 }
25546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25547         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
25548         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
25549         return ret_conv;
25550 }
25551
25552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25553         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
25554         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25555         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
25556         return tag_ptr(ret_conv, true);
25557 }
25558
25559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
25560         LDKOutPoint a_conv;
25561         a_conv.inner = untag_ptr(a);
25562         a_conv.is_owned = ptr_is_owned(a);
25563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25564         a_conv = OutPoint_clone(&a_conv);
25565         LDKCVec_u8Z b_ref;
25566         b_ref.datalen = (*env)->GetArrayLength(env, b);
25567         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25568         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
25569         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25570         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
25571         return tag_ptr(ret_conv, true);
25572 }
25573
25574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25575         if (!ptr_is_owned(_res)) return;
25576         void* _res_ptr = untag_ptr(_res);
25577         CHECK_ACCESS(_res_ptr);
25578         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
25579         FREE(untag_ptr(_res));
25580         C2Tuple_OutPointScriptZ_free(_res_conv);
25581 }
25582
25583 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
25584         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
25585         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
25586         return tag_ptr(ret_conv, true);
25587 }
25588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25589         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
25590         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
25591         return ret_conv;
25592 }
25593
25594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25595         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
25596         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
25597         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
25598         return tag_ptr(ret_conv, true);
25599 }
25600
25601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
25602         LDKCVec_u8Z b_ref;
25603         b_ref.datalen = (*env)->GetArrayLength(env, b);
25604         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
25605         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
25606         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
25607         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
25608         return tag_ptr(ret_conv, true);
25609 }
25610
25611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25612         if (!ptr_is_owned(_res)) return;
25613         void* _res_ptr = untag_ptr(_res);
25614         CHECK_ACCESS(_res_ptr);
25615         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
25616         FREE(untag_ptr(_res));
25617         C2Tuple_u32ScriptZ_free(_res_conv);
25618 }
25619
25620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25621         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
25622         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25623         if (_res_constr.datalen > 0)
25624                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
25625         else
25626                 _res_constr.data = NULL;
25627         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25628         for (size_t v = 0; v < _res_constr.datalen; v++) {
25629                 int64_t _res_conv_21 = _res_vals[v];
25630                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
25631                 CHECK_ACCESS(_res_conv_21_ptr);
25632                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
25633                 FREE(untag_ptr(_res_conv_21));
25634                 _res_constr.data[v] = _res_conv_21_conv;
25635         }
25636         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25637         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
25638 }
25639
25640 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
25641         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25642         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
25643         return tag_ptr(ret_conv, true);
25644 }
25645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25646         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
25647         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
25648         return ret_conv;
25649 }
25650
25651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25652         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
25653         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25654         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
25655         return tag_ptr(ret_conv, true);
25656 }
25657
25658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
25659         LDKThirtyTwoBytes a_ref;
25660         CHECK((*env)->GetArrayLength(env, a) == 32);
25661         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25662         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
25663         b_constr.datalen = (*env)->GetArrayLength(env, b);
25664         if (b_constr.datalen > 0)
25665                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
25666         else
25667                 b_constr.data = NULL;
25668         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
25669         for (size_t v = 0; v < b_constr.datalen; v++) {
25670                 int64_t b_conv_21 = b_vals[v];
25671                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
25672                 CHECK_ACCESS(b_conv_21_ptr);
25673                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
25674                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
25675                 b_constr.data[v] = b_conv_21_conv;
25676         }
25677         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
25678         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25679         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
25680         return tag_ptr(ret_conv, true);
25681 }
25682
25683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25684         if (!ptr_is_owned(_res)) return;
25685         void* _res_ptr = untag_ptr(_res);
25686         CHECK_ACCESS(_res_ptr);
25687         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
25688         FREE(untag_ptr(_res));
25689         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
25690 }
25691
25692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25693         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
25694         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25695         if (_res_constr.datalen > 0)
25696                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
25697         else
25698                 _res_constr.data = NULL;
25699         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25700         for (size_t o = 0; o < _res_constr.datalen; o++) {
25701                 int64_t _res_conv_40 = _res_vals[o];
25702                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
25703                 CHECK_ACCESS(_res_conv_40_ptr);
25704                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
25705                 FREE(untag_ptr(_res_conv_40));
25706                 _res_constr.data[o] = _res_conv_40_conv;
25707         }
25708         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25709         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
25710 }
25711
25712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
25713         LDKCVec_TransactionZ _res_constr;
25714         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25715         if (_res_constr.datalen > 0)
25716                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
25717         else
25718                 _res_constr.data = NULL;
25719         for (size_t i = 0; i < _res_constr.datalen; i++) {
25720                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
25721                 LDKTransaction _res_conv_8_ref;
25722                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
25723                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
25724                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
25725                 _res_conv_8_ref.data_is_owned = true;
25726                 _res_constr.data[i] = _res_conv_8_ref;
25727         }
25728         CVec_TransactionZ_free(_res_constr);
25729 }
25730
25731 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
25732         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25733         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
25734         return tag_ptr(ret_conv, true);
25735 }
25736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25737         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
25738         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
25739         return ret_conv;
25740 }
25741
25742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25743         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
25744         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25745         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
25746         return tag_ptr(ret_conv, true);
25747 }
25748
25749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
25750         void* b_ptr = untag_ptr(b);
25751         CHECK_ACCESS(b_ptr);
25752         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
25753         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
25754         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
25755         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
25756         return tag_ptr(ret_conv, true);
25757 }
25758
25759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25760         if (!ptr_is_owned(_res)) return;
25761         void* _res_ptr = untag_ptr(_res);
25762         CHECK_ACCESS(_res_ptr);
25763         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
25764         FREE(untag_ptr(_res));
25765         C2Tuple_u32TxOutZ_free(_res_conv);
25766 }
25767
25768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25769         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
25770         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25771         if (_res_constr.datalen > 0)
25772                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25773         else
25774                 _res_constr.data = NULL;
25775         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25776         for (size_t u = 0; u < _res_constr.datalen; u++) {
25777                 int64_t _res_conv_20 = _res_vals[u];
25778                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
25779                 CHECK_ACCESS(_res_conv_20_ptr);
25780                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
25781                 FREE(untag_ptr(_res_conv_20));
25782                 _res_constr.data[u] = _res_conv_20_conv;
25783         }
25784         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25785         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
25786 }
25787
25788 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
25789         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25790         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
25791         return tag_ptr(ret_conv, true);
25792 }
25793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25794         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
25795         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
25796         return ret_conv;
25797 }
25798
25799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25800         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
25801         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25802         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
25803         return tag_ptr(ret_conv, true);
25804 }
25805
25806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
25807         LDKThirtyTwoBytes a_ref;
25808         CHECK((*env)->GetArrayLength(env, a) == 32);
25809         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25810         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
25811         b_constr.datalen = (*env)->GetArrayLength(env, b);
25812         if (b_constr.datalen > 0)
25813                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
25814         else
25815                 b_constr.data = NULL;
25816         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
25817         for (size_t u = 0; u < b_constr.datalen; u++) {
25818                 int64_t b_conv_20 = b_vals[u];
25819                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
25820                 CHECK_ACCESS(b_conv_20_ptr);
25821                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
25822                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
25823                 b_constr.data[u] = b_conv_20_conv;
25824         }
25825         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
25826         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25827         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
25828         return tag_ptr(ret_conv, true);
25829 }
25830
25831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25832         if (!ptr_is_owned(_res)) return;
25833         void* _res_ptr = untag_ptr(_res);
25834         CHECK_ACCESS(_res_ptr);
25835         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
25836         FREE(untag_ptr(_res));
25837         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
25838 }
25839
25840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25841         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
25842         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25843         if (_res_constr.datalen > 0)
25844                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
25845         else
25846                 _res_constr.data = NULL;
25847         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25848         for (size_t n = 0; n < _res_constr.datalen; n++) {
25849                 int64_t _res_conv_39 = _res_vals[n];
25850                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
25851                 CHECK_ACCESS(_res_conv_39_ptr);
25852                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
25853                 FREE(untag_ptr(_res_conv_39));
25854                 _res_constr.data[n] = _res_conv_39_conv;
25855         }
25856         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25857         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
25858 }
25859
25860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25861         LDKCVec_BalanceZ _res_constr;
25862         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25863         if (_res_constr.datalen > 0)
25864                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
25865         else
25866                 _res_constr.data = NULL;
25867         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25868         for (size_t j = 0; j < _res_constr.datalen; j++) {
25869                 int64_t _res_conv_9 = _res_vals[j];
25870                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
25871                 CHECK_ACCESS(_res_conv_9_ptr);
25872                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
25873                 FREE(untag_ptr(_res_conv_9));
25874                 _res_constr.data[j] = _res_conv_9_conv;
25875         }
25876         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25877         CVec_BalanceZ_free(_res_constr);
25878 }
25879
25880 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
25881         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
25882         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
25883         return tag_ptr(ret_conv, true);
25884 }
25885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25886         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
25887         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
25888         return ret_conv;
25889 }
25890
25891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25892         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
25893         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
25894         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
25895         return tag_ptr(ret_conv, true);
25896 }
25897
25898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
25899         LDKThirtyTwoBytes a_ref;
25900         CHECK((*env)->GetArrayLength(env, a) == 32);
25901         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
25902         LDKChannelMonitor b_conv;
25903         b_conv.inner = untag_ptr(b);
25904         b_conv.is_owned = ptr_is_owned(b);
25905         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25906         b_conv = ChannelMonitor_clone(&b_conv);
25907         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
25908         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
25909         return tag_ptr(ret_conv, true);
25910 }
25911
25912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25913         if (!ptr_is_owned(_res)) return;
25914         void* _res_ptr = untag_ptr(_res);
25915         CHECK_ACCESS(_res_ptr);
25916         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
25917         FREE(untag_ptr(_res));
25918         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
25919 }
25920
25921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25922         void* o_ptr = untag_ptr(o);
25923         CHECK_ACCESS(o_ptr);
25924         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
25925         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
25926         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25927         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
25928         return tag_ptr(ret_conv, true);
25929 }
25930
25931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25932         void* e_ptr = untag_ptr(e);
25933         CHECK_ACCESS(e_ptr);
25934         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25935         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25936         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25937         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
25938         return tag_ptr(ret_conv, true);
25939 }
25940
25941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25942         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
25943         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
25944         return ret_conv;
25945 }
25946
25947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25948         if (!ptr_is_owned(_res)) return;
25949         void* _res_ptr = untag_ptr(_res);
25950         CHECK_ACCESS(_res_ptr);
25951         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
25952         FREE(untag_ptr(_res));
25953         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
25954 }
25955
25956 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
25957         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25958         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
25959         return tag_ptr(ret_conv, true);
25960 }
25961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25962         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
25963         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
25964         return ret_conv;
25965 }
25966
25967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25968         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
25969         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25970         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
25971         return tag_ptr(ret_conv, true);
25972 }
25973
25974 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
25975         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
25976         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
25977         return tag_ptr(ret_conv, true);
25978 }
25979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25980         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
25981         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
25982         return ret_conv;
25983 }
25984
25985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25986         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
25987         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
25988         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
25989         return tag_ptr(ret_conv, true);
25990 }
25991
25992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
25993         LDKPublicKey a_ref;
25994         CHECK((*env)->GetArrayLength(env, a) == 33);
25995         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
25996         void* b_ptr = untag_ptr(b);
25997         CHECK_ACCESS(b_ptr);
25998         LDKType b_conv = *(LDKType*)(b_ptr);
25999         if (b_conv.free == LDKType_JCalls_free) {
26000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26001                 LDKType_JCalls_cloned(&b_conv);
26002         }
26003         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
26004         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
26005         return tag_ptr(ret_conv, true);
26006 }
26007
26008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26009         if (!ptr_is_owned(_res)) return;
26010         void* _res_ptr = untag_ptr(_res);
26011         CHECK_ACCESS(_res_ptr);
26012         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
26013         FREE(untag_ptr(_res));
26014         C2Tuple_PublicKeyTypeZ_free(_res_conv);
26015 }
26016
26017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26018         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
26019         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26020         if (_res_constr.datalen > 0)
26021                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
26022         else
26023                 _res_constr.data = NULL;
26024         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26025         for (size_t z = 0; z < _res_constr.datalen; z++) {
26026                 int64_t _res_conv_25 = _res_vals[z];
26027                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
26028                 CHECK_ACCESS(_res_conv_25_ptr);
26029                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
26030                 FREE(untag_ptr(_res_conv_25));
26031                 _res_constr.data[z] = _res_conv_25_conv;
26032         }
26033         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26034         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
26035 }
26036
26037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26038         void* o_ptr = untag_ptr(o);
26039         CHECK_ACCESS(o_ptr);
26040         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
26041         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
26042         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26043         *ret_copy = COption_OffersMessageZ_some(o_conv);
26044         int64_t ret_ref = tag_ptr(ret_copy, true);
26045         return ret_ref;
26046 }
26047
26048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
26049         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26050         *ret_copy = COption_OffersMessageZ_none();
26051         int64_t ret_ref = tag_ptr(ret_copy, true);
26052         return ret_ref;
26053 }
26054
26055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26056         if (!ptr_is_owned(_res)) return;
26057         void* _res_ptr = untag_ptr(_res);
26058         CHECK_ACCESS(_res_ptr);
26059         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
26060         FREE(untag_ptr(_res));
26061         COption_OffersMessageZ_free(_res_conv);
26062 }
26063
26064 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
26065         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26066         *ret_copy = COption_OffersMessageZ_clone(arg);
26067         int64_t ret_ref = tag_ptr(ret_copy, true);
26068         return ret_ref;
26069 }
26070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26071         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
26072         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
26073         return ret_conv;
26074 }
26075
26076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26077         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
26078         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
26079         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
26080         int64_t ret_ref = tag_ptr(ret_copy, true);
26081         return ret_ref;
26082 }
26083
26084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26085         void* o_ptr = untag_ptr(o);
26086         CHECK_ACCESS(o_ptr);
26087         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
26088         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
26089                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26090                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
26091         }
26092         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
26093         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
26094         int64_t ret_ref = tag_ptr(ret_copy, true);
26095         return ret_ref;
26096 }
26097
26098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
26099         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
26100         *ret_copy = COption_CustomOnionMessageContentsZ_none();
26101         int64_t ret_ref = tag_ptr(ret_copy, true);
26102         return ret_ref;
26103 }
26104
26105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26106         if (!ptr_is_owned(_res)) return;
26107         void* _res_ptr = untag_ptr(_res);
26108         CHECK_ACCESS(_res_ptr);
26109         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
26110         FREE(untag_ptr(_res));
26111         COption_CustomOnionMessageContentsZ_free(_res_conv);
26112 }
26113
26114 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
26115         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
26116         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
26117         int64_t ret_ref = tag_ptr(ret_copy, true);
26118         return ret_ref;
26119 }
26120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26121         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
26122         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
26123         return ret_conv;
26124 }
26125
26126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26127         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
26128         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
26129         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
26130         int64_t ret_ref = tag_ptr(ret_copy, true);
26131         return ret_ref;
26132 }
26133
26134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26135         void* o_ptr = untag_ptr(o);
26136         CHECK_ACCESS(o_ptr);
26137         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
26138         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
26139         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
26140         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
26141         return tag_ptr(ret_conv, true);
26142 }
26143
26144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26145         void* e_ptr = untag_ptr(e);
26146         CHECK_ACCESS(e_ptr);
26147         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26148         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26149         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
26150         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
26151         return tag_ptr(ret_conv, true);
26152 }
26153
26154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26155         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
26156         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
26157         return ret_conv;
26158 }
26159
26160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26161         if (!ptr_is_owned(_res)) return;
26162         void* _res_ptr = untag_ptr(_res);
26163         CHECK_ACCESS(_res_ptr);
26164         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
26165         FREE(untag_ptr(_res));
26166         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
26167 }
26168
26169 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
26170         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
26171         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
26172         return tag_ptr(ret_conv, true);
26173 }
26174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26175         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
26176         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
26177         return ret_conv;
26178 }
26179
26180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26181         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
26182         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
26183         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
26184         return tag_ptr(ret_conv, true);
26185 }
26186
26187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26188         void* o_ptr = untag_ptr(o);
26189         CHECK_ACCESS(o_ptr);
26190         LDKType o_conv = *(LDKType*)(o_ptr);
26191         if (o_conv.free == LDKType_JCalls_free) {
26192                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26193                 LDKType_JCalls_cloned(&o_conv);
26194         }
26195         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26196         *ret_copy = COption_TypeZ_some(o_conv);
26197         int64_t ret_ref = tag_ptr(ret_copy, true);
26198         return ret_ref;
26199 }
26200
26201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
26202         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26203         *ret_copy = COption_TypeZ_none();
26204         int64_t ret_ref = tag_ptr(ret_copy, true);
26205         return ret_ref;
26206 }
26207
26208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26209         if (!ptr_is_owned(_res)) return;
26210         void* _res_ptr = untag_ptr(_res);
26211         CHECK_ACCESS(_res_ptr);
26212         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
26213         FREE(untag_ptr(_res));
26214         COption_TypeZ_free(_res_conv);
26215 }
26216
26217 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
26218         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26219         *ret_copy = COption_TypeZ_clone(arg);
26220         int64_t ret_ref = tag_ptr(ret_copy, true);
26221         return ret_ref;
26222 }
26223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26224         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
26225         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
26226         return ret_conv;
26227 }
26228
26229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26230         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
26231         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
26232         *ret_copy = COption_TypeZ_clone(orig_conv);
26233         int64_t ret_ref = tag_ptr(ret_copy, true);
26234         return ret_ref;
26235 }
26236
26237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26238         void* o_ptr = untag_ptr(o);
26239         CHECK_ACCESS(o_ptr);
26240         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
26241         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
26242         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26243         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
26244         return tag_ptr(ret_conv, true);
26245 }
26246
26247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26248         void* e_ptr = untag_ptr(e);
26249         CHECK_ACCESS(e_ptr);
26250         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26251         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26252         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26253         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
26254         return tag_ptr(ret_conv, true);
26255 }
26256
26257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26258         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
26259         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
26260         return ret_conv;
26261 }
26262
26263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26264         if (!ptr_is_owned(_res)) return;
26265         void* _res_ptr = untag_ptr(_res);
26266         CHECK_ACCESS(_res_ptr);
26267         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
26268         FREE(untag_ptr(_res));
26269         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
26270 }
26271
26272 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
26273         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26274         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
26275         return tag_ptr(ret_conv, true);
26276 }
26277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26278         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
26279         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
26280         return ret_conv;
26281 }
26282
26283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26284         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
26285         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
26286         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
26287         return tag_ptr(ret_conv, true);
26288 }
26289
26290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26291         void* o_ptr = untag_ptr(o);
26292         CHECK_ACCESS(o_ptr);
26293         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
26294         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
26295         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
26296         *ret_copy = COption_NetAddressZ_some(o_conv);
26297         int64_t ret_ref = tag_ptr(ret_copy, true);
26298         return ret_ref;
26299 }
26300
26301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
26302         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
26303         *ret_copy = COption_NetAddressZ_none();
26304         int64_t ret_ref = tag_ptr(ret_copy, true);
26305         return ret_ref;
26306 }
26307
26308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26309         if (!ptr_is_owned(_res)) return;
26310         void* _res_ptr = untag_ptr(_res);
26311         CHECK_ACCESS(_res_ptr);
26312         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
26313         FREE(untag_ptr(_res));
26314         COption_NetAddressZ_free(_res_conv);
26315 }
26316
26317 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
26318         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
26319         *ret_copy = COption_NetAddressZ_clone(arg);
26320         int64_t ret_ref = tag_ptr(ret_copy, true);
26321         return ret_ref;
26322 }
26323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26324         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
26325         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
26326         return ret_conv;
26327 }
26328
26329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26330         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
26331         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
26332         *ret_copy = COption_NetAddressZ_clone(orig_conv);
26333         int64_t ret_ref = tag_ptr(ret_copy, true);
26334         return ret_ref;
26335 }
26336
26337 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
26338         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
26339         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
26340         return tag_ptr(ret_conv, true);
26341 }
26342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26343         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
26344         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
26345         return ret_conv;
26346 }
26347
26348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26349         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
26350         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
26351         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
26352         return tag_ptr(ret_conv, true);
26353 }
26354
26355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
26356         LDKPublicKey a_ref;
26357         CHECK((*env)->GetArrayLength(env, a) == 33);
26358         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
26359         void* b_ptr = untag_ptr(b);
26360         CHECK_ACCESS(b_ptr);
26361         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
26362         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
26363         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
26364         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
26365         return tag_ptr(ret_conv, true);
26366 }
26367
26368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCOption_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26369         if (!ptr_is_owned(_res)) return;
26370         void* _res_ptr = untag_ptr(_res);
26371         CHECK_ACCESS(_res_ptr);
26372         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
26373         FREE(untag_ptr(_res));
26374         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
26375 }
26376
26377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCOption_1NetAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26378         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
26379         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26380         if (_res_constr.datalen > 0)
26381                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
26382         else
26383                 _res_constr.data = NULL;
26384         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26385         for (size_t o = 0; o < _res_constr.datalen; o++) {
26386                 int64_t _res_conv_40 = _res_vals[o];
26387                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
26388                 CHECK_ACCESS(_res_conv_40_ptr);
26389                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
26390                 FREE(untag_ptr(_res_conv_40));
26391                 _res_constr.data[o] = _res_conv_40_conv;
26392         }
26393         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26394         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
26395 }
26396
26397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
26398         LDKCVec_u8Z o_ref;
26399         o_ref.datalen = (*env)->GetArrayLength(env, o);
26400         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26401         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
26402         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26403         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
26404         return tag_ptr(ret_conv, true);
26405 }
26406
26407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26408         LDKPeerHandleError e_conv;
26409         e_conv.inner = untag_ptr(e);
26410         e_conv.is_owned = ptr_is_owned(e);
26411         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26412         e_conv = PeerHandleError_clone(&e_conv);
26413         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26414         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
26415         return tag_ptr(ret_conv, true);
26416 }
26417
26418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26419         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
26420         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
26421         return ret_conv;
26422 }
26423
26424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26425         if (!ptr_is_owned(_res)) return;
26426         void* _res_ptr = untag_ptr(_res);
26427         CHECK_ACCESS(_res_ptr);
26428         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
26429         FREE(untag_ptr(_res));
26430         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
26431 }
26432
26433 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
26434         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26435         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
26436         return tag_ptr(ret_conv, true);
26437 }
26438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26439         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
26440         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
26441         return ret_conv;
26442 }
26443
26444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26445         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
26446         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
26447         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
26448         return tag_ptr(ret_conv, true);
26449 }
26450
26451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
26452         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26453         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
26454         return tag_ptr(ret_conv, true);
26455 }
26456
26457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26458         LDKPeerHandleError e_conv;
26459         e_conv.inner = untag_ptr(e);
26460         e_conv.is_owned = ptr_is_owned(e);
26461         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26462         e_conv = PeerHandleError_clone(&e_conv);
26463         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26464         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
26465         return tag_ptr(ret_conv, true);
26466 }
26467
26468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26469         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
26470         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
26471         return ret_conv;
26472 }
26473
26474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26475         if (!ptr_is_owned(_res)) return;
26476         void* _res_ptr = untag_ptr(_res);
26477         CHECK_ACCESS(_res_ptr);
26478         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
26479         FREE(untag_ptr(_res));
26480         CResult_NonePeerHandleErrorZ_free(_res_conv);
26481 }
26482
26483 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
26484         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26485         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
26486         return tag_ptr(ret_conv, true);
26487 }
26488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26489         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
26490         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
26491         return ret_conv;
26492 }
26493
26494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26495         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
26496         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
26497         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
26498         return tag_ptr(ret_conv, true);
26499 }
26500
26501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
26502         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26503         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
26504         return tag_ptr(ret_conv, true);
26505 }
26506
26507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26508         LDKPeerHandleError e_conv;
26509         e_conv.inner = untag_ptr(e);
26510         e_conv.is_owned = ptr_is_owned(e);
26511         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26512         e_conv = PeerHandleError_clone(&e_conv);
26513         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26514         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
26515         return tag_ptr(ret_conv, true);
26516 }
26517
26518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26519         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
26520         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
26521         return ret_conv;
26522 }
26523
26524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26525         if (!ptr_is_owned(_res)) return;
26526         void* _res_ptr = untag_ptr(_res);
26527         CHECK_ACCESS(_res_ptr);
26528         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
26529         FREE(untag_ptr(_res));
26530         CResult_boolPeerHandleErrorZ_free(_res_conv);
26531 }
26532
26533 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
26534         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26535         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
26536         return tag_ptr(ret_conv, true);
26537 }
26538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26539         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
26540         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
26541         return ret_conv;
26542 }
26543
26544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26545         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
26546         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
26547         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
26548         return tag_ptr(ret_conv, true);
26549 }
26550
26551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
26552         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26553         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
26554         return tag_ptr(ret_conv, true);
26555 }
26556
26557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26558         void* e_ptr = untag_ptr(e);
26559         CHECK_ACCESS(e_ptr);
26560         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
26561         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
26562         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
26563         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
26564         return tag_ptr(ret_conv, true);
26565 }
26566
26567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26568         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
26569         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
26570         return ret_conv;
26571 }
26572
26573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26574         if (!ptr_is_owned(_res)) return;
26575         void* _res_ptr = untag_ptr(_res);
26576         CHECK_ACCESS(_res_ptr);
26577         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
26578         FREE(untag_ptr(_res));
26579         CResult_u32GraphSyncErrorZ_free(_res_conv);
26580 }
26581
26582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
26583         LDKSecretKey o_ref;
26584         CHECK((*env)->GetArrayLength(env, o) == 32);
26585         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
26586         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26587         *ret_copy = COption_KeyPairZ_some(o_ref);
26588         int64_t ret_ref = tag_ptr(ret_copy, true);
26589         return ret_ref;
26590 }
26591
26592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1none(JNIEnv *env, jclass clz) {
26593         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26594         *ret_copy = COption_KeyPairZ_none();
26595         int64_t ret_ref = tag_ptr(ret_copy, true);
26596         return ret_ref;
26597 }
26598
26599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26600         if (!ptr_is_owned(_res)) return;
26601         void* _res_ptr = untag_ptr(_res);
26602         CHECK_ACCESS(_res_ptr);
26603         LDKCOption_KeyPairZ _res_conv = *(LDKCOption_KeyPairZ*)(_res_ptr);
26604         FREE(untag_ptr(_res));
26605         COption_KeyPairZ_free(_res_conv);
26606 }
26607
26608 static inline uint64_t COption_KeyPairZ_clone_ptr(LDKCOption_KeyPairZ *NONNULL_PTR arg) {
26609         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26610         *ret_copy = COption_KeyPairZ_clone(arg);
26611         int64_t ret_ref = tag_ptr(ret_copy, true);
26612         return ret_ref;
26613 }
26614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26615         LDKCOption_KeyPairZ* arg_conv = (LDKCOption_KeyPairZ*)untag_ptr(arg);
26616         int64_t ret_conv = COption_KeyPairZ_clone_ptr(arg_conv);
26617         return ret_conv;
26618 }
26619
26620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1KeyPairZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26621         LDKCOption_KeyPairZ* orig_conv = (LDKCOption_KeyPairZ*)untag_ptr(orig);
26622         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26623         *ret_copy = COption_KeyPairZ_clone(orig_conv);
26624         int64_t ret_ref = tag_ptr(ret_copy, true);
26625         return ret_ref;
26626 }
26627
26628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26629         void* o_ptr = untag_ptr(o);
26630         CHECK_ACCESS(o_ptr);
26631         LDKCOption_KeyPairZ o_conv = *(LDKCOption_KeyPairZ*)(o_ptr);
26632         o_conv = COption_KeyPairZ_clone((LDKCOption_KeyPairZ*)untag_ptr(o));
26633         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26634         *ret_conv = CResult_COption_KeyPairZNoneZ_ok(o_conv);
26635         return tag_ptr(ret_conv, true);
26636 }
26637
26638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1err(JNIEnv *env, jclass clz) {
26639         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26640         *ret_conv = CResult_COption_KeyPairZNoneZ_err();
26641         return tag_ptr(ret_conv, true);
26642 }
26643
26644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26645         LDKCResult_COption_KeyPairZNoneZ* o_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(o);
26646         jboolean ret_conv = CResult_COption_KeyPairZNoneZ_is_ok(o_conv);
26647         return ret_conv;
26648 }
26649
26650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26651         if (!ptr_is_owned(_res)) return;
26652         void* _res_ptr = untag_ptr(_res);
26653         CHECK_ACCESS(_res_ptr);
26654         LDKCResult_COption_KeyPairZNoneZ _res_conv = *(LDKCResult_COption_KeyPairZNoneZ*)(_res_ptr);
26655         FREE(untag_ptr(_res));
26656         CResult_COption_KeyPairZNoneZ_free(_res_conv);
26657 }
26658
26659 static inline uint64_t CResult_COption_KeyPairZNoneZ_clone_ptr(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR arg) {
26660         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26661         *ret_conv = CResult_COption_KeyPairZNoneZ_clone(arg);
26662         return tag_ptr(ret_conv, true);
26663 }
26664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26665         LDKCResult_COption_KeyPairZNoneZ* arg_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(arg);
26666         int64_t ret_conv = CResult_COption_KeyPairZNoneZ_clone_ptr(arg_conv);
26667         return ret_conv;
26668 }
26669
26670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1KeyPairZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26671         LDKCResult_COption_KeyPairZNoneZ* orig_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(orig);
26672         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26673         *ret_conv = CResult_COption_KeyPairZNoneZ_clone(orig_conv);
26674         return tag_ptr(ret_conv, true);
26675 }
26676
26677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
26678         LDKCVec_u8Z o_ref;
26679         o_ref.datalen = (*env)->GetArrayLength(env, o);
26680         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
26681         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
26682         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
26683         *ret_copy = COption_ScriptZ_some(o_ref);
26684         int64_t ret_ref = tag_ptr(ret_copy, true);
26685         return ret_ref;
26686 }
26687
26688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1none(JNIEnv *env, jclass clz) {
26689         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
26690         *ret_copy = COption_ScriptZ_none();
26691         int64_t ret_ref = tag_ptr(ret_copy, true);
26692         return ret_ref;
26693 }
26694
26695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26696         if (!ptr_is_owned(_res)) return;
26697         void* _res_ptr = untag_ptr(_res);
26698         CHECK_ACCESS(_res_ptr);
26699         LDKCOption_ScriptZ _res_conv = *(LDKCOption_ScriptZ*)(_res_ptr);
26700         FREE(untag_ptr(_res));
26701         COption_ScriptZ_free(_res_conv);
26702 }
26703
26704 static inline uint64_t COption_ScriptZ_clone_ptr(LDKCOption_ScriptZ *NONNULL_PTR arg) {
26705         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
26706         *ret_copy = COption_ScriptZ_clone(arg);
26707         int64_t ret_ref = tag_ptr(ret_copy, true);
26708         return ret_ref;
26709 }
26710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26711         LDKCOption_ScriptZ* arg_conv = (LDKCOption_ScriptZ*)untag_ptr(arg);
26712         int64_t ret_conv = COption_ScriptZ_clone_ptr(arg_conv);
26713         return ret_conv;
26714 }
26715
26716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26717         LDKCOption_ScriptZ* orig_conv = (LDKCOption_ScriptZ*)untag_ptr(orig);
26718         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
26719         *ret_copy = COption_ScriptZ_clone(orig_conv);
26720         int64_t ret_ref = tag_ptr(ret_copy, true);
26721         return ret_ref;
26722 }
26723
26724 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
26725         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
26726         return ret_conv;
26727 }
26728
26729 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
26730         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
26731         return ret_conv;
26732 }
26733
26734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
26735         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
26736         COption_NoneZ_free(_res_conv);
26737 }
26738
26739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
26740         LDKCVec_WitnessZ _res_constr;
26741         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26742         if (_res_constr.datalen > 0)
26743                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
26744         else
26745                 _res_constr.data = NULL;
26746         for (size_t i = 0; i < _res_constr.datalen; i++) {
26747                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
26748                 LDKWitness _res_conv_8_ref;
26749                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
26750                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
26751                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
26752                 _res_conv_8_ref.data_is_owned = true;
26753                 _res_constr.data[i] = _res_conv_8_ref;
26754         }
26755         CVec_WitnessZ_free(_res_constr);
26756 }
26757
26758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
26759         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
26760         *ret_copy = COption_i64Z_some(o);
26761         int64_t ret_ref = tag_ptr(ret_copy, true);
26762         return ret_ref;
26763 }
26764
26765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
26766         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
26767         *ret_copy = COption_i64Z_none();
26768         int64_t ret_ref = tag_ptr(ret_copy, true);
26769         return ret_ref;
26770 }
26771
26772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
26773         if (!ptr_is_owned(_res)) return;
26774         void* _res_ptr = untag_ptr(_res);
26775         CHECK_ACCESS(_res_ptr);
26776         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
26777         FREE(untag_ptr(_res));
26778         COption_i64Z_free(_res_conv);
26779 }
26780
26781 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
26782         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
26783         *ret_copy = COption_i64Z_clone(arg);
26784         int64_t ret_ref = tag_ptr(ret_copy, true);
26785         return ret_ref;
26786 }
26787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26788         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
26789         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
26790         return ret_conv;
26791 }
26792
26793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26794         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
26795         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
26796         *ret_copy = COption_i64Z_clone(orig_conv);
26797         int64_t ret_ref = tag_ptr(ret_copy, true);
26798         return ret_ref;
26799 }
26800
26801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
26802         LDKThirtyTwoBytes o_ref;
26803         CHECK((*env)->GetArrayLength(env, o) == 32);
26804         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
26805         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
26806         *ret_copy = COption_TxidZ_some(o_ref);
26807         int64_t ret_ref = tag_ptr(ret_copy, true);
26808         return ret_ref;
26809 }
26810
26811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1none(JNIEnv *env, jclass clz) {
26812         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
26813         *ret_copy = COption_TxidZ_none();
26814         int64_t ret_ref = tag_ptr(ret_copy, true);
26815         return ret_ref;
26816 }
26817
26818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26819         if (!ptr_is_owned(_res)) return;
26820         void* _res_ptr = untag_ptr(_res);
26821         CHECK_ACCESS(_res_ptr);
26822         LDKCOption_TxidZ _res_conv = *(LDKCOption_TxidZ*)(_res_ptr);
26823         FREE(untag_ptr(_res));
26824         COption_TxidZ_free(_res_conv);
26825 }
26826
26827 static inline uint64_t COption_TxidZ_clone_ptr(LDKCOption_TxidZ *NONNULL_PTR arg) {
26828         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
26829         *ret_copy = COption_TxidZ_clone(arg);
26830         int64_t ret_ref = tag_ptr(ret_copy, true);
26831         return ret_ref;
26832 }
26833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26834         LDKCOption_TxidZ* arg_conv = (LDKCOption_TxidZ*)untag_ptr(arg);
26835         int64_t ret_conv = COption_TxidZ_clone_ptr(arg_conv);
26836         return ret_conv;
26837 }
26838
26839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxidZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26840         LDKCOption_TxidZ* orig_conv = (LDKCOption_TxidZ*)untag_ptr(orig);
26841         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
26842         *ret_copy = COption_TxidZ_clone(orig_conv);
26843         int64_t ret_ref = tag_ptr(ret_copy, true);
26844         return ret_ref;
26845 }
26846
26847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26848         void* o_ptr = untag_ptr(o);
26849         CHECK_ACCESS(o_ptr);
26850         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
26851         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
26852         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
26853         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
26854         return tag_ptr(ret_conv, true);
26855 }
26856
26857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26858         void* e_ptr = untag_ptr(e);
26859         CHECK_ACCESS(e_ptr);
26860         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26861         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26862         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
26863         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
26864         return tag_ptr(ret_conv, true);
26865 }
26866
26867 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26868         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
26869         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
26870         return ret_conv;
26871 }
26872
26873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26874         if (!ptr_is_owned(_res)) return;
26875         void* _res_ptr = untag_ptr(_res);
26876         CHECK_ACCESS(_res_ptr);
26877         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
26878         FREE(untag_ptr(_res));
26879         CResult_NetAddressDecodeErrorZ_free(_res_conv);
26880 }
26881
26882 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
26883         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
26884         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
26885         return tag_ptr(ret_conv, true);
26886 }
26887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26888         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
26889         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
26890         return ret_conv;
26891 }
26892
26893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26894         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
26895         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
26896         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
26897         return tag_ptr(ret_conv, true);
26898 }
26899
26900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26901         LDKCVec_UpdateAddHTLCZ _res_constr;
26902         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26903         if (_res_constr.datalen > 0)
26904                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
26905         else
26906                 _res_constr.data = NULL;
26907         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26908         for (size_t p = 0; p < _res_constr.datalen; p++) {
26909                 int64_t _res_conv_15 = _res_vals[p];
26910                 LDKUpdateAddHTLC _res_conv_15_conv;
26911                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
26912                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
26913                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
26914                 _res_constr.data[p] = _res_conv_15_conv;
26915         }
26916         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26917         CVec_UpdateAddHTLCZ_free(_res_constr);
26918 }
26919
26920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26921         LDKCVec_UpdateFulfillHTLCZ _res_constr;
26922         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26923         if (_res_constr.datalen > 0)
26924                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
26925         else
26926                 _res_constr.data = NULL;
26927         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26928         for (size_t t = 0; t < _res_constr.datalen; t++) {
26929                 int64_t _res_conv_19 = _res_vals[t];
26930                 LDKUpdateFulfillHTLC _res_conv_19_conv;
26931                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
26932                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
26933                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
26934                 _res_constr.data[t] = _res_conv_19_conv;
26935         }
26936         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26937         CVec_UpdateFulfillHTLCZ_free(_res_constr);
26938 }
26939
26940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26941         LDKCVec_UpdateFailHTLCZ _res_constr;
26942         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26943         if (_res_constr.datalen > 0)
26944                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
26945         else
26946                 _res_constr.data = NULL;
26947         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26948         for (size_t q = 0; q < _res_constr.datalen; q++) {
26949                 int64_t _res_conv_16 = _res_vals[q];
26950                 LDKUpdateFailHTLC _res_conv_16_conv;
26951                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26952                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26953                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26954                 _res_constr.data[q] = _res_conv_16_conv;
26955         }
26956         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26957         CVec_UpdateFailHTLCZ_free(_res_constr);
26958 }
26959
26960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26961         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
26962         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26963         if (_res_constr.datalen > 0)
26964                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
26965         else
26966                 _res_constr.data = NULL;
26967         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26968         for (size_t z = 0; z < _res_constr.datalen; z++) {
26969                 int64_t _res_conv_25 = _res_vals[z];
26970                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
26971                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
26972                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
26973                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
26974                 _res_constr.data[z] = _res_conv_25_conv;
26975         }
26976         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26977         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
26978 }
26979
26980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26981         LDKAcceptChannel o_conv;
26982         o_conv.inner = untag_ptr(o);
26983         o_conv.is_owned = ptr_is_owned(o);
26984         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26985         o_conv = AcceptChannel_clone(&o_conv);
26986         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
26987         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
26988         return tag_ptr(ret_conv, true);
26989 }
26990
26991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26992         void* e_ptr = untag_ptr(e);
26993         CHECK_ACCESS(e_ptr);
26994         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26995         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26996         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
26997         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
26998         return tag_ptr(ret_conv, true);
26999 }
27000
27001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27002         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
27003         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
27004         return ret_conv;
27005 }
27006
27007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27008         if (!ptr_is_owned(_res)) return;
27009         void* _res_ptr = untag_ptr(_res);
27010         CHECK_ACCESS(_res_ptr);
27011         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
27012         FREE(untag_ptr(_res));
27013         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
27014 }
27015
27016 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
27017         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27018         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
27019         return tag_ptr(ret_conv, true);
27020 }
27021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27022         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
27023         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
27024         return ret_conv;
27025 }
27026
27027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27028         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
27029         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
27030         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
27031         return tag_ptr(ret_conv, true);
27032 }
27033
27034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27035         LDKAcceptChannelV2 o_conv;
27036         o_conv.inner = untag_ptr(o);
27037         o_conv.is_owned = ptr_is_owned(o);
27038         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27039         o_conv = AcceptChannelV2_clone(&o_conv);
27040         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27041         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
27042         return tag_ptr(ret_conv, true);
27043 }
27044
27045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27046         void* e_ptr = untag_ptr(e);
27047         CHECK_ACCESS(e_ptr);
27048         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27049         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27050         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27051         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
27052         return tag_ptr(ret_conv, true);
27053 }
27054
27055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27056         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
27057         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
27058         return ret_conv;
27059 }
27060
27061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27062         if (!ptr_is_owned(_res)) return;
27063         void* _res_ptr = untag_ptr(_res);
27064         CHECK_ACCESS(_res_ptr);
27065         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
27066         FREE(untag_ptr(_res));
27067         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
27068 }
27069
27070 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
27071         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27072         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
27073         return tag_ptr(ret_conv, true);
27074 }
27075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27076         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
27077         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
27078         return ret_conv;
27079 }
27080
27081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27082         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
27083         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
27084         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
27085         return tag_ptr(ret_conv, true);
27086 }
27087
27088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27089         LDKTxAddInput o_conv;
27090         o_conv.inner = untag_ptr(o);
27091         o_conv.is_owned = ptr_is_owned(o);
27092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27093         o_conv = TxAddInput_clone(&o_conv);
27094         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
27095         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
27096         return tag_ptr(ret_conv, true);
27097 }
27098
27099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27100         void* e_ptr = untag_ptr(e);
27101         CHECK_ACCESS(e_ptr);
27102         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27103         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27104         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
27105         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
27106         return tag_ptr(ret_conv, true);
27107 }
27108
27109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27110         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
27111         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
27112         return ret_conv;
27113 }
27114
27115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27116         if (!ptr_is_owned(_res)) return;
27117         void* _res_ptr = untag_ptr(_res);
27118         CHECK_ACCESS(_res_ptr);
27119         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
27120         FREE(untag_ptr(_res));
27121         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
27122 }
27123
27124 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
27125         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
27126         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
27127         return tag_ptr(ret_conv, true);
27128 }
27129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27130         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
27131         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
27132         return ret_conv;
27133 }
27134
27135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27136         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
27137         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
27138         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
27139         return tag_ptr(ret_conv, true);
27140 }
27141
27142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27143         LDKTxAddOutput o_conv;
27144         o_conv.inner = untag_ptr(o);
27145         o_conv.is_owned = ptr_is_owned(o);
27146         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27147         o_conv = TxAddOutput_clone(&o_conv);
27148         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
27149         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
27150         return tag_ptr(ret_conv, true);
27151 }
27152
27153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27154         void* e_ptr = untag_ptr(e);
27155         CHECK_ACCESS(e_ptr);
27156         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27157         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27158         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
27159         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
27160         return tag_ptr(ret_conv, true);
27161 }
27162
27163 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27164         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
27165         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
27166         return ret_conv;
27167 }
27168
27169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27170         if (!ptr_is_owned(_res)) return;
27171         void* _res_ptr = untag_ptr(_res);
27172         CHECK_ACCESS(_res_ptr);
27173         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
27174         FREE(untag_ptr(_res));
27175         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
27176 }
27177
27178 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
27179         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
27180         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
27181         return tag_ptr(ret_conv, true);
27182 }
27183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27184         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
27185         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
27186         return ret_conv;
27187 }
27188
27189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27190         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
27191         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
27192         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
27193         return tag_ptr(ret_conv, true);
27194 }
27195
27196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27197         LDKTxRemoveInput o_conv;
27198         o_conv.inner = untag_ptr(o);
27199         o_conv.is_owned = ptr_is_owned(o);
27200         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27201         o_conv = TxRemoveInput_clone(&o_conv);
27202         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
27203         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
27204         return tag_ptr(ret_conv, true);
27205 }
27206
27207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27208         void* e_ptr = untag_ptr(e);
27209         CHECK_ACCESS(e_ptr);
27210         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27211         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27212         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
27213         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
27214         return tag_ptr(ret_conv, true);
27215 }
27216
27217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27218         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
27219         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
27220         return ret_conv;
27221 }
27222
27223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27224         if (!ptr_is_owned(_res)) return;
27225         void* _res_ptr = untag_ptr(_res);
27226         CHECK_ACCESS(_res_ptr);
27227         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
27228         FREE(untag_ptr(_res));
27229         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
27230 }
27231
27232 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
27233         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
27234         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
27235         return tag_ptr(ret_conv, true);
27236 }
27237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27238         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
27239         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
27240         return ret_conv;
27241 }
27242
27243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27244         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
27245         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
27246         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
27247         return tag_ptr(ret_conv, true);
27248 }
27249
27250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27251         LDKTxRemoveOutput o_conv;
27252         o_conv.inner = untag_ptr(o);
27253         o_conv.is_owned = ptr_is_owned(o);
27254         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27255         o_conv = TxRemoveOutput_clone(&o_conv);
27256         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
27257         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
27258         return tag_ptr(ret_conv, true);
27259 }
27260
27261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27262         void* e_ptr = untag_ptr(e);
27263         CHECK_ACCESS(e_ptr);
27264         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27265         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27266         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
27267         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
27268         return tag_ptr(ret_conv, true);
27269 }
27270
27271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27272         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
27273         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
27274         return ret_conv;
27275 }
27276
27277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27278         if (!ptr_is_owned(_res)) return;
27279         void* _res_ptr = untag_ptr(_res);
27280         CHECK_ACCESS(_res_ptr);
27281         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
27282         FREE(untag_ptr(_res));
27283         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
27284 }
27285
27286 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
27287         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
27288         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
27289         return tag_ptr(ret_conv, true);
27290 }
27291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27292         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
27293         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
27294         return ret_conv;
27295 }
27296
27297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27298         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
27299         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
27300         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
27301         return tag_ptr(ret_conv, true);
27302 }
27303
27304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27305         LDKTxComplete o_conv;
27306         o_conv.inner = untag_ptr(o);
27307         o_conv.is_owned = ptr_is_owned(o);
27308         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27309         o_conv = TxComplete_clone(&o_conv);
27310         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
27311         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
27312         return tag_ptr(ret_conv, true);
27313 }
27314
27315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27316         void* e_ptr = untag_ptr(e);
27317         CHECK_ACCESS(e_ptr);
27318         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27319         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27320         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
27321         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
27322         return tag_ptr(ret_conv, true);
27323 }
27324
27325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27326         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
27327         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
27328         return ret_conv;
27329 }
27330
27331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27332         if (!ptr_is_owned(_res)) return;
27333         void* _res_ptr = untag_ptr(_res);
27334         CHECK_ACCESS(_res_ptr);
27335         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
27336         FREE(untag_ptr(_res));
27337         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
27338 }
27339
27340 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
27341         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
27342         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
27343         return tag_ptr(ret_conv, true);
27344 }
27345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27346         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
27347         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
27348         return ret_conv;
27349 }
27350
27351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27352         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
27353         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
27354         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
27355         return tag_ptr(ret_conv, true);
27356 }
27357
27358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27359         LDKTxSignatures o_conv;
27360         o_conv.inner = untag_ptr(o);
27361         o_conv.is_owned = ptr_is_owned(o);
27362         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27363         o_conv = TxSignatures_clone(&o_conv);
27364         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
27365         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
27366         return tag_ptr(ret_conv, true);
27367 }
27368
27369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27370         void* e_ptr = untag_ptr(e);
27371         CHECK_ACCESS(e_ptr);
27372         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27373         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27374         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
27375         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
27376         return tag_ptr(ret_conv, true);
27377 }
27378
27379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27380         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
27381         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
27382         return ret_conv;
27383 }
27384
27385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27386         if (!ptr_is_owned(_res)) return;
27387         void* _res_ptr = untag_ptr(_res);
27388         CHECK_ACCESS(_res_ptr);
27389         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
27390         FREE(untag_ptr(_res));
27391         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
27392 }
27393
27394 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
27395         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
27396         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
27397         return tag_ptr(ret_conv, true);
27398 }
27399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27400         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
27401         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
27402         return ret_conv;
27403 }
27404
27405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27406         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
27407         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
27408         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
27409         return tag_ptr(ret_conv, true);
27410 }
27411
27412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27413         LDKTxInitRbf o_conv;
27414         o_conv.inner = untag_ptr(o);
27415         o_conv.is_owned = ptr_is_owned(o);
27416         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27417         o_conv = TxInitRbf_clone(&o_conv);
27418         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
27419         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
27420         return tag_ptr(ret_conv, true);
27421 }
27422
27423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27424         void* e_ptr = untag_ptr(e);
27425         CHECK_ACCESS(e_ptr);
27426         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27427         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27428         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
27429         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
27430         return tag_ptr(ret_conv, true);
27431 }
27432
27433 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27434         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
27435         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
27436         return ret_conv;
27437 }
27438
27439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27440         if (!ptr_is_owned(_res)) return;
27441         void* _res_ptr = untag_ptr(_res);
27442         CHECK_ACCESS(_res_ptr);
27443         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
27444         FREE(untag_ptr(_res));
27445         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
27446 }
27447
27448 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
27449         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
27450         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
27451         return tag_ptr(ret_conv, true);
27452 }
27453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27454         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
27455         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
27456         return ret_conv;
27457 }
27458
27459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27460         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
27461         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
27462         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
27463         return tag_ptr(ret_conv, true);
27464 }
27465
27466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27467         LDKTxAckRbf o_conv;
27468         o_conv.inner = untag_ptr(o);
27469         o_conv.is_owned = ptr_is_owned(o);
27470         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27471         o_conv = TxAckRbf_clone(&o_conv);
27472         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
27473         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
27474         return tag_ptr(ret_conv, true);
27475 }
27476
27477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27478         void* e_ptr = untag_ptr(e);
27479         CHECK_ACCESS(e_ptr);
27480         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27481         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27482         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
27483         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
27484         return tag_ptr(ret_conv, true);
27485 }
27486
27487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27488         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
27489         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
27490         return ret_conv;
27491 }
27492
27493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27494         if (!ptr_is_owned(_res)) return;
27495         void* _res_ptr = untag_ptr(_res);
27496         CHECK_ACCESS(_res_ptr);
27497         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
27498         FREE(untag_ptr(_res));
27499         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
27500 }
27501
27502 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
27503         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
27504         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
27505         return tag_ptr(ret_conv, true);
27506 }
27507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27508         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
27509         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
27510         return ret_conv;
27511 }
27512
27513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27514         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
27515         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
27516         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
27517         return tag_ptr(ret_conv, true);
27518 }
27519
27520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27521         LDKTxAbort o_conv;
27522         o_conv.inner = untag_ptr(o);
27523         o_conv.is_owned = ptr_is_owned(o);
27524         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27525         o_conv = TxAbort_clone(&o_conv);
27526         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
27527         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
27528         return tag_ptr(ret_conv, true);
27529 }
27530
27531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27532         void* e_ptr = untag_ptr(e);
27533         CHECK_ACCESS(e_ptr);
27534         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27535         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27536         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
27537         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
27538         return tag_ptr(ret_conv, true);
27539 }
27540
27541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27542         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
27543         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
27544         return ret_conv;
27545 }
27546
27547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27548         if (!ptr_is_owned(_res)) return;
27549         void* _res_ptr = untag_ptr(_res);
27550         CHECK_ACCESS(_res_ptr);
27551         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
27552         FREE(untag_ptr(_res));
27553         CResult_TxAbortDecodeErrorZ_free(_res_conv);
27554 }
27555
27556 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
27557         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
27558         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
27559         return tag_ptr(ret_conv, true);
27560 }
27561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27562         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
27563         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
27564         return ret_conv;
27565 }
27566
27567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27568         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
27569         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
27570         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
27571         return tag_ptr(ret_conv, true);
27572 }
27573
27574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27575         LDKAnnouncementSignatures o_conv;
27576         o_conv.inner = untag_ptr(o);
27577         o_conv.is_owned = ptr_is_owned(o);
27578         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27579         o_conv = AnnouncementSignatures_clone(&o_conv);
27580         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27581         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
27582         return tag_ptr(ret_conv, true);
27583 }
27584
27585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27586         void* e_ptr = untag_ptr(e);
27587         CHECK_ACCESS(e_ptr);
27588         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27589         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27590         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27591         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
27592         return tag_ptr(ret_conv, true);
27593 }
27594
27595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27596         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
27597         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
27598         return ret_conv;
27599 }
27600
27601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27602         if (!ptr_is_owned(_res)) return;
27603         void* _res_ptr = untag_ptr(_res);
27604         CHECK_ACCESS(_res_ptr);
27605         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
27606         FREE(untag_ptr(_res));
27607         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
27608 }
27609
27610 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
27611         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27612         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
27613         return tag_ptr(ret_conv, true);
27614 }
27615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27616         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
27617         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
27618         return ret_conv;
27619 }
27620
27621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27622         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
27623         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
27624         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
27625         return tag_ptr(ret_conv, true);
27626 }
27627
27628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27629         LDKChannelReestablish o_conv;
27630         o_conv.inner = untag_ptr(o);
27631         o_conv.is_owned = ptr_is_owned(o);
27632         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27633         o_conv = ChannelReestablish_clone(&o_conv);
27634         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27635         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
27636         return tag_ptr(ret_conv, true);
27637 }
27638
27639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27640         void* e_ptr = untag_ptr(e);
27641         CHECK_ACCESS(e_ptr);
27642         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27643         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27644         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27645         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
27646         return tag_ptr(ret_conv, true);
27647 }
27648
27649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27650         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
27651         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
27652         return ret_conv;
27653 }
27654
27655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27656         if (!ptr_is_owned(_res)) return;
27657         void* _res_ptr = untag_ptr(_res);
27658         CHECK_ACCESS(_res_ptr);
27659         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
27660         FREE(untag_ptr(_res));
27661         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
27662 }
27663
27664 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
27665         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27666         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
27667         return tag_ptr(ret_conv, true);
27668 }
27669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27670         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
27671         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
27672         return ret_conv;
27673 }
27674
27675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27676         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
27677         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
27678         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
27679         return tag_ptr(ret_conv, true);
27680 }
27681
27682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27683         LDKClosingSigned o_conv;
27684         o_conv.inner = untag_ptr(o);
27685         o_conv.is_owned = ptr_is_owned(o);
27686         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27687         o_conv = ClosingSigned_clone(&o_conv);
27688         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27689         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
27690         return tag_ptr(ret_conv, true);
27691 }
27692
27693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27694         void* e_ptr = untag_ptr(e);
27695         CHECK_ACCESS(e_ptr);
27696         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27697         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27698         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27699         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
27700         return tag_ptr(ret_conv, true);
27701 }
27702
27703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27704         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
27705         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
27706         return ret_conv;
27707 }
27708
27709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27710         if (!ptr_is_owned(_res)) return;
27711         void* _res_ptr = untag_ptr(_res);
27712         CHECK_ACCESS(_res_ptr);
27713         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
27714         FREE(untag_ptr(_res));
27715         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
27716 }
27717
27718 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
27719         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27720         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
27721         return tag_ptr(ret_conv, true);
27722 }
27723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27724         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
27725         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
27726         return ret_conv;
27727 }
27728
27729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27730         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
27731         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
27732         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
27733         return tag_ptr(ret_conv, true);
27734 }
27735
27736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27737         LDKClosingSignedFeeRange o_conv;
27738         o_conv.inner = untag_ptr(o);
27739         o_conv.is_owned = ptr_is_owned(o);
27740         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27741         o_conv = ClosingSignedFeeRange_clone(&o_conv);
27742         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27743         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
27744         return tag_ptr(ret_conv, true);
27745 }
27746
27747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27748         void* e_ptr = untag_ptr(e);
27749         CHECK_ACCESS(e_ptr);
27750         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27751         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27752         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27753         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
27754         return tag_ptr(ret_conv, true);
27755 }
27756
27757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27758         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
27759         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
27760         return ret_conv;
27761 }
27762
27763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27764         if (!ptr_is_owned(_res)) return;
27765         void* _res_ptr = untag_ptr(_res);
27766         CHECK_ACCESS(_res_ptr);
27767         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
27768         FREE(untag_ptr(_res));
27769         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
27770 }
27771
27772 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
27773         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27774         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
27775         return tag_ptr(ret_conv, true);
27776 }
27777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27778         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
27779         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
27780         return ret_conv;
27781 }
27782
27783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27784         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
27785         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
27786         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
27787         return tag_ptr(ret_conv, true);
27788 }
27789
27790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27791         LDKCommitmentSigned o_conv;
27792         o_conv.inner = untag_ptr(o);
27793         o_conv.is_owned = ptr_is_owned(o);
27794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27795         o_conv = CommitmentSigned_clone(&o_conv);
27796         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27797         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
27798         return tag_ptr(ret_conv, true);
27799 }
27800
27801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27802         void* e_ptr = untag_ptr(e);
27803         CHECK_ACCESS(e_ptr);
27804         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27805         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27806         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27807         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
27808         return tag_ptr(ret_conv, true);
27809 }
27810
27811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27812         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
27813         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
27814         return ret_conv;
27815 }
27816
27817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27818         if (!ptr_is_owned(_res)) return;
27819         void* _res_ptr = untag_ptr(_res);
27820         CHECK_ACCESS(_res_ptr);
27821         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
27822         FREE(untag_ptr(_res));
27823         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
27824 }
27825
27826 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
27827         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27828         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
27829         return tag_ptr(ret_conv, true);
27830 }
27831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27832         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
27833         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
27834         return ret_conv;
27835 }
27836
27837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27838         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
27839         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
27840         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
27841         return tag_ptr(ret_conv, true);
27842 }
27843
27844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27845         LDKFundingCreated o_conv;
27846         o_conv.inner = untag_ptr(o);
27847         o_conv.is_owned = ptr_is_owned(o);
27848         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27849         o_conv = FundingCreated_clone(&o_conv);
27850         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27851         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
27852         return tag_ptr(ret_conv, true);
27853 }
27854
27855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27856         void* e_ptr = untag_ptr(e);
27857         CHECK_ACCESS(e_ptr);
27858         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27859         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27860         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27861         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
27862         return tag_ptr(ret_conv, true);
27863 }
27864
27865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27866         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
27867         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
27868         return ret_conv;
27869 }
27870
27871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27872         if (!ptr_is_owned(_res)) return;
27873         void* _res_ptr = untag_ptr(_res);
27874         CHECK_ACCESS(_res_ptr);
27875         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
27876         FREE(untag_ptr(_res));
27877         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
27878 }
27879
27880 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
27881         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27882         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
27883         return tag_ptr(ret_conv, true);
27884 }
27885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27886         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
27887         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
27888         return ret_conv;
27889 }
27890
27891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27892         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
27893         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
27894         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
27895         return tag_ptr(ret_conv, true);
27896 }
27897
27898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27899         LDKFundingSigned o_conv;
27900         o_conv.inner = untag_ptr(o);
27901         o_conv.is_owned = ptr_is_owned(o);
27902         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27903         o_conv = FundingSigned_clone(&o_conv);
27904         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27905         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
27906         return tag_ptr(ret_conv, true);
27907 }
27908
27909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27910         void* e_ptr = untag_ptr(e);
27911         CHECK_ACCESS(e_ptr);
27912         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27913         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27914         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27915         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
27916         return tag_ptr(ret_conv, true);
27917 }
27918
27919 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27920         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
27921         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
27922         return ret_conv;
27923 }
27924
27925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27926         if (!ptr_is_owned(_res)) return;
27927         void* _res_ptr = untag_ptr(_res);
27928         CHECK_ACCESS(_res_ptr);
27929         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
27930         FREE(untag_ptr(_res));
27931         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
27932 }
27933
27934 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
27935         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27936         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
27937         return tag_ptr(ret_conv, true);
27938 }
27939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27940         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
27941         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
27942         return ret_conv;
27943 }
27944
27945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27946         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
27947         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
27948         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
27949         return tag_ptr(ret_conv, true);
27950 }
27951
27952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27953         LDKChannelReady o_conv;
27954         o_conv.inner = untag_ptr(o);
27955         o_conv.is_owned = ptr_is_owned(o);
27956         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27957         o_conv = ChannelReady_clone(&o_conv);
27958         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
27959         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
27960         return tag_ptr(ret_conv, true);
27961 }
27962
27963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27964         void* e_ptr = untag_ptr(e);
27965         CHECK_ACCESS(e_ptr);
27966         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27967         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27968         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
27969         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
27970         return tag_ptr(ret_conv, true);
27971 }
27972
27973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27974         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
27975         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
27976         return ret_conv;
27977 }
27978
27979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27980         if (!ptr_is_owned(_res)) return;
27981         void* _res_ptr = untag_ptr(_res);
27982         CHECK_ACCESS(_res_ptr);
27983         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
27984         FREE(untag_ptr(_res));
27985         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
27986 }
27987
27988 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
27989         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
27990         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
27991         return tag_ptr(ret_conv, true);
27992 }
27993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27994         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
27995         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
27996         return ret_conv;
27997 }
27998
27999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28000         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
28001         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
28002         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
28003         return tag_ptr(ret_conv, true);
28004 }
28005
28006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28007         LDKInit o_conv;
28008         o_conv.inner = untag_ptr(o);
28009         o_conv.is_owned = ptr_is_owned(o);
28010         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28011         o_conv = Init_clone(&o_conv);
28012         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28013         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
28014         return tag_ptr(ret_conv, true);
28015 }
28016
28017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28018         void* e_ptr = untag_ptr(e);
28019         CHECK_ACCESS(e_ptr);
28020         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28021         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28022         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28023         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
28024         return tag_ptr(ret_conv, true);
28025 }
28026
28027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28028         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
28029         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
28030         return ret_conv;
28031 }
28032
28033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28034         if (!ptr_is_owned(_res)) return;
28035         void* _res_ptr = untag_ptr(_res);
28036         CHECK_ACCESS(_res_ptr);
28037         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
28038         FREE(untag_ptr(_res));
28039         CResult_InitDecodeErrorZ_free(_res_conv);
28040 }
28041
28042 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
28043         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28044         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
28045         return tag_ptr(ret_conv, true);
28046 }
28047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28048         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
28049         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
28050         return ret_conv;
28051 }
28052
28053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28054         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
28055         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
28056         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
28057         return tag_ptr(ret_conv, true);
28058 }
28059
28060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28061         LDKOpenChannel o_conv;
28062         o_conv.inner = untag_ptr(o);
28063         o_conv.is_owned = ptr_is_owned(o);
28064         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28065         o_conv = OpenChannel_clone(&o_conv);
28066         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28067         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
28068         return tag_ptr(ret_conv, true);
28069 }
28070
28071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28072         void* e_ptr = untag_ptr(e);
28073         CHECK_ACCESS(e_ptr);
28074         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28075         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28076         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28077         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
28078         return tag_ptr(ret_conv, true);
28079 }
28080
28081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28082         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
28083         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
28084         return ret_conv;
28085 }
28086
28087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28088         if (!ptr_is_owned(_res)) return;
28089         void* _res_ptr = untag_ptr(_res);
28090         CHECK_ACCESS(_res_ptr);
28091         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
28092         FREE(untag_ptr(_res));
28093         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
28094 }
28095
28096 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
28097         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28098         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
28099         return tag_ptr(ret_conv, true);
28100 }
28101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28102         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
28103         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
28104         return ret_conv;
28105 }
28106
28107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28108         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
28109         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
28110         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
28111         return tag_ptr(ret_conv, true);
28112 }
28113
28114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28115         LDKOpenChannelV2 o_conv;
28116         o_conv.inner = untag_ptr(o);
28117         o_conv.is_owned = ptr_is_owned(o);
28118         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28119         o_conv = OpenChannelV2_clone(&o_conv);
28120         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
28121         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
28122         return tag_ptr(ret_conv, true);
28123 }
28124
28125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28126         void* e_ptr = untag_ptr(e);
28127         CHECK_ACCESS(e_ptr);
28128         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28129         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28130         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
28131         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
28132         return tag_ptr(ret_conv, true);
28133 }
28134
28135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28136         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
28137         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
28138         return ret_conv;
28139 }
28140
28141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28142         if (!ptr_is_owned(_res)) return;
28143         void* _res_ptr = untag_ptr(_res);
28144         CHECK_ACCESS(_res_ptr);
28145         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
28146         FREE(untag_ptr(_res));
28147         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
28148 }
28149
28150 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
28151         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
28152         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
28153         return tag_ptr(ret_conv, true);
28154 }
28155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28156         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
28157         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
28158         return ret_conv;
28159 }
28160
28161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28162         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
28163         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
28164         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
28165         return tag_ptr(ret_conv, true);
28166 }
28167
28168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28169         LDKRevokeAndACK o_conv;
28170         o_conv.inner = untag_ptr(o);
28171         o_conv.is_owned = ptr_is_owned(o);
28172         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28173         o_conv = RevokeAndACK_clone(&o_conv);
28174         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
28175         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
28176         return tag_ptr(ret_conv, true);
28177 }
28178
28179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28180         void* e_ptr = untag_ptr(e);
28181         CHECK_ACCESS(e_ptr);
28182         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28183         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28184         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
28185         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
28186         return tag_ptr(ret_conv, true);
28187 }
28188
28189 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28190         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
28191         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
28192         return ret_conv;
28193 }
28194
28195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28196         if (!ptr_is_owned(_res)) return;
28197         void* _res_ptr = untag_ptr(_res);
28198         CHECK_ACCESS(_res_ptr);
28199         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
28200         FREE(untag_ptr(_res));
28201         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
28202 }
28203
28204 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
28205         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
28206         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
28207         return tag_ptr(ret_conv, true);
28208 }
28209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28210         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
28211         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
28212         return ret_conv;
28213 }
28214
28215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28216         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
28217         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
28218         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
28219         return tag_ptr(ret_conv, true);
28220 }
28221
28222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28223         LDKShutdown o_conv;
28224         o_conv.inner = untag_ptr(o);
28225         o_conv.is_owned = ptr_is_owned(o);
28226         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28227         o_conv = Shutdown_clone(&o_conv);
28228         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
28229         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
28230         return tag_ptr(ret_conv, true);
28231 }
28232
28233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28234         void* e_ptr = untag_ptr(e);
28235         CHECK_ACCESS(e_ptr);
28236         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28237         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28238         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
28239         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
28240         return tag_ptr(ret_conv, true);
28241 }
28242
28243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28244         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
28245         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
28246         return ret_conv;
28247 }
28248
28249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28250         if (!ptr_is_owned(_res)) return;
28251         void* _res_ptr = untag_ptr(_res);
28252         CHECK_ACCESS(_res_ptr);
28253         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
28254         FREE(untag_ptr(_res));
28255         CResult_ShutdownDecodeErrorZ_free(_res_conv);
28256 }
28257
28258 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
28259         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
28260         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
28261         return tag_ptr(ret_conv, true);
28262 }
28263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28264         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
28265         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
28266         return ret_conv;
28267 }
28268
28269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28270         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
28271         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
28272         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
28273         return tag_ptr(ret_conv, true);
28274 }
28275
28276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28277         LDKUpdateFailHTLC o_conv;
28278         o_conv.inner = untag_ptr(o);
28279         o_conv.is_owned = ptr_is_owned(o);
28280         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28281         o_conv = UpdateFailHTLC_clone(&o_conv);
28282         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
28283         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
28284         return tag_ptr(ret_conv, true);
28285 }
28286
28287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28288         void* e_ptr = untag_ptr(e);
28289         CHECK_ACCESS(e_ptr);
28290         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28291         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28292         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
28293         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
28294         return tag_ptr(ret_conv, true);
28295 }
28296
28297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28298         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
28299         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
28300         return ret_conv;
28301 }
28302
28303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28304         if (!ptr_is_owned(_res)) return;
28305         void* _res_ptr = untag_ptr(_res);
28306         CHECK_ACCESS(_res_ptr);
28307         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
28308         FREE(untag_ptr(_res));
28309         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
28310 }
28311
28312 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
28313         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
28314         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
28315         return tag_ptr(ret_conv, true);
28316 }
28317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28318         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
28319         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
28320         return ret_conv;
28321 }
28322
28323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28324         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
28325         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
28326         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
28327         return tag_ptr(ret_conv, true);
28328 }
28329
28330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28331         LDKUpdateFailMalformedHTLC o_conv;
28332         o_conv.inner = untag_ptr(o);
28333         o_conv.is_owned = ptr_is_owned(o);
28334         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28335         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
28336         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
28337         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
28338         return tag_ptr(ret_conv, true);
28339 }
28340
28341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28342         void* e_ptr = untag_ptr(e);
28343         CHECK_ACCESS(e_ptr);
28344         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28345         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28346         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
28347         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
28348         return tag_ptr(ret_conv, true);
28349 }
28350
28351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28352         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
28353         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
28354         return ret_conv;
28355 }
28356
28357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28358         if (!ptr_is_owned(_res)) return;
28359         void* _res_ptr = untag_ptr(_res);
28360         CHECK_ACCESS(_res_ptr);
28361         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
28362         FREE(untag_ptr(_res));
28363         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
28364 }
28365
28366 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
28367         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
28368         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
28369         return tag_ptr(ret_conv, true);
28370 }
28371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28372         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
28373         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
28374         return ret_conv;
28375 }
28376
28377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28378         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
28379         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
28380         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
28381         return tag_ptr(ret_conv, true);
28382 }
28383
28384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28385         LDKUpdateFee o_conv;
28386         o_conv.inner = untag_ptr(o);
28387         o_conv.is_owned = ptr_is_owned(o);
28388         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28389         o_conv = UpdateFee_clone(&o_conv);
28390         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
28391         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
28392         return tag_ptr(ret_conv, true);
28393 }
28394
28395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28396         void* e_ptr = untag_ptr(e);
28397         CHECK_ACCESS(e_ptr);
28398         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28399         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28400         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
28401         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
28402         return tag_ptr(ret_conv, true);
28403 }
28404
28405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28406         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
28407         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
28408         return ret_conv;
28409 }
28410
28411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28412         if (!ptr_is_owned(_res)) return;
28413         void* _res_ptr = untag_ptr(_res);
28414         CHECK_ACCESS(_res_ptr);
28415         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
28416         FREE(untag_ptr(_res));
28417         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
28418 }
28419
28420 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
28421         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
28422         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
28423         return tag_ptr(ret_conv, true);
28424 }
28425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28426         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
28427         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
28428         return ret_conv;
28429 }
28430
28431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28432         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
28433         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
28434         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
28435         return tag_ptr(ret_conv, true);
28436 }
28437
28438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28439         LDKUpdateFulfillHTLC o_conv;
28440         o_conv.inner = untag_ptr(o);
28441         o_conv.is_owned = ptr_is_owned(o);
28442         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28443         o_conv = UpdateFulfillHTLC_clone(&o_conv);
28444         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28445         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
28446         return tag_ptr(ret_conv, true);
28447 }
28448
28449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28450         void* e_ptr = untag_ptr(e);
28451         CHECK_ACCESS(e_ptr);
28452         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28453         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28454         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28455         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
28456         return tag_ptr(ret_conv, true);
28457 }
28458
28459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28460         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
28461         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
28462         return ret_conv;
28463 }
28464
28465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28466         if (!ptr_is_owned(_res)) return;
28467         void* _res_ptr = untag_ptr(_res);
28468         CHECK_ACCESS(_res_ptr);
28469         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
28470         FREE(untag_ptr(_res));
28471         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
28472 }
28473
28474 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
28475         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28476         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
28477         return tag_ptr(ret_conv, true);
28478 }
28479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28480         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
28481         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
28482         return ret_conv;
28483 }
28484
28485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28486         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
28487         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
28488         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
28489         return tag_ptr(ret_conv, true);
28490 }
28491
28492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28493         LDKUpdateAddHTLC o_conv;
28494         o_conv.inner = untag_ptr(o);
28495         o_conv.is_owned = ptr_is_owned(o);
28496         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28497         o_conv = UpdateAddHTLC_clone(&o_conv);
28498         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28499         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
28500         return tag_ptr(ret_conv, true);
28501 }
28502
28503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28504         void* e_ptr = untag_ptr(e);
28505         CHECK_ACCESS(e_ptr);
28506         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28507         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28508         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28509         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
28510         return tag_ptr(ret_conv, true);
28511 }
28512
28513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28514         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
28515         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
28516         return ret_conv;
28517 }
28518
28519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28520         if (!ptr_is_owned(_res)) return;
28521         void* _res_ptr = untag_ptr(_res);
28522         CHECK_ACCESS(_res_ptr);
28523         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
28524         FREE(untag_ptr(_res));
28525         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
28526 }
28527
28528 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
28529         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28530         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
28531         return tag_ptr(ret_conv, true);
28532 }
28533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28534         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
28535         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
28536         return ret_conv;
28537 }
28538
28539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28540         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
28541         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
28542         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
28543         return tag_ptr(ret_conv, true);
28544 }
28545
28546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28547         LDKOnionMessage o_conv;
28548         o_conv.inner = untag_ptr(o);
28549         o_conv.is_owned = ptr_is_owned(o);
28550         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28551         o_conv = OnionMessage_clone(&o_conv);
28552         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
28553         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
28554         return tag_ptr(ret_conv, true);
28555 }
28556
28557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28558         void* e_ptr = untag_ptr(e);
28559         CHECK_ACCESS(e_ptr);
28560         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28561         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28562         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
28563         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
28564         return tag_ptr(ret_conv, true);
28565 }
28566
28567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28568         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
28569         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
28570         return ret_conv;
28571 }
28572
28573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28574         if (!ptr_is_owned(_res)) return;
28575         void* _res_ptr = untag_ptr(_res);
28576         CHECK_ACCESS(_res_ptr);
28577         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
28578         FREE(untag_ptr(_res));
28579         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
28580 }
28581
28582 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
28583         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
28584         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
28585         return tag_ptr(ret_conv, true);
28586 }
28587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28588         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
28589         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
28590         return ret_conv;
28591 }
28592
28593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28594         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
28595         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
28596         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
28597         return tag_ptr(ret_conv, true);
28598 }
28599
28600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28601         LDKPing o_conv;
28602         o_conv.inner = untag_ptr(o);
28603         o_conv.is_owned = ptr_is_owned(o);
28604         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28605         o_conv = Ping_clone(&o_conv);
28606         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28607         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
28608         return tag_ptr(ret_conv, true);
28609 }
28610
28611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28612         void* e_ptr = untag_ptr(e);
28613         CHECK_ACCESS(e_ptr);
28614         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28615         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28616         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28617         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
28618         return tag_ptr(ret_conv, true);
28619 }
28620
28621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28622         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
28623         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
28624         return ret_conv;
28625 }
28626
28627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28628         if (!ptr_is_owned(_res)) return;
28629         void* _res_ptr = untag_ptr(_res);
28630         CHECK_ACCESS(_res_ptr);
28631         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
28632         FREE(untag_ptr(_res));
28633         CResult_PingDecodeErrorZ_free(_res_conv);
28634 }
28635
28636 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
28637         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28638         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
28639         return tag_ptr(ret_conv, true);
28640 }
28641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28642         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
28643         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
28644         return ret_conv;
28645 }
28646
28647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28648         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
28649         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
28650         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
28651         return tag_ptr(ret_conv, true);
28652 }
28653
28654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28655         LDKPong o_conv;
28656         o_conv.inner = untag_ptr(o);
28657         o_conv.is_owned = ptr_is_owned(o);
28658         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28659         o_conv = Pong_clone(&o_conv);
28660         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28661         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
28662         return tag_ptr(ret_conv, true);
28663 }
28664
28665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28666         void* e_ptr = untag_ptr(e);
28667         CHECK_ACCESS(e_ptr);
28668         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28669         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28670         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28671         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
28672         return tag_ptr(ret_conv, true);
28673 }
28674
28675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28676         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
28677         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
28678         return ret_conv;
28679 }
28680
28681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28682         if (!ptr_is_owned(_res)) return;
28683         void* _res_ptr = untag_ptr(_res);
28684         CHECK_ACCESS(_res_ptr);
28685         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
28686         FREE(untag_ptr(_res));
28687         CResult_PongDecodeErrorZ_free(_res_conv);
28688 }
28689
28690 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
28691         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28692         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
28693         return tag_ptr(ret_conv, true);
28694 }
28695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28696         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
28697         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
28698         return ret_conv;
28699 }
28700
28701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28702         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
28703         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
28704         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
28705         return tag_ptr(ret_conv, true);
28706 }
28707
28708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28709         LDKUnsignedChannelAnnouncement o_conv;
28710         o_conv.inner = untag_ptr(o);
28711         o_conv.is_owned = ptr_is_owned(o);
28712         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28713         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
28714         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28715         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
28716         return tag_ptr(ret_conv, true);
28717 }
28718
28719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28720         void* e_ptr = untag_ptr(e);
28721         CHECK_ACCESS(e_ptr);
28722         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28723         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28724         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28725         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
28726         return tag_ptr(ret_conv, true);
28727 }
28728
28729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28730         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
28731         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
28732         return ret_conv;
28733 }
28734
28735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28736         if (!ptr_is_owned(_res)) return;
28737         void* _res_ptr = untag_ptr(_res);
28738         CHECK_ACCESS(_res_ptr);
28739         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
28740         FREE(untag_ptr(_res));
28741         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
28742 }
28743
28744 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
28745         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28746         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
28747         return tag_ptr(ret_conv, true);
28748 }
28749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28750         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
28751         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
28752         return ret_conv;
28753 }
28754
28755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28756         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
28757         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
28758         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
28759         return tag_ptr(ret_conv, true);
28760 }
28761
28762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28763         LDKChannelAnnouncement o_conv;
28764         o_conv.inner = untag_ptr(o);
28765         o_conv.is_owned = ptr_is_owned(o);
28766         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28767         o_conv = ChannelAnnouncement_clone(&o_conv);
28768         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28769         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
28770         return tag_ptr(ret_conv, true);
28771 }
28772
28773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28774         void* e_ptr = untag_ptr(e);
28775         CHECK_ACCESS(e_ptr);
28776         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28777         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28778         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28779         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
28780         return tag_ptr(ret_conv, true);
28781 }
28782
28783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28784         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
28785         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
28786         return ret_conv;
28787 }
28788
28789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28790         if (!ptr_is_owned(_res)) return;
28791         void* _res_ptr = untag_ptr(_res);
28792         CHECK_ACCESS(_res_ptr);
28793         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
28794         FREE(untag_ptr(_res));
28795         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
28796 }
28797
28798 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
28799         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28800         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
28801         return tag_ptr(ret_conv, true);
28802 }
28803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28804         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
28805         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
28806         return ret_conv;
28807 }
28808
28809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28810         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
28811         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
28812         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
28813         return tag_ptr(ret_conv, true);
28814 }
28815
28816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28817         LDKUnsignedChannelUpdate o_conv;
28818         o_conv.inner = untag_ptr(o);
28819         o_conv.is_owned = ptr_is_owned(o);
28820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28821         o_conv = UnsignedChannelUpdate_clone(&o_conv);
28822         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28823         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
28824         return tag_ptr(ret_conv, true);
28825 }
28826
28827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28828         void* e_ptr = untag_ptr(e);
28829         CHECK_ACCESS(e_ptr);
28830         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28831         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28832         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28833         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
28834         return tag_ptr(ret_conv, true);
28835 }
28836
28837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28838         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
28839         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
28840         return ret_conv;
28841 }
28842
28843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28844         if (!ptr_is_owned(_res)) return;
28845         void* _res_ptr = untag_ptr(_res);
28846         CHECK_ACCESS(_res_ptr);
28847         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
28848         FREE(untag_ptr(_res));
28849         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
28850 }
28851
28852 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
28853         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28854         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
28855         return tag_ptr(ret_conv, true);
28856 }
28857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28858         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
28859         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
28860         return ret_conv;
28861 }
28862
28863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28864         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
28865         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
28866         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
28867         return tag_ptr(ret_conv, true);
28868 }
28869
28870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28871         LDKChannelUpdate o_conv;
28872         o_conv.inner = untag_ptr(o);
28873         o_conv.is_owned = ptr_is_owned(o);
28874         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28875         o_conv = ChannelUpdate_clone(&o_conv);
28876         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28877         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
28878         return tag_ptr(ret_conv, true);
28879 }
28880
28881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28882         void* e_ptr = untag_ptr(e);
28883         CHECK_ACCESS(e_ptr);
28884         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28885         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28886         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28887         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
28888         return tag_ptr(ret_conv, true);
28889 }
28890
28891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28892         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
28893         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
28894         return ret_conv;
28895 }
28896
28897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28898         if (!ptr_is_owned(_res)) return;
28899         void* _res_ptr = untag_ptr(_res);
28900         CHECK_ACCESS(_res_ptr);
28901         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
28902         FREE(untag_ptr(_res));
28903         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
28904 }
28905
28906 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
28907         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28908         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
28909         return tag_ptr(ret_conv, true);
28910 }
28911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28912         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
28913         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
28914         return ret_conv;
28915 }
28916
28917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28918         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
28919         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
28920         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
28921         return tag_ptr(ret_conv, true);
28922 }
28923
28924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28925         LDKErrorMessage o_conv;
28926         o_conv.inner = untag_ptr(o);
28927         o_conv.is_owned = ptr_is_owned(o);
28928         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28929         o_conv = ErrorMessage_clone(&o_conv);
28930         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28931         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
28932         return tag_ptr(ret_conv, true);
28933 }
28934
28935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28936         void* e_ptr = untag_ptr(e);
28937         CHECK_ACCESS(e_ptr);
28938         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28939         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28940         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28941         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
28942         return tag_ptr(ret_conv, true);
28943 }
28944
28945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28946         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
28947         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
28948         return ret_conv;
28949 }
28950
28951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28952         if (!ptr_is_owned(_res)) return;
28953         void* _res_ptr = untag_ptr(_res);
28954         CHECK_ACCESS(_res_ptr);
28955         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
28956         FREE(untag_ptr(_res));
28957         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
28958 }
28959
28960 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
28961         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28962         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
28963         return tag_ptr(ret_conv, true);
28964 }
28965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28966         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
28967         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
28968         return ret_conv;
28969 }
28970
28971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28972         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
28973         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
28974         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
28975         return tag_ptr(ret_conv, true);
28976 }
28977
28978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28979         LDKWarningMessage o_conv;
28980         o_conv.inner = untag_ptr(o);
28981         o_conv.is_owned = ptr_is_owned(o);
28982         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28983         o_conv = WarningMessage_clone(&o_conv);
28984         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
28985         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
28986         return tag_ptr(ret_conv, true);
28987 }
28988
28989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28990         void* e_ptr = untag_ptr(e);
28991         CHECK_ACCESS(e_ptr);
28992         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28993         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28994         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
28995         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
28996         return tag_ptr(ret_conv, true);
28997 }
28998
28999 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29000         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
29001         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
29002         return ret_conv;
29003 }
29004
29005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29006         if (!ptr_is_owned(_res)) return;
29007         void* _res_ptr = untag_ptr(_res);
29008         CHECK_ACCESS(_res_ptr);
29009         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
29010         FREE(untag_ptr(_res));
29011         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
29012 }
29013
29014 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
29015         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
29016         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
29017         return tag_ptr(ret_conv, true);
29018 }
29019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29020         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
29021         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
29022         return ret_conv;
29023 }
29024
29025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29026         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
29027         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
29028         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
29029         return tag_ptr(ret_conv, true);
29030 }
29031
29032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29033         LDKUnsignedNodeAnnouncement o_conv;
29034         o_conv.inner = untag_ptr(o);
29035         o_conv.is_owned = ptr_is_owned(o);
29036         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29037         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
29038         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
29039         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
29040         return tag_ptr(ret_conv, true);
29041 }
29042
29043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29044         void* e_ptr = untag_ptr(e);
29045         CHECK_ACCESS(e_ptr);
29046         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29047         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29048         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
29049         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
29050         return tag_ptr(ret_conv, true);
29051 }
29052
29053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29054         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
29055         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
29056         return ret_conv;
29057 }
29058
29059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29060         if (!ptr_is_owned(_res)) return;
29061         void* _res_ptr = untag_ptr(_res);
29062         CHECK_ACCESS(_res_ptr);
29063         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
29064         FREE(untag_ptr(_res));
29065         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
29066 }
29067
29068 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29069         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
29070         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
29071         return tag_ptr(ret_conv, true);
29072 }
29073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29074         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
29075         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29076         return ret_conv;
29077 }
29078
29079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29080         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
29081         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
29082         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
29083         return tag_ptr(ret_conv, true);
29084 }
29085
29086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29087         LDKNodeAnnouncement o_conv;
29088         o_conv.inner = untag_ptr(o);
29089         o_conv.is_owned = ptr_is_owned(o);
29090         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29091         o_conv = NodeAnnouncement_clone(&o_conv);
29092         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
29093         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
29094         return tag_ptr(ret_conv, true);
29095 }
29096
29097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29098         void* e_ptr = untag_ptr(e);
29099         CHECK_ACCESS(e_ptr);
29100         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29101         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29102         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
29103         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
29104         return tag_ptr(ret_conv, true);
29105 }
29106
29107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29108         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
29109         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
29110         return ret_conv;
29111 }
29112
29113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29114         if (!ptr_is_owned(_res)) return;
29115         void* _res_ptr = untag_ptr(_res);
29116         CHECK_ACCESS(_res_ptr);
29117         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
29118         FREE(untag_ptr(_res));
29119         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
29120 }
29121
29122 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
29123         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
29124         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
29125         return tag_ptr(ret_conv, true);
29126 }
29127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29128         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
29129         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
29130         return ret_conv;
29131 }
29132
29133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29134         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
29135         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
29136         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
29137         return tag_ptr(ret_conv, true);
29138 }
29139
29140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29141         LDKQueryShortChannelIds o_conv;
29142         o_conv.inner = untag_ptr(o);
29143         o_conv.is_owned = ptr_is_owned(o);
29144         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29145         o_conv = QueryShortChannelIds_clone(&o_conv);
29146         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
29147         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
29148         return tag_ptr(ret_conv, true);
29149 }
29150
29151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29152         void* e_ptr = untag_ptr(e);
29153         CHECK_ACCESS(e_ptr);
29154         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29155         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29156         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
29157         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
29158         return tag_ptr(ret_conv, true);
29159 }
29160
29161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29162         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
29163         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
29164         return ret_conv;
29165 }
29166
29167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29168         if (!ptr_is_owned(_res)) return;
29169         void* _res_ptr = untag_ptr(_res);
29170         CHECK_ACCESS(_res_ptr);
29171         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
29172         FREE(untag_ptr(_res));
29173         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
29174 }
29175
29176 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
29177         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
29178         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
29179         return tag_ptr(ret_conv, true);
29180 }
29181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29182         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
29183         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
29184         return ret_conv;
29185 }
29186
29187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29188         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
29189         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
29190         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
29191         return tag_ptr(ret_conv, true);
29192 }
29193
29194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29195         LDKReplyShortChannelIdsEnd o_conv;
29196         o_conv.inner = untag_ptr(o);
29197         o_conv.is_owned = ptr_is_owned(o);
29198         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29199         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
29200         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
29201         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
29202         return tag_ptr(ret_conv, true);
29203 }
29204
29205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29206         void* e_ptr = untag_ptr(e);
29207         CHECK_ACCESS(e_ptr);
29208         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29209         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29210         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
29211         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
29212         return tag_ptr(ret_conv, true);
29213 }
29214
29215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29216         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
29217         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
29218         return ret_conv;
29219 }
29220
29221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29222         if (!ptr_is_owned(_res)) return;
29223         void* _res_ptr = untag_ptr(_res);
29224         CHECK_ACCESS(_res_ptr);
29225         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
29226         FREE(untag_ptr(_res));
29227         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
29228 }
29229
29230 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
29231         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
29232         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
29233         return tag_ptr(ret_conv, true);
29234 }
29235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29236         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
29237         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
29238         return ret_conv;
29239 }
29240
29241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29242         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
29243         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
29244         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
29245         return tag_ptr(ret_conv, true);
29246 }
29247
29248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29249         LDKQueryChannelRange o_conv;
29250         o_conv.inner = untag_ptr(o);
29251         o_conv.is_owned = ptr_is_owned(o);
29252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29253         o_conv = QueryChannelRange_clone(&o_conv);
29254         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
29255         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
29256         return tag_ptr(ret_conv, true);
29257 }
29258
29259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29260         void* e_ptr = untag_ptr(e);
29261         CHECK_ACCESS(e_ptr);
29262         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29263         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29264         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
29265         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
29266         return tag_ptr(ret_conv, true);
29267 }
29268
29269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29270         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
29271         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
29272         return ret_conv;
29273 }
29274
29275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29276         if (!ptr_is_owned(_res)) return;
29277         void* _res_ptr = untag_ptr(_res);
29278         CHECK_ACCESS(_res_ptr);
29279         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
29280         FREE(untag_ptr(_res));
29281         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
29282 }
29283
29284 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
29285         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
29286         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
29287         return tag_ptr(ret_conv, true);
29288 }
29289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29290         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
29291         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
29292         return ret_conv;
29293 }
29294
29295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29296         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
29297         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
29298         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
29299         return tag_ptr(ret_conv, true);
29300 }
29301
29302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29303         LDKReplyChannelRange o_conv;
29304         o_conv.inner = untag_ptr(o);
29305         o_conv.is_owned = ptr_is_owned(o);
29306         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29307         o_conv = ReplyChannelRange_clone(&o_conv);
29308         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
29309         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
29310         return tag_ptr(ret_conv, true);
29311 }
29312
29313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29314         void* e_ptr = untag_ptr(e);
29315         CHECK_ACCESS(e_ptr);
29316         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29317         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29318         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
29319         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
29320         return tag_ptr(ret_conv, true);
29321 }
29322
29323 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29324         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
29325         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
29326         return ret_conv;
29327 }
29328
29329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29330         if (!ptr_is_owned(_res)) return;
29331         void* _res_ptr = untag_ptr(_res);
29332         CHECK_ACCESS(_res_ptr);
29333         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
29334         FREE(untag_ptr(_res));
29335         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
29336 }
29337
29338 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
29339         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
29340         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
29341         return tag_ptr(ret_conv, true);
29342 }
29343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29344         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
29345         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
29346         return ret_conv;
29347 }
29348
29349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29350         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
29351         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
29352         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
29353         return tag_ptr(ret_conv, true);
29354 }
29355
29356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29357         LDKGossipTimestampFilter o_conv;
29358         o_conv.inner = untag_ptr(o);
29359         o_conv.is_owned = ptr_is_owned(o);
29360         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29361         o_conv = GossipTimestampFilter_clone(&o_conv);
29362         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
29363         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
29364         return tag_ptr(ret_conv, true);
29365 }
29366
29367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29368         void* e_ptr = untag_ptr(e);
29369         CHECK_ACCESS(e_ptr);
29370         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29371         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29372         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
29373         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
29374         return tag_ptr(ret_conv, true);
29375 }
29376
29377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29378         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
29379         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
29380         return ret_conv;
29381 }
29382
29383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29384         if (!ptr_is_owned(_res)) return;
29385         void* _res_ptr = untag_ptr(_res);
29386         CHECK_ACCESS(_res_ptr);
29387         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
29388         FREE(untag_ptr(_res));
29389         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
29390 }
29391
29392 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
29393         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
29394         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
29395         return tag_ptr(ret_conv, true);
29396 }
29397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29398         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
29399         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
29400         return ret_conv;
29401 }
29402
29403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29404         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
29405         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
29406         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
29407         return tag_ptr(ret_conv, true);
29408 }
29409
29410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29411         LDKCVec_PhantomRouteHintsZ _res_constr;
29412         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29413         if (_res_constr.datalen > 0)
29414                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
29415         else
29416                 _res_constr.data = NULL;
29417         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29418         for (size_t t = 0; t < _res_constr.datalen; t++) {
29419                 int64_t _res_conv_19 = _res_vals[t];
29420                 LDKPhantomRouteHints _res_conv_19_conv;
29421                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
29422                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
29423                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
29424                 _res_constr.data[t] = _res_conv_19_conv;
29425         }
29426         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29427         CVec_PhantomRouteHintsZ_free(_res_constr);
29428 }
29429
29430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29431         LDKBolt11Invoice o_conv;
29432         o_conv.inner = untag_ptr(o);
29433         o_conv.is_owned = ptr_is_owned(o);
29434         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29435         o_conv = Bolt11Invoice_clone(&o_conv);
29436         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
29437         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
29438         return tag_ptr(ret_conv, true);
29439 }
29440
29441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29442         void* e_ptr = untag_ptr(e);
29443         CHECK_ACCESS(e_ptr);
29444         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
29445         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
29446         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
29447         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
29448         return tag_ptr(ret_conv, true);
29449 }
29450
29451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29452         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
29453         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
29454         return ret_conv;
29455 }
29456
29457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29458         if (!ptr_is_owned(_res)) return;
29459         void* _res_ptr = untag_ptr(_res);
29460         CHECK_ACCESS(_res_ptr);
29461         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
29462         FREE(untag_ptr(_res));
29463         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
29464 }
29465
29466 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
29467         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
29468         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
29469         return tag_ptr(ret_conv, true);
29470 }
29471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29472         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
29473         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
29474         return ret_conv;
29475 }
29476
29477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29478         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
29479         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
29480         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
29481         return tag_ptr(ret_conv, true);
29482 }
29483
29484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29485         LDKCVec_FutureZ _res_constr;
29486         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29487         if (_res_constr.datalen > 0)
29488                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
29489         else
29490                 _res_constr.data = NULL;
29491         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29492         for (size_t i = 0; i < _res_constr.datalen; i++) {
29493                 int64_t _res_conv_8 = _res_vals[i];
29494                 LDKFuture _res_conv_8_conv;
29495                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
29496                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
29497                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
29498                 _res_constr.data[i] = _res_conv_8_conv;
29499         }
29500         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29501         CVec_FutureZ_free(_res_constr);
29502 }
29503
29504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29505         void* o_ptr = untag_ptr(o);
29506         CHECK_ACCESS(o_ptr);
29507         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
29508         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
29509         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
29510         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
29511         return tag_ptr(ret_conv, true);
29512 }
29513
29514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29515         void* e_ptr = untag_ptr(e);
29516         CHECK_ACCESS(e_ptr);
29517         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29518         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29519         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
29520         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
29521         return tag_ptr(ret_conv, true);
29522 }
29523
29524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29525         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
29526         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
29527         return ret_conv;
29528 }
29529
29530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29531         if (!ptr_is_owned(_res)) return;
29532         void* _res_ptr = untag_ptr(_res);
29533         CHECK_ACCESS(_res_ptr);
29534         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
29535         FREE(untag_ptr(_res));
29536         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
29537 }
29538
29539 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
29540         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
29541         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
29542         return tag_ptr(ret_conv, true);
29543 }
29544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29545         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
29546         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
29547         return ret_conv;
29548 }
29549
29550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29551         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
29552         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
29553         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
29554         return tag_ptr(ret_conv, true);
29555 }
29556
29557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
29558         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
29559         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
29560         *ret_copy = COption_HTLCClaimZ_some(o_conv);
29561         int64_t ret_ref = tag_ptr(ret_copy, true);
29562         return ret_ref;
29563 }
29564
29565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
29566         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
29567         *ret_copy = COption_HTLCClaimZ_none();
29568         int64_t ret_ref = tag_ptr(ret_copy, true);
29569         return ret_ref;
29570 }
29571
29572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29573         if (!ptr_is_owned(_res)) return;
29574         void* _res_ptr = untag_ptr(_res);
29575         CHECK_ACCESS(_res_ptr);
29576         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
29577         FREE(untag_ptr(_res));
29578         COption_HTLCClaimZ_free(_res_conv);
29579 }
29580
29581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29582         LDKCounterpartyCommitmentSecrets o_conv;
29583         o_conv.inner = untag_ptr(o);
29584         o_conv.is_owned = ptr_is_owned(o);
29585         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29586         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
29587         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
29588         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
29589         return tag_ptr(ret_conv, true);
29590 }
29591
29592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29593         void* e_ptr = untag_ptr(e);
29594         CHECK_ACCESS(e_ptr);
29595         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29596         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29597         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
29598         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
29599         return tag_ptr(ret_conv, true);
29600 }
29601
29602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29603         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
29604         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
29605         return ret_conv;
29606 }
29607
29608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29609         if (!ptr_is_owned(_res)) return;
29610         void* _res_ptr = untag_ptr(_res);
29611         CHECK_ACCESS(_res_ptr);
29612         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
29613         FREE(untag_ptr(_res));
29614         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
29615 }
29616
29617 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
29618         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
29619         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
29620         return tag_ptr(ret_conv, true);
29621 }
29622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29623         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
29624         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
29625         return ret_conv;
29626 }
29627
29628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29629         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
29630         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
29631         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
29632         return tag_ptr(ret_conv, true);
29633 }
29634
29635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29636         LDKTxCreationKeys o_conv;
29637         o_conv.inner = untag_ptr(o);
29638         o_conv.is_owned = ptr_is_owned(o);
29639         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29640         o_conv = TxCreationKeys_clone(&o_conv);
29641         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29642         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
29643         return tag_ptr(ret_conv, true);
29644 }
29645
29646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29647         void* e_ptr = untag_ptr(e);
29648         CHECK_ACCESS(e_ptr);
29649         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29650         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29651         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29652         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
29653         return tag_ptr(ret_conv, true);
29654 }
29655
29656 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29657         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
29658         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
29659         return ret_conv;
29660 }
29661
29662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29663         if (!ptr_is_owned(_res)) return;
29664         void* _res_ptr = untag_ptr(_res);
29665         CHECK_ACCESS(_res_ptr);
29666         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
29667         FREE(untag_ptr(_res));
29668         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
29669 }
29670
29671 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
29672         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29673         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
29674         return tag_ptr(ret_conv, true);
29675 }
29676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29677         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
29678         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
29679         return ret_conv;
29680 }
29681
29682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29683         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
29684         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
29685         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
29686         return tag_ptr(ret_conv, true);
29687 }
29688
29689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29690         LDKChannelPublicKeys o_conv;
29691         o_conv.inner = untag_ptr(o);
29692         o_conv.is_owned = ptr_is_owned(o);
29693         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29694         o_conv = ChannelPublicKeys_clone(&o_conv);
29695         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29696         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
29697         return tag_ptr(ret_conv, true);
29698 }
29699
29700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29701         void* e_ptr = untag_ptr(e);
29702         CHECK_ACCESS(e_ptr);
29703         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29704         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29705         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29706         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
29707         return tag_ptr(ret_conv, true);
29708 }
29709
29710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29711         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
29712         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
29713         return ret_conv;
29714 }
29715
29716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29717         if (!ptr_is_owned(_res)) return;
29718         void* _res_ptr = untag_ptr(_res);
29719         CHECK_ACCESS(_res_ptr);
29720         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
29721         FREE(untag_ptr(_res));
29722         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
29723 }
29724
29725 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
29726         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29727         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
29728         return tag_ptr(ret_conv, true);
29729 }
29730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29731         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
29732         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
29733         return ret_conv;
29734 }
29735
29736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29737         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
29738         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
29739         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
29740         return tag_ptr(ret_conv, true);
29741 }
29742
29743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29744         LDKHTLCOutputInCommitment o_conv;
29745         o_conv.inner = untag_ptr(o);
29746         o_conv.is_owned = ptr_is_owned(o);
29747         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29748         o_conv = HTLCOutputInCommitment_clone(&o_conv);
29749         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29750         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
29751         return tag_ptr(ret_conv, true);
29752 }
29753
29754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29755         void* e_ptr = untag_ptr(e);
29756         CHECK_ACCESS(e_ptr);
29757         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29758         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29759         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29760         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
29761         return tag_ptr(ret_conv, true);
29762 }
29763
29764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29765         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
29766         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
29767         return ret_conv;
29768 }
29769
29770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29771         if (!ptr_is_owned(_res)) return;
29772         void* _res_ptr = untag_ptr(_res);
29773         CHECK_ACCESS(_res_ptr);
29774         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
29775         FREE(untag_ptr(_res));
29776         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
29777 }
29778
29779 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
29780         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29781         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
29782         return tag_ptr(ret_conv, true);
29783 }
29784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29785         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
29786         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
29787         return ret_conv;
29788 }
29789
29790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29791         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
29792         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
29793         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
29794         return tag_ptr(ret_conv, true);
29795 }
29796
29797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29798         LDKCounterpartyChannelTransactionParameters o_conv;
29799         o_conv.inner = untag_ptr(o);
29800         o_conv.is_owned = ptr_is_owned(o);
29801         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29802         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
29803         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29804         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
29805         return tag_ptr(ret_conv, true);
29806 }
29807
29808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29809         void* e_ptr = untag_ptr(e);
29810         CHECK_ACCESS(e_ptr);
29811         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29812         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29813         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29814         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
29815         return tag_ptr(ret_conv, true);
29816 }
29817
29818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29819         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
29820         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
29821         return ret_conv;
29822 }
29823
29824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29825         if (!ptr_is_owned(_res)) return;
29826         void* _res_ptr = untag_ptr(_res);
29827         CHECK_ACCESS(_res_ptr);
29828         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
29829         FREE(untag_ptr(_res));
29830         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
29831 }
29832
29833 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
29834         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29835         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
29836         return tag_ptr(ret_conv, true);
29837 }
29838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29839         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
29840         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
29841         return ret_conv;
29842 }
29843
29844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29845         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
29846         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
29847         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
29848         return tag_ptr(ret_conv, true);
29849 }
29850
29851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29852         LDKChannelTransactionParameters o_conv;
29853         o_conv.inner = untag_ptr(o);
29854         o_conv.is_owned = ptr_is_owned(o);
29855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29856         o_conv = ChannelTransactionParameters_clone(&o_conv);
29857         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29858         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
29859         return tag_ptr(ret_conv, true);
29860 }
29861
29862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29863         void* e_ptr = untag_ptr(e);
29864         CHECK_ACCESS(e_ptr);
29865         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29866         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29867         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29868         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
29869         return tag_ptr(ret_conv, true);
29870 }
29871
29872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29873         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
29874         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
29875         return ret_conv;
29876 }
29877
29878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29879         if (!ptr_is_owned(_res)) return;
29880         void* _res_ptr = untag_ptr(_res);
29881         CHECK_ACCESS(_res_ptr);
29882         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
29883         FREE(untag_ptr(_res));
29884         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
29885 }
29886
29887 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
29888         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29889         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
29890         return tag_ptr(ret_conv, true);
29891 }
29892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29893         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
29894         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
29895         return ret_conv;
29896 }
29897
29898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29899         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
29900         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
29901         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
29902         return tag_ptr(ret_conv, true);
29903 }
29904
29905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29906         LDKHolderCommitmentTransaction o_conv;
29907         o_conv.inner = untag_ptr(o);
29908         o_conv.is_owned = ptr_is_owned(o);
29909         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29910         o_conv = HolderCommitmentTransaction_clone(&o_conv);
29911         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29912         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
29913         return tag_ptr(ret_conv, true);
29914 }
29915
29916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29917         void* e_ptr = untag_ptr(e);
29918         CHECK_ACCESS(e_ptr);
29919         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29920         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29921         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29922         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
29923         return tag_ptr(ret_conv, true);
29924 }
29925
29926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29927         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
29928         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
29929         return ret_conv;
29930 }
29931
29932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29933         if (!ptr_is_owned(_res)) return;
29934         void* _res_ptr = untag_ptr(_res);
29935         CHECK_ACCESS(_res_ptr);
29936         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
29937         FREE(untag_ptr(_res));
29938         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
29939 }
29940
29941 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
29942         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29943         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
29944         return tag_ptr(ret_conv, true);
29945 }
29946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29947         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
29948         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
29949         return ret_conv;
29950 }
29951
29952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29953         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
29954         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
29955         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
29956         return tag_ptr(ret_conv, true);
29957 }
29958
29959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29960         LDKBuiltCommitmentTransaction o_conv;
29961         o_conv.inner = untag_ptr(o);
29962         o_conv.is_owned = ptr_is_owned(o);
29963         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29964         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
29965         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
29966         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
29967         return tag_ptr(ret_conv, true);
29968 }
29969
29970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29971         void* e_ptr = untag_ptr(e);
29972         CHECK_ACCESS(e_ptr);
29973         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29974         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29975         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
29976         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
29977         return tag_ptr(ret_conv, true);
29978 }
29979
29980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29981         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
29982         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
29983         return ret_conv;
29984 }
29985
29986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29987         if (!ptr_is_owned(_res)) return;
29988         void* _res_ptr = untag_ptr(_res);
29989         CHECK_ACCESS(_res_ptr);
29990         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
29991         FREE(untag_ptr(_res));
29992         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
29993 }
29994
29995 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
29996         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
29997         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
29998         return tag_ptr(ret_conv, true);
29999 }
30000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30001         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
30002         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
30003         return ret_conv;
30004 }
30005
30006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30007         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
30008         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
30009         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
30010         return tag_ptr(ret_conv, true);
30011 }
30012
30013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30014         LDKTrustedClosingTransaction o_conv;
30015         o_conv.inner = untag_ptr(o);
30016         o_conv.is_owned = ptr_is_owned(o);
30017         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30018         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
30019         
30020         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
30021         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
30022         return tag_ptr(ret_conv, true);
30023 }
30024
30025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
30026         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
30027         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
30028         return tag_ptr(ret_conv, true);
30029 }
30030
30031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30032         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
30033         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
30034         return ret_conv;
30035 }
30036
30037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30038         if (!ptr_is_owned(_res)) return;
30039         void* _res_ptr = untag_ptr(_res);
30040         CHECK_ACCESS(_res_ptr);
30041         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
30042         FREE(untag_ptr(_res));
30043         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
30044 }
30045
30046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30047         LDKCommitmentTransaction o_conv;
30048         o_conv.inner = untag_ptr(o);
30049         o_conv.is_owned = ptr_is_owned(o);
30050         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30051         o_conv = CommitmentTransaction_clone(&o_conv);
30052         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30053         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
30054         return tag_ptr(ret_conv, true);
30055 }
30056
30057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30058         void* e_ptr = untag_ptr(e);
30059         CHECK_ACCESS(e_ptr);
30060         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30061         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30062         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30063         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
30064         return tag_ptr(ret_conv, true);
30065 }
30066
30067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30068         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
30069         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
30070         return ret_conv;
30071 }
30072
30073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30074         if (!ptr_is_owned(_res)) return;
30075         void* _res_ptr = untag_ptr(_res);
30076         CHECK_ACCESS(_res_ptr);
30077         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
30078         FREE(untag_ptr(_res));
30079         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
30080 }
30081
30082 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
30083         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30084         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
30085         return tag_ptr(ret_conv, true);
30086 }
30087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30088         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
30089         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
30090         return ret_conv;
30091 }
30092
30093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30094         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
30095         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
30096         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
30097         return tag_ptr(ret_conv, true);
30098 }
30099
30100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30101         LDKTrustedCommitmentTransaction o_conv;
30102         o_conv.inner = untag_ptr(o);
30103         o_conv.is_owned = ptr_is_owned(o);
30104         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30105         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
30106         
30107         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30108         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
30109         return tag_ptr(ret_conv, true);
30110 }
30111
30112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
30113         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
30114         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
30115         return tag_ptr(ret_conv, true);
30116 }
30117
30118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30119         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
30120         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
30121         return ret_conv;
30122 }
30123
30124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30125         if (!ptr_is_owned(_res)) return;
30126         void* _res_ptr = untag_ptr(_res);
30127         CHECK_ACCESS(_res_ptr);
30128         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
30129         FREE(untag_ptr(_res));
30130         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
30131 }
30132
30133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
30134         LDKCVec_SignatureZ o_constr;
30135         o_constr.datalen = (*env)->GetArrayLength(env, o);
30136         if (o_constr.datalen > 0)
30137                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30138         else
30139                 o_constr.data = NULL;
30140         for (size_t i = 0; i < o_constr.datalen; i++) {
30141                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
30142                 LDKSignature o_conv_8_ref;
30143                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
30144                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
30145                 o_constr.data[i] = o_conv_8_ref;
30146         }
30147         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30148         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
30149         return tag_ptr(ret_conv, true);
30150 }
30151
30152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
30153         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30154         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
30155         return tag_ptr(ret_conv, true);
30156 }
30157
30158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30159         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
30160         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
30161         return ret_conv;
30162 }
30163
30164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30165         if (!ptr_is_owned(_res)) return;
30166         void* _res_ptr = untag_ptr(_res);
30167         CHECK_ACCESS(_res_ptr);
30168         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
30169         FREE(untag_ptr(_res));
30170         CResult_CVec_SignatureZNoneZ_free(_res_conv);
30171 }
30172
30173 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
30174         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30175         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
30176         return tag_ptr(ret_conv, true);
30177 }
30178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30179         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
30180         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
30181         return ret_conv;
30182 }
30183
30184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30185         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
30186         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
30187         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
30188         return tag_ptr(ret_conv, true);
30189 }
30190
30191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30192         LDKShutdownScript o_conv;
30193         o_conv.inner = untag_ptr(o);
30194         o_conv.is_owned = ptr_is_owned(o);
30195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30196         o_conv = ShutdownScript_clone(&o_conv);
30197         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30198         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
30199         return tag_ptr(ret_conv, true);
30200 }
30201
30202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30203         void* e_ptr = untag_ptr(e);
30204         CHECK_ACCESS(e_ptr);
30205         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30206         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30207         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30208         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
30209         return tag_ptr(ret_conv, true);
30210 }
30211
30212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30213         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
30214         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
30215         return ret_conv;
30216 }
30217
30218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30219         if (!ptr_is_owned(_res)) return;
30220         void* _res_ptr = untag_ptr(_res);
30221         CHECK_ACCESS(_res_ptr);
30222         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
30223         FREE(untag_ptr(_res));
30224         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
30225 }
30226
30227 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
30228         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30229         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
30230         return tag_ptr(ret_conv, true);
30231 }
30232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30233         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
30234         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
30235         return ret_conv;
30236 }
30237
30238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30239         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
30240         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
30241         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
30242         return tag_ptr(ret_conv, true);
30243 }
30244
30245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30246         LDKShutdownScript o_conv;
30247         o_conv.inner = untag_ptr(o);
30248         o_conv.is_owned = ptr_is_owned(o);
30249         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30250         o_conv = ShutdownScript_clone(&o_conv);
30251         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30252         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
30253         return tag_ptr(ret_conv, true);
30254 }
30255
30256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30257         LDKInvalidShutdownScript e_conv;
30258         e_conv.inner = untag_ptr(e);
30259         e_conv.is_owned = ptr_is_owned(e);
30260         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
30261         e_conv = InvalidShutdownScript_clone(&e_conv);
30262         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30263         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
30264         return tag_ptr(ret_conv, true);
30265 }
30266
30267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30268         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
30269         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
30270         return ret_conv;
30271 }
30272
30273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30274         if (!ptr_is_owned(_res)) return;
30275         void* _res_ptr = untag_ptr(_res);
30276         CHECK_ACCESS(_res_ptr);
30277         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
30278         FREE(untag_ptr(_res));
30279         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
30280 }
30281
30282 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
30283         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30284         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
30285         return tag_ptr(ret_conv, true);
30286 }
30287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30288         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
30289         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
30290         return ret_conv;
30291 }
30292
30293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30294         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
30295         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
30296         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
30297         return tag_ptr(ret_conv, true);
30298 }
30299
30300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30301         void* o_ptr = untag_ptr(o);
30302         CHECK_ACCESS(o_ptr);
30303         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
30304         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
30305         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
30306         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
30307         return tag_ptr(ret_conv, true);
30308 }
30309
30310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30311         void* e_ptr = untag_ptr(e);
30312         CHECK_ACCESS(e_ptr);
30313         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30314         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30315         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
30316         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
30317         return tag_ptr(ret_conv, true);
30318 }
30319
30320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30321         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
30322         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
30323         return ret_conv;
30324 }
30325
30326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30327         if (!ptr_is_owned(_res)) return;
30328         void* _res_ptr = untag_ptr(_res);
30329         CHECK_ACCESS(_res_ptr);
30330         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
30331         FREE(untag_ptr(_res));
30332         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
30333 }
30334
30335 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
30336         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
30337         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
30338         return tag_ptr(ret_conv, true);
30339 }
30340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30341         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
30342         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
30343         return ret_conv;
30344 }
30345
30346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30347         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
30348         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
30349         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
30350         return tag_ptr(ret_conv, true);
30351 }
30352
30353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30354         void* o_ptr = untag_ptr(o);
30355         CHECK_ACCESS(o_ptr);
30356         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
30357         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
30358         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
30359         *ret_copy = COption_PathFailureZ_some(o_conv);
30360         int64_t ret_ref = tag_ptr(ret_copy, true);
30361         return ret_ref;
30362 }
30363
30364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
30365         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
30366         *ret_copy = COption_PathFailureZ_none();
30367         int64_t ret_ref = tag_ptr(ret_copy, true);
30368         return ret_ref;
30369 }
30370
30371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30372         if (!ptr_is_owned(_res)) return;
30373         void* _res_ptr = untag_ptr(_res);
30374         CHECK_ACCESS(_res_ptr);
30375         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
30376         FREE(untag_ptr(_res));
30377         COption_PathFailureZ_free(_res_conv);
30378 }
30379
30380 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
30381         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
30382         *ret_copy = COption_PathFailureZ_clone(arg);
30383         int64_t ret_ref = tag_ptr(ret_copy, true);
30384         return ret_ref;
30385 }
30386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30387         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
30388         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
30389         return ret_conv;
30390 }
30391
30392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30393         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
30394         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
30395         *ret_copy = COption_PathFailureZ_clone(orig_conv);
30396         int64_t ret_ref = tag_ptr(ret_copy, true);
30397         return ret_ref;
30398 }
30399
30400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30401         void* o_ptr = untag_ptr(o);
30402         CHECK_ACCESS(o_ptr);
30403         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
30404         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
30405         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
30406         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
30407         return tag_ptr(ret_conv, true);
30408 }
30409
30410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30411         void* e_ptr = untag_ptr(e);
30412         CHECK_ACCESS(e_ptr);
30413         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30414         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30415         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
30416         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
30417         return tag_ptr(ret_conv, true);
30418 }
30419
30420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30421         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
30422         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
30423         return ret_conv;
30424 }
30425
30426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30427         if (!ptr_is_owned(_res)) return;
30428         void* _res_ptr = untag_ptr(_res);
30429         CHECK_ACCESS(_res_ptr);
30430         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
30431         FREE(untag_ptr(_res));
30432         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
30433 }
30434
30435 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
30436         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
30437         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
30438         return tag_ptr(ret_conv, true);
30439 }
30440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30441         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
30442         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
30443         return ret_conv;
30444 }
30445
30446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30447         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
30448         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
30449         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
30450         return tag_ptr(ret_conv, true);
30451 }
30452
30453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30454         void* o_ptr = untag_ptr(o);
30455         CHECK_ACCESS(o_ptr);
30456         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
30457         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
30458         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
30459         *ret_copy = COption_ClosureReasonZ_some(o_conv);
30460         int64_t ret_ref = tag_ptr(ret_copy, true);
30461         return ret_ref;
30462 }
30463
30464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
30465         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
30466         *ret_copy = COption_ClosureReasonZ_none();
30467         int64_t ret_ref = tag_ptr(ret_copy, true);
30468         return ret_ref;
30469 }
30470
30471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30472         if (!ptr_is_owned(_res)) return;
30473         void* _res_ptr = untag_ptr(_res);
30474         CHECK_ACCESS(_res_ptr);
30475         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
30476         FREE(untag_ptr(_res));
30477         COption_ClosureReasonZ_free(_res_conv);
30478 }
30479
30480 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
30481         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
30482         *ret_copy = COption_ClosureReasonZ_clone(arg);
30483         int64_t ret_ref = tag_ptr(ret_copy, true);
30484         return ret_ref;
30485 }
30486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30487         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
30488         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
30489         return ret_conv;
30490 }
30491
30492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30493         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
30494         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
30495         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
30496         int64_t ret_ref = tag_ptr(ret_copy, true);
30497         return ret_ref;
30498 }
30499
30500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30501         void* o_ptr = untag_ptr(o);
30502         CHECK_ACCESS(o_ptr);
30503         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
30504         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
30505         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
30506         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
30507         return tag_ptr(ret_conv, true);
30508 }
30509
30510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30511         void* e_ptr = untag_ptr(e);
30512         CHECK_ACCESS(e_ptr);
30513         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30514         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30515         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
30516         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
30517         return tag_ptr(ret_conv, true);
30518 }
30519
30520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30521         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
30522         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
30523         return ret_conv;
30524 }
30525
30526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30527         if (!ptr_is_owned(_res)) return;
30528         void* _res_ptr = untag_ptr(_res);
30529         CHECK_ACCESS(_res_ptr);
30530         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
30531         FREE(untag_ptr(_res));
30532         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
30533 }
30534
30535 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
30536         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
30537         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
30538         return tag_ptr(ret_conv, true);
30539 }
30540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30541         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
30542         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
30543         return ret_conv;
30544 }
30545
30546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30547         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
30548         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
30549         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
30550         return tag_ptr(ret_conv, true);
30551 }
30552
30553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30554         void* o_ptr = untag_ptr(o);
30555         CHECK_ACCESS(o_ptr);
30556         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
30557         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
30558         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
30559         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
30560         int64_t ret_ref = tag_ptr(ret_copy, true);
30561         return ret_ref;
30562 }
30563
30564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
30565         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
30566         *ret_copy = COption_HTLCDestinationZ_none();
30567         int64_t ret_ref = tag_ptr(ret_copy, true);
30568         return ret_ref;
30569 }
30570
30571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30572         if (!ptr_is_owned(_res)) return;
30573         void* _res_ptr = untag_ptr(_res);
30574         CHECK_ACCESS(_res_ptr);
30575         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
30576         FREE(untag_ptr(_res));
30577         COption_HTLCDestinationZ_free(_res_conv);
30578 }
30579
30580 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
30581         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
30582         *ret_copy = COption_HTLCDestinationZ_clone(arg);
30583         int64_t ret_ref = tag_ptr(ret_copy, true);
30584         return ret_ref;
30585 }
30586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30587         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
30588         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
30589         return ret_conv;
30590 }
30591
30592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30593         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
30594         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
30595         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
30596         int64_t ret_ref = tag_ptr(ret_copy, true);
30597         return ret_ref;
30598 }
30599
30600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30601         void* o_ptr = untag_ptr(o);
30602         CHECK_ACCESS(o_ptr);
30603         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
30604         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
30605         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
30606         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
30607         return tag_ptr(ret_conv, true);
30608 }
30609
30610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30611         void* e_ptr = untag_ptr(e);
30612         CHECK_ACCESS(e_ptr);
30613         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30614         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30615         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
30616         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
30617         return tag_ptr(ret_conv, true);
30618 }
30619
30620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30621         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
30622         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
30623         return ret_conv;
30624 }
30625
30626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30627         if (!ptr_is_owned(_res)) return;
30628         void* _res_ptr = untag_ptr(_res);
30629         CHECK_ACCESS(_res_ptr);
30630         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
30631         FREE(untag_ptr(_res));
30632         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
30633 }
30634
30635 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
30636         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
30637         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
30638         return tag_ptr(ret_conv, true);
30639 }
30640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30641         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
30642         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
30643         return ret_conv;
30644 }
30645
30646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30647         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
30648         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
30649         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
30650         return tag_ptr(ret_conv, true);
30651 }
30652
30653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
30654         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
30655         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
30656         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
30657         return tag_ptr(ret_conv, true);
30658 }
30659
30660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30661         void* e_ptr = untag_ptr(e);
30662         CHECK_ACCESS(e_ptr);
30663         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30664         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30665         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
30666         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
30667         return tag_ptr(ret_conv, true);
30668 }
30669
30670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30671         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
30672         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
30673         return ret_conv;
30674 }
30675
30676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30677         if (!ptr_is_owned(_res)) return;
30678         void* _res_ptr = untag_ptr(_res);
30679         CHECK_ACCESS(_res_ptr);
30680         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
30681         FREE(untag_ptr(_res));
30682         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
30683 }
30684
30685 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
30686         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
30687         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
30688         return tag_ptr(ret_conv, true);
30689 }
30690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30691         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
30692         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
30693         return ret_conv;
30694 }
30695
30696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30697         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
30698         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
30699         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
30700         return tag_ptr(ret_conv, true);
30701 }
30702
30703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
30704         LDKU128 o_ref;
30705         CHECK((*env)->GetArrayLength(env, o) == 16);
30706         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
30707         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
30708         *ret_copy = COption_u128Z_some(o_ref);
30709         int64_t ret_ref = tag_ptr(ret_copy, true);
30710         return ret_ref;
30711 }
30712
30713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1none(JNIEnv *env, jclass clz) {
30714         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
30715         *ret_copy = COption_u128Z_none();
30716         int64_t ret_ref = tag_ptr(ret_copy, true);
30717         return ret_ref;
30718 }
30719
30720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
30721         if (!ptr_is_owned(_res)) return;
30722         void* _res_ptr = untag_ptr(_res);
30723         CHECK_ACCESS(_res_ptr);
30724         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
30725         FREE(untag_ptr(_res));
30726         COption_u128Z_free(_res_conv);
30727 }
30728
30729 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
30730         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
30731         *ret_copy = COption_u128Z_clone(arg);
30732         int64_t ret_ref = tag_ptr(ret_copy, true);
30733         return ret_ref;
30734 }
30735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30736         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
30737         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
30738         return ret_conv;
30739 }
30740
30741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30742         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
30743         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
30744         *ret_copy = COption_u128Z_clone(orig_conv);
30745         int64_t ret_ref = tag_ptr(ret_copy, true);
30746         return ret_ref;
30747 }
30748
30749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
30750         LDKThirtyTwoBytes o_ref;
30751         CHECK((*env)->GetArrayLength(env, o) == 32);
30752         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
30753         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
30754         *ret_copy = COption_PaymentIdZ_some(o_ref);
30755         int64_t ret_ref = tag_ptr(ret_copy, true);
30756         return ret_ref;
30757 }
30758
30759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1none(JNIEnv *env, jclass clz) {
30760         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
30761         *ret_copy = COption_PaymentIdZ_none();
30762         int64_t ret_ref = tag_ptr(ret_copy, true);
30763         return ret_ref;
30764 }
30765
30766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30767         if (!ptr_is_owned(_res)) return;
30768         void* _res_ptr = untag_ptr(_res);
30769         CHECK_ACCESS(_res_ptr);
30770         LDKCOption_PaymentIdZ _res_conv = *(LDKCOption_PaymentIdZ*)(_res_ptr);
30771         FREE(untag_ptr(_res));
30772         COption_PaymentIdZ_free(_res_conv);
30773 }
30774
30775 static inline uint64_t COption_PaymentIdZ_clone_ptr(LDKCOption_PaymentIdZ *NONNULL_PTR arg) {
30776         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
30777         *ret_copy = COption_PaymentIdZ_clone(arg);
30778         int64_t ret_ref = tag_ptr(ret_copy, true);
30779         return ret_ref;
30780 }
30781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30782         LDKCOption_PaymentIdZ* arg_conv = (LDKCOption_PaymentIdZ*)untag_ptr(arg);
30783         int64_t ret_conv = COption_PaymentIdZ_clone_ptr(arg_conv);
30784         return ret_conv;
30785 }
30786
30787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30788         LDKCOption_PaymentIdZ* orig_conv = (LDKCOption_PaymentIdZ*)untag_ptr(orig);
30789         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
30790         *ret_copy = COption_PaymentIdZ_clone(orig_conv);
30791         int64_t ret_ref = tag_ptr(ret_copy, true);
30792         return ret_ref;
30793 }
30794
30795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
30796         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
30797         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
30798         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
30799         int64_t ret_ref = tag_ptr(ret_copy, true);
30800         return ret_ref;
30801 }
30802
30803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
30804         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
30805         *ret_copy = COption_PaymentFailureReasonZ_none();
30806         int64_t ret_ref = tag_ptr(ret_copy, true);
30807         return ret_ref;
30808 }
30809
30810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30811         if (!ptr_is_owned(_res)) return;
30812         void* _res_ptr = untag_ptr(_res);
30813         CHECK_ACCESS(_res_ptr);
30814         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
30815         FREE(untag_ptr(_res));
30816         COption_PaymentFailureReasonZ_free(_res_conv);
30817 }
30818
30819 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
30820         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
30821         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
30822         int64_t ret_ref = tag_ptr(ret_copy, true);
30823         return ret_ref;
30824 }
30825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30826         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
30827         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
30828         return ret_conv;
30829 }
30830
30831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30832         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
30833         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
30834         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
30835         int64_t ret_ref = tag_ptr(ret_copy, true);
30836         return ret_ref;
30837 }
30838
30839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30840         void* o_ptr = untag_ptr(o);
30841         CHECK_ACCESS(o_ptr);
30842         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
30843         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
30844         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
30845         *ret_copy = COption_EventZ_some(o_conv);
30846         int64_t ret_ref = tag_ptr(ret_copy, true);
30847         return ret_ref;
30848 }
30849
30850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
30851         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
30852         *ret_copy = COption_EventZ_none();
30853         int64_t ret_ref = tag_ptr(ret_copy, true);
30854         return ret_ref;
30855 }
30856
30857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30858         if (!ptr_is_owned(_res)) return;
30859         void* _res_ptr = untag_ptr(_res);
30860         CHECK_ACCESS(_res_ptr);
30861         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
30862         FREE(untag_ptr(_res));
30863         COption_EventZ_free(_res_conv);
30864 }
30865
30866 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
30867         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
30868         *ret_copy = COption_EventZ_clone(arg);
30869         int64_t ret_ref = tag_ptr(ret_copy, true);
30870         return ret_ref;
30871 }
30872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30873         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
30874         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
30875         return ret_conv;
30876 }
30877
30878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30879         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
30880         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
30881         *ret_copy = COption_EventZ_clone(orig_conv);
30882         int64_t ret_ref = tag_ptr(ret_copy, true);
30883         return ret_ref;
30884 }
30885
30886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30887         void* o_ptr = untag_ptr(o);
30888         CHECK_ACCESS(o_ptr);
30889         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
30890         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
30891         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
30892         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
30893         return tag_ptr(ret_conv, true);
30894 }
30895
30896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30897         void* e_ptr = untag_ptr(e);
30898         CHECK_ACCESS(e_ptr);
30899         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30900         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30901         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
30902         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
30903         return tag_ptr(ret_conv, true);
30904 }
30905
30906 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30907         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
30908         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
30909         return ret_conv;
30910 }
30911
30912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30913         if (!ptr_is_owned(_res)) return;
30914         void* _res_ptr = untag_ptr(_res);
30915         CHECK_ACCESS(_res_ptr);
30916         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
30917         FREE(untag_ptr(_res));
30918         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
30919 }
30920
30921 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
30922         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
30923         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
30924         return tag_ptr(ret_conv, true);
30925 }
30926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30927         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
30928         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
30929         return ret_conv;
30930 }
30931
30932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30933         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
30934         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
30935         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
30936         return tag_ptr(ret_conv, true);
30937 }
30938
30939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30940         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
30941         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30942         if (_res_constr.datalen > 0)
30943                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
30944         else
30945                 _res_constr.data = NULL;
30946         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30947         for (size_t j = 0; j < _res_constr.datalen; j++) {
30948                 int64_t _res_conv_35 = _res_vals[j];
30949                 void* _res_conv_35_ptr = untag_ptr(_res_conv_35);
30950                 CHECK_ACCESS(_res_conv_35_ptr);
30951                 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
30952                 FREE(untag_ptr(_res_conv_35));
30953                 _res_constr.data[j] = _res_conv_35_conv;
30954         }
30955         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30956         CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
30957 }
30958
30959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
30960         LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
30961         o_constr.datalen = (*env)->GetArrayLength(env, o);
30962         if (o_constr.datalen > 0)
30963                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
30964         else
30965                 o_constr.data = NULL;
30966         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
30967         for (size_t j = 0; j < o_constr.datalen; j++) {
30968                 int64_t o_conv_35 = o_vals[j];
30969                 void* o_conv_35_ptr = untag_ptr(o_conv_35);
30970                 CHECK_ACCESS(o_conv_35_ptr);
30971                 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
30972                 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o_conv_35));
30973                 o_constr.data[j] = o_conv_35_conv;
30974         }
30975         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
30976         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
30977         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
30978         return tag_ptr(ret_conv, true);
30979 }
30980
30981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30982         LDKIOError e_conv = LDKIOError_from_java(env, e);
30983         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
30984         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
30985         return tag_ptr(ret_conv, true);
30986 }
30987
30988 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30989         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(o);
30990         jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
30991         return ret_conv;
30992 }
30993
30994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30995         if (!ptr_is_owned(_res)) return;
30996         void* _res_ptr = untag_ptr(_res);
30997         CHECK_ACCESS(_res_ptr);
30998         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
30999         FREE(untag_ptr(_res));
31000         CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
31001 }
31002
31003 static inline uint64_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
31004         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
31005         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
31006         return tag_ptr(ret_conv, true);
31007 }
31008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31009         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(arg);
31010         int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
31011         return ret_conv;
31012 }
31013
31014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31015         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)untag_ptr(orig);
31016         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
31017         *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
31018         return tag_ptr(ret_conv, true);
31019 }
31020
31021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
31022         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
31023         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
31024         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
31025         return tag_ptr(ret_conv, true);
31026 }
31027
31028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31029         void* e_ptr = untag_ptr(e);
31030         CHECK_ACCESS(e_ptr);
31031         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
31032         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
31033         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
31034         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
31035         return tag_ptr(ret_conv, true);
31036 }
31037
31038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31039         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
31040         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
31041         return ret_conv;
31042 }
31043
31044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31045         if (!ptr_is_owned(_res)) return;
31046         void* _res_ptr = untag_ptr(_res);
31047         CHECK_ACCESS(_res_ptr);
31048         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
31049         FREE(untag_ptr(_res));
31050         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
31051 }
31052
31053 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
31054         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
31055         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
31056         return tag_ptr(ret_conv, true);
31057 }
31058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31059         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
31060         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
31061         return ret_conv;
31062 }
31063
31064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31065         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
31066         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
31067         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
31068         return tag_ptr(ret_conv, true);
31069 }
31070
31071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31072         LDKBolt11Invoice o_conv;
31073         o_conv.inner = untag_ptr(o);
31074         o_conv.is_owned = ptr_is_owned(o);
31075         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31076         o_conv = Bolt11Invoice_clone(&o_conv);
31077         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
31078         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
31079         return tag_ptr(ret_conv, true);
31080 }
31081
31082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31083         void* e_ptr = untag_ptr(e);
31084         CHECK_ACCESS(e_ptr);
31085         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
31086         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
31087         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
31088         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
31089         return tag_ptr(ret_conv, true);
31090 }
31091
31092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31093         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
31094         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
31095         return ret_conv;
31096 }
31097
31098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31099         if (!ptr_is_owned(_res)) return;
31100         void* _res_ptr = untag_ptr(_res);
31101         CHECK_ACCESS(_res_ptr);
31102         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
31103         FREE(untag_ptr(_res));
31104         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
31105 }
31106
31107 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
31108         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
31109         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
31110         return tag_ptr(ret_conv, true);
31111 }
31112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31113         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
31114         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
31115         return ret_conv;
31116 }
31117
31118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31119         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
31120         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
31121         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
31122         return tag_ptr(ret_conv, true);
31123 }
31124
31125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31126         LDKSignedRawBolt11Invoice o_conv;
31127         o_conv.inner = untag_ptr(o);
31128         o_conv.is_owned = ptr_is_owned(o);
31129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31130         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
31131         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
31132         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
31133         return tag_ptr(ret_conv, true);
31134 }
31135
31136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31137         void* e_ptr = untag_ptr(e);
31138         CHECK_ACCESS(e_ptr);
31139         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
31140         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
31141         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
31142         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
31143         return tag_ptr(ret_conv, true);
31144 }
31145
31146 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31147         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
31148         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
31149         return ret_conv;
31150 }
31151
31152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31153         if (!ptr_is_owned(_res)) return;
31154         void* _res_ptr = untag_ptr(_res);
31155         CHECK_ACCESS(_res_ptr);
31156         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
31157         FREE(untag_ptr(_res));
31158         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
31159 }
31160
31161 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
31162         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
31163         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
31164         return tag_ptr(ret_conv, true);
31165 }
31166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31167         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
31168         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
31169         return ret_conv;
31170 }
31171
31172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31173         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
31174         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
31175         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
31176         return tag_ptr(ret_conv, true);
31177 }
31178
31179 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
31180         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
31181         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
31182         return tag_ptr(ret_conv, true);
31183 }
31184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31185         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
31186         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
31187         return ret_conv;
31188 }
31189
31190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31191         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
31192         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
31193         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
31194         return tag_ptr(ret_conv, true);
31195 }
31196
31197 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) {
31198         LDKRawBolt11Invoice a_conv;
31199         a_conv.inner = untag_ptr(a);
31200         a_conv.is_owned = ptr_is_owned(a);
31201         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31202         a_conv = RawBolt11Invoice_clone(&a_conv);
31203         LDKThirtyTwoBytes b_ref;
31204         CHECK((*env)->GetArrayLength(env, b) == 32);
31205         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
31206         LDKBolt11InvoiceSignature c_conv;
31207         c_conv.inner = untag_ptr(c);
31208         c_conv.is_owned = ptr_is_owned(c);
31209         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
31210         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
31211         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
31212         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
31213         return tag_ptr(ret_conv, true);
31214 }
31215
31216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31217         if (!ptr_is_owned(_res)) return;
31218         void* _res_ptr = untag_ptr(_res);
31219         CHECK_ACCESS(_res_ptr);
31220         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
31221         FREE(untag_ptr(_res));
31222         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
31223 }
31224
31225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31226         LDKPayeePubKey o_conv;
31227         o_conv.inner = untag_ptr(o);
31228         o_conv.is_owned = ptr_is_owned(o);
31229         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31230         o_conv = PayeePubKey_clone(&o_conv);
31231         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
31232         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
31233         return tag_ptr(ret_conv, true);
31234 }
31235
31236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31237         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
31238         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
31239         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
31240         return tag_ptr(ret_conv, true);
31241 }
31242
31243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31244         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
31245         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
31246         return ret_conv;
31247 }
31248
31249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31250         if (!ptr_is_owned(_res)) return;
31251         void* _res_ptr = untag_ptr(_res);
31252         CHECK_ACCESS(_res_ptr);
31253         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
31254         FREE(untag_ptr(_res));
31255         CResult_PayeePubKeyErrorZ_free(_res_conv);
31256 }
31257
31258 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
31259         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
31260         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
31261         return tag_ptr(ret_conv, true);
31262 }
31263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31264         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
31265         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
31266         return ret_conv;
31267 }
31268
31269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31270         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
31271         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
31272         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
31273         return tag_ptr(ret_conv, true);
31274 }
31275
31276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31277         LDKCVec_PrivateRouteZ _res_constr;
31278         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31279         if (_res_constr.datalen > 0)
31280                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
31281         else
31282                 _res_constr.data = NULL;
31283         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31284         for (size_t o = 0; o < _res_constr.datalen; o++) {
31285                 int64_t _res_conv_14 = _res_vals[o];
31286                 LDKPrivateRoute _res_conv_14_conv;
31287                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
31288                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
31289                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
31290                 _res_constr.data[o] = _res_conv_14_conv;
31291         }
31292         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31293         CVec_PrivateRouteZ_free(_res_constr);
31294 }
31295
31296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31297         LDKPositiveTimestamp o_conv;
31298         o_conv.inner = untag_ptr(o);
31299         o_conv.is_owned = ptr_is_owned(o);
31300         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31301         o_conv = PositiveTimestamp_clone(&o_conv);
31302         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31303         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
31304         return tag_ptr(ret_conv, true);
31305 }
31306
31307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31308         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
31309         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31310         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
31311         return tag_ptr(ret_conv, true);
31312 }
31313
31314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31315         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
31316         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
31317         return ret_conv;
31318 }
31319
31320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31321         if (!ptr_is_owned(_res)) return;
31322         void* _res_ptr = untag_ptr(_res);
31323         CHECK_ACCESS(_res_ptr);
31324         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
31325         FREE(untag_ptr(_res));
31326         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
31327 }
31328
31329 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
31330         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31331         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
31332         return tag_ptr(ret_conv, true);
31333 }
31334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31335         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
31336         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
31337         return ret_conv;
31338 }
31339
31340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31341         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
31342         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
31343         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
31344         return tag_ptr(ret_conv, true);
31345 }
31346
31347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
31348         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
31349         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
31350         return tag_ptr(ret_conv, true);
31351 }
31352
31353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31354         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
31355         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
31356         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
31357         return tag_ptr(ret_conv, true);
31358 }
31359
31360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31361         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
31362         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
31363         return ret_conv;
31364 }
31365
31366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31367         if (!ptr_is_owned(_res)) return;
31368         void* _res_ptr = untag_ptr(_res);
31369         CHECK_ACCESS(_res_ptr);
31370         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
31371         FREE(untag_ptr(_res));
31372         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
31373 }
31374
31375 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
31376         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
31377         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
31378         return tag_ptr(ret_conv, true);
31379 }
31380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31381         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
31382         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
31383         return ret_conv;
31384 }
31385
31386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31387         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
31388         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
31389         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
31390         return tag_ptr(ret_conv, true);
31391 }
31392
31393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31394         LDKBolt11Invoice o_conv;
31395         o_conv.inner = untag_ptr(o);
31396         o_conv.is_owned = ptr_is_owned(o);
31397         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31398         o_conv = Bolt11Invoice_clone(&o_conv);
31399         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
31400         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
31401         return tag_ptr(ret_conv, true);
31402 }
31403
31404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31405         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
31406         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
31407         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
31408         return tag_ptr(ret_conv, true);
31409 }
31410
31411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31412         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
31413         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
31414         return ret_conv;
31415 }
31416
31417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31418         if (!ptr_is_owned(_res)) return;
31419         void* _res_ptr = untag_ptr(_res);
31420         CHECK_ACCESS(_res_ptr);
31421         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
31422         FREE(untag_ptr(_res));
31423         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
31424 }
31425
31426 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
31427         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
31428         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
31429         return tag_ptr(ret_conv, true);
31430 }
31431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31432         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
31433         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
31434         return ret_conv;
31435 }
31436
31437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31438         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
31439         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
31440         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
31441         return tag_ptr(ret_conv, true);
31442 }
31443
31444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1AddressZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
31445         LDKCVec_AddressZ _res_constr;
31446         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31447         if (_res_constr.datalen > 0)
31448                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_AddressZ Elements");
31449         else
31450                 _res_constr.data = NULL;
31451         for (size_t i = 0; i < _res_constr.datalen; i++) {
31452                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
31453                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
31454                 _res_constr.data[i] = dummy;
31455         }
31456         CVec_AddressZ_free(_res_constr);
31457 }
31458
31459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31460         LDKDescription o_conv;
31461         o_conv.inner = untag_ptr(o);
31462         o_conv.is_owned = ptr_is_owned(o);
31463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31464         o_conv = Description_clone(&o_conv);
31465         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
31466         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
31467         return tag_ptr(ret_conv, true);
31468 }
31469
31470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31471         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
31472         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
31473         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
31474         return tag_ptr(ret_conv, true);
31475 }
31476
31477 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31478         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
31479         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
31480         return ret_conv;
31481 }
31482
31483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31484         if (!ptr_is_owned(_res)) return;
31485         void* _res_ptr = untag_ptr(_res);
31486         CHECK_ACCESS(_res_ptr);
31487         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
31488         FREE(untag_ptr(_res));
31489         CResult_DescriptionCreationErrorZ_free(_res_conv);
31490 }
31491
31492 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
31493         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
31494         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
31495         return tag_ptr(ret_conv, true);
31496 }
31497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31498         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
31499         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
31500         return ret_conv;
31501 }
31502
31503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31504         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
31505         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
31506         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
31507         return tag_ptr(ret_conv, true);
31508 }
31509
31510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31511         LDKPrivateRoute o_conv;
31512         o_conv.inner = untag_ptr(o);
31513         o_conv.is_owned = ptr_is_owned(o);
31514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31515         o_conv = PrivateRoute_clone(&o_conv);
31516         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
31517         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
31518         return tag_ptr(ret_conv, true);
31519 }
31520
31521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31522         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
31523         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
31524         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
31525         return tag_ptr(ret_conv, true);
31526 }
31527
31528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31529         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
31530         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
31531         return ret_conv;
31532 }
31533
31534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31535         if (!ptr_is_owned(_res)) return;
31536         void* _res_ptr = untag_ptr(_res);
31537         CHECK_ACCESS(_res_ptr);
31538         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
31539         FREE(untag_ptr(_res));
31540         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
31541 }
31542
31543 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
31544         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
31545         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
31546         return tag_ptr(ret_conv, true);
31547 }
31548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31549         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
31550         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
31551         return ret_conv;
31552 }
31553
31554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31555         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
31556         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
31557         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
31558         return tag_ptr(ret_conv, true);
31559 }
31560
31561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31562         LDKOutPoint o_conv;
31563         o_conv.inner = untag_ptr(o);
31564         o_conv.is_owned = ptr_is_owned(o);
31565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31566         o_conv = OutPoint_clone(&o_conv);
31567         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31568         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
31569         return tag_ptr(ret_conv, true);
31570 }
31571
31572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31573         void* e_ptr = untag_ptr(e);
31574         CHECK_ACCESS(e_ptr);
31575         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31576         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31577         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31578         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
31579         return tag_ptr(ret_conv, true);
31580 }
31581
31582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31583         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
31584         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
31585         return ret_conv;
31586 }
31587
31588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31589         if (!ptr_is_owned(_res)) return;
31590         void* _res_ptr = untag_ptr(_res);
31591         CHECK_ACCESS(_res_ptr);
31592         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
31593         FREE(untag_ptr(_res));
31594         CResult_OutPointDecodeErrorZ_free(_res_conv);
31595 }
31596
31597 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
31598         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31599         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
31600         return tag_ptr(ret_conv, true);
31601 }
31602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31603         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
31604         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
31605         return ret_conv;
31606 }
31607
31608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31609         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
31610         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31611         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
31612         return tag_ptr(ret_conv, true);
31613 }
31614
31615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31616         LDKBigSize o_conv;
31617         o_conv.inner = untag_ptr(o);
31618         o_conv.is_owned = ptr_is_owned(o);
31619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31620         o_conv = BigSize_clone(&o_conv);
31621         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31622         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
31623         return tag_ptr(ret_conv, true);
31624 }
31625
31626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31627         void* e_ptr = untag_ptr(e);
31628         CHECK_ACCESS(e_ptr);
31629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31631         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31632         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
31633         return tag_ptr(ret_conv, true);
31634 }
31635
31636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31637         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
31638         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
31639         return ret_conv;
31640 }
31641
31642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31643         if (!ptr_is_owned(_res)) return;
31644         void* _res_ptr = untag_ptr(_res);
31645         CHECK_ACCESS(_res_ptr);
31646         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
31647         FREE(untag_ptr(_res));
31648         CResult_BigSizeDecodeErrorZ_free(_res_conv);
31649 }
31650
31651 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
31652         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31653         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
31654         return tag_ptr(ret_conv, true);
31655 }
31656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31657         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
31658         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
31659         return ret_conv;
31660 }
31661
31662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31663         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
31664         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
31665         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
31666         return tag_ptr(ret_conv, true);
31667 }
31668
31669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31670         LDKHostname o_conv;
31671         o_conv.inner = untag_ptr(o);
31672         o_conv.is_owned = ptr_is_owned(o);
31673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31674         o_conv = Hostname_clone(&o_conv);
31675         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
31676         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
31677         return tag_ptr(ret_conv, true);
31678 }
31679
31680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31681         void* e_ptr = untag_ptr(e);
31682         CHECK_ACCESS(e_ptr);
31683         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31684         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31685         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
31686         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
31687         return tag_ptr(ret_conv, true);
31688 }
31689
31690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31691         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
31692         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
31693         return ret_conv;
31694 }
31695
31696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31697         if (!ptr_is_owned(_res)) return;
31698         void* _res_ptr = untag_ptr(_res);
31699         CHECK_ACCESS(_res_ptr);
31700         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
31701         FREE(untag_ptr(_res));
31702         CResult_HostnameDecodeErrorZ_free(_res_conv);
31703 }
31704
31705 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
31706         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
31707         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
31708         return tag_ptr(ret_conv, true);
31709 }
31710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31711         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
31712         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
31713         return ret_conv;
31714 }
31715
31716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31717         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
31718         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
31719         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
31720         return tag_ptr(ret_conv, true);
31721 }
31722
31723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31724         LDKTransactionU16LenLimited o_conv;
31725         o_conv.inner = untag_ptr(o);
31726         o_conv.is_owned = ptr_is_owned(o);
31727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31728         o_conv = TransactionU16LenLimited_clone(&o_conv);
31729         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
31730         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
31731         return tag_ptr(ret_conv, true);
31732 }
31733
31734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
31735         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
31736         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
31737         return tag_ptr(ret_conv, true);
31738 }
31739
31740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31741         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
31742         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
31743         return ret_conv;
31744 }
31745
31746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31747         if (!ptr_is_owned(_res)) return;
31748         void* _res_ptr = untag_ptr(_res);
31749         CHECK_ACCESS(_res_ptr);
31750         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
31751         FREE(untag_ptr(_res));
31752         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
31753 }
31754
31755 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
31756         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
31757         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
31758         return tag_ptr(ret_conv, true);
31759 }
31760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31761         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
31762         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
31763         return ret_conv;
31764 }
31765
31766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31767         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
31768         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
31769         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
31770         return tag_ptr(ret_conv, true);
31771 }
31772
31773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31774         LDKTransactionU16LenLimited o_conv;
31775         o_conv.inner = untag_ptr(o);
31776         o_conv.is_owned = ptr_is_owned(o);
31777         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31778         o_conv = TransactionU16LenLimited_clone(&o_conv);
31779         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
31780         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
31781         return tag_ptr(ret_conv, true);
31782 }
31783
31784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31785         void* e_ptr = untag_ptr(e);
31786         CHECK_ACCESS(e_ptr);
31787         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31788         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31789         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
31790         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
31791         return tag_ptr(ret_conv, true);
31792 }
31793
31794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31795         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
31796         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
31797         return ret_conv;
31798 }
31799
31800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31801         if (!ptr_is_owned(_res)) return;
31802         void* _res_ptr = untag_ptr(_res);
31803         CHECK_ACCESS(_res_ptr);
31804         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
31805         FREE(untag_ptr(_res));
31806         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
31807 }
31808
31809 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
31810         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
31811         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
31812         return tag_ptr(ret_conv, true);
31813 }
31814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31815         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
31816         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
31817         return ret_conv;
31818 }
31819
31820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31821         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
31822         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
31823         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
31824         return tag_ptr(ret_conv, true);
31825 }
31826
31827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31828         LDKUntrustedString o_conv;
31829         o_conv.inner = untag_ptr(o);
31830         o_conv.is_owned = ptr_is_owned(o);
31831         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31832         o_conv = UntrustedString_clone(&o_conv);
31833         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
31834         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
31835         return tag_ptr(ret_conv, true);
31836 }
31837
31838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31839         void* e_ptr = untag_ptr(e);
31840         CHECK_ACCESS(e_ptr);
31841         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31842         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31843         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
31844         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
31845         return tag_ptr(ret_conv, true);
31846 }
31847
31848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31849         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
31850         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
31851         return ret_conv;
31852 }
31853
31854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31855         if (!ptr_is_owned(_res)) return;
31856         void* _res_ptr = untag_ptr(_res);
31857         CHECK_ACCESS(_res_ptr);
31858         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
31859         FREE(untag_ptr(_res));
31860         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
31861 }
31862
31863 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
31864         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
31865         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
31866         return tag_ptr(ret_conv, true);
31867 }
31868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31869         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
31870         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
31871         return ret_conv;
31872 }
31873
31874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31875         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
31876         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
31877         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
31878         return tag_ptr(ret_conv, true);
31879 }
31880
31881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
31882         LDKThirtyTwoBytes o_ref;
31883         CHECK((*env)->GetArrayLength(env, o) == 32);
31884         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
31885         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
31886         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
31887         return tag_ptr(ret_conv, true);
31888 }
31889
31890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31891         void* e_ptr = untag_ptr(e);
31892         CHECK_ACCESS(e_ptr);
31893         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
31894         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
31895         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
31896         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
31897         return tag_ptr(ret_conv, true);
31898 }
31899
31900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31901         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
31902         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
31903         return ret_conv;
31904 }
31905
31906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31907         if (!ptr_is_owned(_res)) return;
31908         void* _res_ptr = untag_ptr(_res);
31909         CHECK_ACCESS(_res_ptr);
31910         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
31911         FREE(untag_ptr(_res));
31912         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
31913 }
31914
31915 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
31916         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
31917         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
31918         return tag_ptr(ret_conv, true);
31919 }
31920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31921         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
31922         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
31923         return ret_conv;
31924 }
31925
31926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31927         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
31928         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
31929         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
31930         return tag_ptr(ret_conv, true);
31931 }
31932
31933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1ok(JNIEnv *env, jclass clz) {
31934         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
31935         *ret_conv = CResult_NonePaymentErrorZ_ok();
31936         return tag_ptr(ret_conv, true);
31937 }
31938
31939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31940         void* e_ptr = untag_ptr(e);
31941         CHECK_ACCESS(e_ptr);
31942         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
31943         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
31944         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
31945         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
31946         return tag_ptr(ret_conv, true);
31947 }
31948
31949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31950         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
31951         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
31952         return ret_conv;
31953 }
31954
31955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31956         if (!ptr_is_owned(_res)) return;
31957         void* _res_ptr = untag_ptr(_res);
31958         CHECK_ACCESS(_res_ptr);
31959         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
31960         FREE(untag_ptr(_res));
31961         CResult_NonePaymentErrorZ_free(_res_conv);
31962 }
31963
31964 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
31965         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
31966         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
31967         return tag_ptr(ret_conv, true);
31968 }
31969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31970         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
31971         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
31972         return ret_conv;
31973 }
31974
31975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31976         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
31977         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
31978         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
31979         return tag_ptr(ret_conv, true);
31980 }
31981
31982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
31983         LDKStr o_conv = java_to_owned_str(env, o);
31984         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
31985         *ret_conv = CResult_StringErrorZ_ok(o_conv);
31986         return tag_ptr(ret_conv, true);
31987 }
31988
31989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
31990         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
31991         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
31992         *ret_conv = CResult_StringErrorZ_err(e_conv);
31993         return tag_ptr(ret_conv, true);
31994 }
31995
31996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31997         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
31998         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
31999         return ret_conv;
32000 }
32001
32002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32003         if (!ptr_is_owned(_res)) return;
32004         void* _res_ptr = untag_ptr(_res);
32005         CHECK_ACCESS(_res_ptr);
32006         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
32007         FREE(untag_ptr(_res));
32008         CResult_StringErrorZ_free(_res_conv);
32009 }
32010
32011 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
32012         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
32013         *ret_conv = CResult_StringErrorZ_clone(arg);
32014         return tag_ptr(ret_conv, true);
32015 }
32016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32017         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
32018         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
32019         return ret_conv;
32020 }
32021
32022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32023         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
32024         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
32025         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
32026         return tag_ptr(ret_conv, true);
32027 }
32028
32029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32030         void* o_ptr = untag_ptr(o);
32031         CHECK_ACCESS(o_ptr);
32032         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
32033         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
32034         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
32035         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
32036         return tag_ptr(ret_conv, true);
32037 }
32038
32039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32040         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
32041         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
32042         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
32043         return tag_ptr(ret_conv, true);
32044 }
32045
32046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32047         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
32048         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
32049         return ret_conv;
32050 }
32051
32052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32053         if (!ptr_is_owned(_res)) return;
32054         void* _res_ptr = untag_ptr(_res);
32055         CHECK_ACCESS(_res_ptr);
32056         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
32057         FREE(untag_ptr(_res));
32058         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
32059 }
32060
32061 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
32062         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
32063         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
32064         return tag_ptr(ret_conv, true);
32065 }
32066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32067         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
32068         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
32069         return ret_conv;
32070 }
32071
32072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32073         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
32074         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
32075         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
32076         return tag_ptr(ret_conv, true);
32077 }
32078
32079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32080         LDKOnionMessagePath o_conv;
32081         o_conv.inner = untag_ptr(o);
32082         o_conv.is_owned = ptr_is_owned(o);
32083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32084         o_conv = OnionMessagePath_clone(&o_conv);
32085         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
32086         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
32087         return tag_ptr(ret_conv, true);
32088 }
32089
32090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
32091         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
32092         *ret_conv = CResult_OnionMessagePathNoneZ_err();
32093         return tag_ptr(ret_conv, true);
32094 }
32095
32096 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32097         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
32098         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
32099         return ret_conv;
32100 }
32101
32102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32103         if (!ptr_is_owned(_res)) return;
32104         void* _res_ptr = untag_ptr(_res);
32105         CHECK_ACCESS(_res_ptr);
32106         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
32107         FREE(untag_ptr(_res));
32108         CResult_OnionMessagePathNoneZ_free(_res_conv);
32109 }
32110
32111 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
32112         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
32113         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
32114         return tag_ptr(ret_conv, true);
32115 }
32116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32117         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
32118         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
32119         return ret_conv;
32120 }
32121
32122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32123         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
32124         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
32125         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
32126         return tag_ptr(ret_conv, true);
32127 }
32128
32129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) {
32130         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
32131         *ret_conv = CResult_NoneSendErrorZ_ok();
32132         return tag_ptr(ret_conv, true);
32133 }
32134
32135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32136         void* e_ptr = untag_ptr(e);
32137         CHECK_ACCESS(e_ptr);
32138         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
32139         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
32140         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
32141         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
32142         return tag_ptr(ret_conv, true);
32143 }
32144
32145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32146         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
32147         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
32148         return ret_conv;
32149 }
32150
32151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32152         if (!ptr_is_owned(_res)) return;
32153         void* _res_ptr = untag_ptr(_res);
32154         CHECK_ACCESS(_res_ptr);
32155         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
32156         FREE(untag_ptr(_res));
32157         CResult_NoneSendErrorZ_free(_res_conv);
32158 }
32159
32160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32161         LDKBlindedPath o_conv;
32162         o_conv.inner = untag_ptr(o);
32163         o_conv.is_owned = ptr_is_owned(o);
32164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32165         o_conv = BlindedPath_clone(&o_conv);
32166         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
32167         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
32168         return tag_ptr(ret_conv, true);
32169 }
32170
32171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
32172         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
32173         *ret_conv = CResult_BlindedPathNoneZ_err();
32174         return tag_ptr(ret_conv, true);
32175 }
32176
32177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32178         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
32179         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
32180         return ret_conv;
32181 }
32182
32183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32184         if (!ptr_is_owned(_res)) return;
32185         void* _res_ptr = untag_ptr(_res);
32186         CHECK_ACCESS(_res_ptr);
32187         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
32188         FREE(untag_ptr(_res));
32189         CResult_BlindedPathNoneZ_free(_res_conv);
32190 }
32191
32192 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
32193         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
32194         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
32195         return tag_ptr(ret_conv, true);
32196 }
32197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32198         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
32199         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
32200         return ret_conv;
32201 }
32202
32203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32204         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
32205         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
32206         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
32207         return tag_ptr(ret_conv, true);
32208 }
32209
32210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32211         LDKBlindedPath o_conv;
32212         o_conv.inner = untag_ptr(o);
32213         o_conv.is_owned = ptr_is_owned(o);
32214         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32215         o_conv = BlindedPath_clone(&o_conv);
32216         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
32217         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
32218         return tag_ptr(ret_conv, true);
32219 }
32220
32221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32222         void* e_ptr = untag_ptr(e);
32223         CHECK_ACCESS(e_ptr);
32224         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32225         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32226         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
32227         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
32228         return tag_ptr(ret_conv, true);
32229 }
32230
32231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32232         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
32233         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
32234         return ret_conv;
32235 }
32236
32237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32238         if (!ptr_is_owned(_res)) return;
32239         void* _res_ptr = untag_ptr(_res);
32240         CHECK_ACCESS(_res_ptr);
32241         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
32242         FREE(untag_ptr(_res));
32243         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
32244 }
32245
32246 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
32247         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
32248         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
32249         return tag_ptr(ret_conv, true);
32250 }
32251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32252         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
32253         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
32254         return ret_conv;
32255 }
32256
32257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32258         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
32259         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
32260         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
32261         return tag_ptr(ret_conv, true);
32262 }
32263
32264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32265         LDKBlindedHop o_conv;
32266         o_conv.inner = untag_ptr(o);
32267         o_conv.is_owned = ptr_is_owned(o);
32268         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32269         o_conv = BlindedHop_clone(&o_conv);
32270         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
32271         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
32272         return tag_ptr(ret_conv, true);
32273 }
32274
32275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32276         void* e_ptr = untag_ptr(e);
32277         CHECK_ACCESS(e_ptr);
32278         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32279         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32280         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
32281         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
32282         return tag_ptr(ret_conv, true);
32283 }
32284
32285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32286         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
32287         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
32288         return ret_conv;
32289 }
32290
32291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32292         if (!ptr_is_owned(_res)) return;
32293         void* _res_ptr = untag_ptr(_res);
32294         CHECK_ACCESS(_res_ptr);
32295         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
32296         FREE(untag_ptr(_res));
32297         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
32298 }
32299
32300 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
32301         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
32302         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
32303         return tag_ptr(ret_conv, true);
32304 }
32305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32306         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
32307         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
32308         return ret_conv;
32309 }
32310
32311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32312         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
32313         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
32314         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
32315         return tag_ptr(ret_conv, true);
32316 }
32317
32318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32319         LDKInvoiceError o_conv;
32320         o_conv.inner = untag_ptr(o);
32321         o_conv.is_owned = ptr_is_owned(o);
32322         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32323         o_conv = InvoiceError_clone(&o_conv);
32324         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
32325         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
32326         return tag_ptr(ret_conv, true);
32327 }
32328
32329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32330         void* e_ptr = untag_ptr(e);
32331         CHECK_ACCESS(e_ptr);
32332         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32333         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32334         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
32335         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
32336         return tag_ptr(ret_conv, true);
32337 }
32338
32339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32340         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
32341         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
32342         return ret_conv;
32343 }
32344
32345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32346         if (!ptr_is_owned(_res)) return;
32347         void* _res_ptr = untag_ptr(_res);
32348         CHECK_ACCESS(_res_ptr);
32349         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
32350         FREE(untag_ptr(_res));
32351         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
32352 }
32353
32354 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
32355         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
32356         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
32357         return tag_ptr(ret_conv, true);
32358 }
32359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32360         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
32361         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
32362         return ret_conv;
32363 }
32364
32365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32366         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
32367         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
32368         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
32369         return tag_ptr(ret_conv, true);
32370 }
32371
32372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32373         void* o_ptr = untag_ptr(o);
32374         CHECK_ACCESS(o_ptr);
32375         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
32376         if (o_conv.free == LDKFilter_JCalls_free) {
32377                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32378                 LDKFilter_JCalls_cloned(&o_conv);
32379         }
32380         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
32381         *ret_copy = COption_FilterZ_some(o_conv);
32382         int64_t ret_ref = tag_ptr(ret_copy, true);
32383         return ret_ref;
32384 }
32385
32386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
32387         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
32388         *ret_copy = COption_FilterZ_none();
32389         int64_t ret_ref = tag_ptr(ret_copy, true);
32390         return ret_ref;
32391 }
32392
32393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32394         if (!ptr_is_owned(_res)) return;
32395         void* _res_ptr = untag_ptr(_res);
32396         CHECK_ACCESS(_res_ptr);
32397         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
32398         FREE(untag_ptr(_res));
32399         COption_FilterZ_free(_res_conv);
32400 }
32401
32402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32403         LDKLockedChannelMonitor o_conv;
32404         o_conv.inner = untag_ptr(o);
32405         o_conv.is_owned = ptr_is_owned(o);
32406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32407         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
32408         
32409         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
32410         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
32411         return tag_ptr(ret_conv, true);
32412 }
32413
32414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
32415         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
32416         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
32417         return tag_ptr(ret_conv, true);
32418 }
32419
32420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32421         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
32422         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
32423         return ret_conv;
32424 }
32425
32426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32427         if (!ptr_is_owned(_res)) return;
32428         void* _res_ptr = untag_ptr(_res);
32429         CHECK_ACCESS(_res_ptr);
32430         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
32431         FREE(untag_ptr(_res));
32432         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
32433 }
32434
32435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32436         LDKCVec_OutPointZ _res_constr;
32437         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32438         if (_res_constr.datalen > 0)
32439                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
32440         else
32441                 _res_constr.data = NULL;
32442         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32443         for (size_t k = 0; k < _res_constr.datalen; k++) {
32444                 int64_t _res_conv_10 = _res_vals[k];
32445                 LDKOutPoint _res_conv_10_conv;
32446                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
32447                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
32448                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
32449                 _res_constr.data[k] = _res_conv_10_conv;
32450         }
32451         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32452         CVec_OutPointZ_free(_res_constr);
32453 }
32454
32455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32456         LDKCVec_MonitorUpdateIdZ _res_constr;
32457         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32458         if (_res_constr.datalen > 0)
32459                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
32460         else
32461                 _res_constr.data = NULL;
32462         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32463         for (size_t r = 0; r < _res_constr.datalen; r++) {
32464                 int64_t _res_conv_17 = _res_vals[r];
32465                 LDKMonitorUpdateId _res_conv_17_conv;
32466                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
32467                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
32468                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
32469                 _res_constr.data[r] = _res_conv_17_conv;
32470         }
32471         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32472         CVec_MonitorUpdateIdZ_free(_res_constr);
32473 }
32474
32475 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
32476         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
32477         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
32478         return tag_ptr(ret_conv, true);
32479 }
32480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32481         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
32482         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
32483         return ret_conv;
32484 }
32485
32486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32487         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
32488         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
32489         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
32490         return tag_ptr(ret_conv, true);
32491 }
32492
32493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
32494         LDKOutPoint a_conv;
32495         a_conv.inner = untag_ptr(a);
32496         a_conv.is_owned = ptr_is_owned(a);
32497         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32498         a_conv = OutPoint_clone(&a_conv);
32499         LDKCVec_MonitorUpdateIdZ b_constr;
32500         b_constr.datalen = (*env)->GetArrayLength(env, b);
32501         if (b_constr.datalen > 0)
32502                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
32503         else
32504                 b_constr.data = NULL;
32505         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
32506         for (size_t r = 0; r < b_constr.datalen; r++) {
32507                 int64_t b_conv_17 = b_vals[r];
32508                 LDKMonitorUpdateId b_conv_17_conv;
32509                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
32510                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
32511                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
32512                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
32513                 b_constr.data[r] = b_conv_17_conv;
32514         }
32515         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
32516         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
32517         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
32518         return tag_ptr(ret_conv, true);
32519 }
32520
32521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32522         if (!ptr_is_owned(_res)) return;
32523         void* _res_ptr = untag_ptr(_res);
32524         CHECK_ACCESS(_res_ptr);
32525         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
32526         FREE(untag_ptr(_res));
32527         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
32528 }
32529
32530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32531         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
32532         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32533         if (_res_constr.datalen > 0)
32534                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
32535         else
32536                 _res_constr.data = NULL;
32537         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32538         for (size_t p = 0; p < _res_constr.datalen; p++) {
32539                 int64_t _res_conv_41 = _res_vals[p];
32540                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
32541                 CHECK_ACCESS(_res_conv_41_ptr);
32542                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
32543                 FREE(untag_ptr(_res_conv_41));
32544                 _res_constr.data[p] = _res_conv_41_conv;
32545         }
32546         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32547         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
32548 }
32549
32550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32551         if (!ptr_is_owned(this_ptr)) return;
32552         void* this_ptr_ptr = untag_ptr(this_ptr);
32553         CHECK_ACCESS(this_ptr_ptr);
32554         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
32555         FREE(untag_ptr(this_ptr));
32556         APIError_free(this_ptr_conv);
32557 }
32558
32559 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
32560         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32561         *ret_copy = APIError_clone(arg);
32562         int64_t ret_ref = tag_ptr(ret_copy, true);
32563         return ret_ref;
32564 }
32565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32566         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
32567         int64_t ret_conv = APIError_clone_ptr(arg_conv);
32568         return ret_conv;
32569 }
32570
32571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32572         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
32573         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32574         *ret_copy = APIError_clone(orig_conv);
32575         int64_t ret_ref = tag_ptr(ret_copy, true);
32576         return ret_ref;
32577 }
32578
32579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
32580         LDKStr err_conv = java_to_owned_str(env, err);
32581         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32582         *ret_copy = APIError_apimisuse_error(err_conv);
32583         int64_t ret_ref = tag_ptr(ret_copy, true);
32584         return ret_ref;
32585 }
32586
32587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
32588         LDKStr err_conv = java_to_owned_str(env, err);
32589         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32590         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
32591         int64_t ret_ref = tag_ptr(ret_copy, true);
32592         return ret_ref;
32593 }
32594
32595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
32596         LDKStr err_conv = java_to_owned_str(env, err);
32597         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32598         *ret_copy = APIError_invalid_route(err_conv);
32599         int64_t ret_ref = tag_ptr(ret_copy, true);
32600         return ret_ref;
32601 }
32602
32603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
32604         LDKStr err_conv = java_to_owned_str(env, err);
32605         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32606         *ret_copy = APIError_channel_unavailable(err_conv);
32607         int64_t ret_ref = tag_ptr(ret_copy, true);
32608         return ret_ref;
32609 }
32610
32611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
32612         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32613         *ret_copy = APIError_monitor_update_in_progress();
32614         int64_t ret_ref = tag_ptr(ret_copy, true);
32615         return ret_ref;
32616 }
32617
32618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
32619         LDKShutdownScript script_conv;
32620         script_conv.inner = untag_ptr(script);
32621         script_conv.is_owned = ptr_is_owned(script);
32622         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
32623         script_conv = ShutdownScript_clone(&script_conv);
32624         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
32625         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
32626         int64_t ret_ref = tag_ptr(ret_copy, true);
32627         return ret_ref;
32628 }
32629
32630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32631         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
32632         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
32633         jboolean ret_conv = APIError_eq(a_conv, b_conv);
32634         return ret_conv;
32635 }
32636
32637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
32638         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
32639         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
32640         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32641         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32642         CVec_u8Z_free(ret_var);
32643         return ret_arr;
32644 }
32645
32646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32647         LDKu8slice ser_ref;
32648         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32649         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32650         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
32651         *ret_conv = APIError_read(ser_ref);
32652         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32653         return tag_ptr(ret_conv, true);
32654 }
32655
32656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32657         LDKBigSize this_obj_conv;
32658         this_obj_conv.inner = untag_ptr(this_obj);
32659         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32661         BigSize_free(this_obj_conv);
32662 }
32663
32664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
32665         LDKBigSize this_ptr_conv;
32666         this_ptr_conv.inner = untag_ptr(this_ptr);
32667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32669         this_ptr_conv.is_owned = false;
32670         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
32671         return ret_conv;
32672 }
32673
32674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32675         LDKBigSize this_ptr_conv;
32676         this_ptr_conv.inner = untag_ptr(this_ptr);
32677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32679         this_ptr_conv.is_owned = false;
32680         BigSize_set_a(&this_ptr_conv, val);
32681 }
32682
32683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
32684         LDKBigSize ret_var = BigSize_new(a_arg);
32685         int64_t ret_ref = 0;
32686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32688         return ret_ref;
32689 }
32690
32691 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
32692         LDKBigSize ret_var = BigSize_clone(arg);
32693         int64_t ret_ref = 0;
32694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32696         return ret_ref;
32697 }
32698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32699         LDKBigSize arg_conv;
32700         arg_conv.inner = untag_ptr(arg);
32701         arg_conv.is_owned = ptr_is_owned(arg);
32702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32703         arg_conv.is_owned = false;
32704         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
32705         return ret_conv;
32706 }
32707
32708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32709         LDKBigSize orig_conv;
32710         orig_conv.inner = untag_ptr(orig);
32711         orig_conv.is_owned = ptr_is_owned(orig);
32712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32713         orig_conv.is_owned = false;
32714         LDKBigSize ret_var = BigSize_clone(&orig_conv);
32715         int64_t ret_ref = 0;
32716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32718         return ret_ref;
32719 }
32720
32721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
32722         LDKBigSize o_conv;
32723         o_conv.inner = untag_ptr(o);
32724         o_conv.is_owned = ptr_is_owned(o);
32725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32726         o_conv.is_owned = false;
32727         int64_t ret_conv = BigSize_hash(&o_conv);
32728         return ret_conv;
32729 }
32730
32731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32732         LDKBigSize a_conv;
32733         a_conv.inner = untag_ptr(a);
32734         a_conv.is_owned = ptr_is_owned(a);
32735         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32736         a_conv.is_owned = false;
32737         LDKBigSize b_conv;
32738         b_conv.inner = untag_ptr(b);
32739         b_conv.is_owned = ptr_is_owned(b);
32740         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32741         b_conv.is_owned = false;
32742         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
32743         return ret_conv;
32744 }
32745
32746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
32747         LDKBigSize obj_conv;
32748         obj_conv.inner = untag_ptr(obj);
32749         obj_conv.is_owned = ptr_is_owned(obj);
32750         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32751         obj_conv.is_owned = false;
32752         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
32753         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32754         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32755         CVec_u8Z_free(ret_var);
32756         return ret_arr;
32757 }
32758
32759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32760         LDKu8slice ser_ref;
32761         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32762         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32763         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
32764         *ret_conv = BigSize_read(ser_ref);
32765         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32766         return tag_ptr(ret_conv, true);
32767 }
32768
32769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32770         LDKHostname this_obj_conv;
32771         this_obj_conv.inner = untag_ptr(this_obj);
32772         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32774         Hostname_free(this_obj_conv);
32775 }
32776
32777 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
32778         LDKHostname ret_var = Hostname_clone(arg);
32779         int64_t ret_ref = 0;
32780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32782         return ret_ref;
32783 }
32784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32785         LDKHostname arg_conv;
32786         arg_conv.inner = untag_ptr(arg);
32787         arg_conv.is_owned = ptr_is_owned(arg);
32788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32789         arg_conv.is_owned = false;
32790         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
32791         return ret_conv;
32792 }
32793
32794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32795         LDKHostname orig_conv;
32796         orig_conv.inner = untag_ptr(orig);
32797         orig_conv.is_owned = ptr_is_owned(orig);
32798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32799         orig_conv.is_owned = false;
32800         LDKHostname ret_var = Hostname_clone(&orig_conv);
32801         int64_t ret_ref = 0;
32802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32804         return ret_ref;
32805 }
32806
32807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32808         LDKHostname a_conv;
32809         a_conv.inner = untag_ptr(a);
32810         a_conv.is_owned = ptr_is_owned(a);
32811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32812         a_conv.is_owned = false;
32813         LDKHostname b_conv;
32814         b_conv.inner = untag_ptr(b);
32815         b_conv.is_owned = ptr_is_owned(b);
32816         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32817         b_conv.is_owned = false;
32818         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
32819         return ret_conv;
32820 }
32821
32822 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
32823         LDKHostname this_arg_conv;
32824         this_arg_conv.inner = untag_ptr(this_arg);
32825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32827         this_arg_conv.is_owned = false;
32828         int8_t ret_conv = Hostname_len(&this_arg_conv);
32829         return ret_conv;
32830 }
32831
32832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
32833         LDKHostname obj_conv;
32834         obj_conv.inner = untag_ptr(obj);
32835         obj_conv.is_owned = ptr_is_owned(obj);
32836         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32837         obj_conv.is_owned = false;
32838         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
32839         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32840         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32841         CVec_u8Z_free(ret_var);
32842         return ret_arr;
32843 }
32844
32845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32846         LDKu8slice ser_ref;
32847         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32848         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32849         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
32850         *ret_conv = Hostname_read(ser_ref);
32851         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32852         return tag_ptr(ret_conv, true);
32853 }
32854
32855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32856         LDKTransactionU16LenLimited this_obj_conv;
32857         this_obj_conv.inner = untag_ptr(this_obj);
32858         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32860         TransactionU16LenLimited_free(this_obj_conv);
32861 }
32862
32863 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
32864         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
32865         int64_t ret_ref = 0;
32866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32868         return ret_ref;
32869 }
32870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32871         LDKTransactionU16LenLimited arg_conv;
32872         arg_conv.inner = untag_ptr(arg);
32873         arg_conv.is_owned = ptr_is_owned(arg);
32874         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32875         arg_conv.is_owned = false;
32876         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
32877         return ret_conv;
32878 }
32879
32880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32881         LDKTransactionU16LenLimited orig_conv;
32882         orig_conv.inner = untag_ptr(orig);
32883         orig_conv.is_owned = ptr_is_owned(orig);
32884         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32885         orig_conv.is_owned = false;
32886         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
32887         int64_t ret_ref = 0;
32888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32890         return ret_ref;
32891 }
32892
32893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
32894         LDKTransactionU16LenLimited a_conv;
32895         a_conv.inner = untag_ptr(a);
32896         a_conv.is_owned = ptr_is_owned(a);
32897         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32898         a_conv.is_owned = false;
32899         LDKTransactionU16LenLimited b_conv;
32900         b_conv.inner = untag_ptr(b);
32901         b_conv.is_owned = ptr_is_owned(b);
32902         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32903         b_conv.is_owned = false;
32904         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
32905         return ret_conv;
32906 }
32907
32908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
32909         LDKTransaction transaction_ref;
32910         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
32911         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
32912         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
32913         transaction_ref.data_is_owned = true;
32914         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
32915         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
32916         return tag_ptr(ret_conv, true);
32917 }
32918
32919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
32920         LDKTransactionU16LenLimited this_arg_conv;
32921         this_arg_conv.inner = untag_ptr(this_arg);
32922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32924         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
32925         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
32926         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32927         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32928         Transaction_free(ret_var);
32929         return ret_arr;
32930 }
32931
32932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
32933         LDKTransactionU16LenLimited obj_conv;
32934         obj_conv.inner = untag_ptr(obj);
32935         obj_conv.is_owned = ptr_is_owned(obj);
32936         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32937         obj_conv.is_owned = false;
32938         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
32939         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32940         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32941         CVec_u8Z_free(ret_var);
32942         return ret_arr;
32943 }
32944
32945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32946         LDKu8slice ser_ref;
32947         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32948         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32949         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
32950         *ret_conv = TransactionU16LenLimited_read(ser_ref);
32951         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32952         return tag_ptr(ret_conv, true);
32953 }
32954
32955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
32956         LDKu8slice msg_ref;
32957         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
32958         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
32959         uint8_t sk_arr[32];
32960         CHECK((*env)->GetArrayLength(env, sk) == 32);
32961         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
32962         uint8_t (*sk_ref)[32] = &sk_arr;
32963         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
32964         *ret_conv = sign(msg_ref, sk_ref);
32965         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
32966         return tag_ptr(ret_conv, true);
32967 }
32968
32969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
32970         LDKu8slice msg_ref;
32971         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
32972         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
32973         LDKStr sig_conv = java_to_owned_str(env, sig);
32974         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
32975         *ret_conv = recover_pk(msg_ref, sig_conv);
32976         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
32977         return tag_ptr(ret_conv, true);
32978 }
32979
32980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
32981         LDKu8slice msg_ref;
32982         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
32983         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
32984         LDKStr sig_conv = java_to_owned_str(env, sig);
32985         LDKPublicKey pk_ref;
32986         CHECK((*env)->GetArrayLength(env, pk) == 33);
32987         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
32988         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
32989         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
32990         return ret_conv;
32991 }
32992
32993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
32994         LDKu8slice hrp_bytes_ref;
32995         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
32996         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
32997         LDKCVec_U5Z data_without_signature_constr;
32998         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
32999         if (data_without_signature_constr.datalen > 0)
33000                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
33001         else
33002                 data_without_signature_constr.data = NULL;
33003         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
33004         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
33005                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
33006                 
33007                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
33008         }
33009         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
33010         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
33011         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33012         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33013         CVec_u8Z_free(ret_var);
33014         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
33015         return ret_arr;
33016 }
33017
33018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33019         if (!ptr_is_owned(this_ptr)) return;
33020         void* this_ptr_ptr = untag_ptr(this_ptr);
33021         CHECK_ACCESS(this_ptr_ptr);
33022         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
33023         FREE(untag_ptr(this_ptr));
33024         Persister_free(this_ptr_conv);
33025 }
33026
33027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33028         LDKUntrustedString this_obj_conv;
33029         this_obj_conv.inner = untag_ptr(this_obj);
33030         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33032         UntrustedString_free(this_obj_conv);
33033 }
33034
33035 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
33036         LDKUntrustedString this_ptr_conv;
33037         this_ptr_conv.inner = untag_ptr(this_ptr);
33038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33040         this_ptr_conv.is_owned = false;
33041         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
33042         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33043         Str_free(ret_str);
33044         return ret_conv;
33045 }
33046
33047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33048         LDKUntrustedString this_ptr_conv;
33049         this_ptr_conv.inner = untag_ptr(this_ptr);
33050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33052         this_ptr_conv.is_owned = false;
33053         LDKStr val_conv = java_to_owned_str(env, val);
33054         UntrustedString_set_a(&this_ptr_conv, val_conv);
33055 }
33056
33057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
33058         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
33059         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
33060         int64_t ret_ref = 0;
33061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33063         return ret_ref;
33064 }
33065
33066 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
33067         LDKUntrustedString ret_var = UntrustedString_clone(arg);
33068         int64_t ret_ref = 0;
33069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33071         return ret_ref;
33072 }
33073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33074         LDKUntrustedString arg_conv;
33075         arg_conv.inner = untag_ptr(arg);
33076         arg_conv.is_owned = ptr_is_owned(arg);
33077         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33078         arg_conv.is_owned = false;
33079         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
33080         return ret_conv;
33081 }
33082
33083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33084         LDKUntrustedString orig_conv;
33085         orig_conv.inner = untag_ptr(orig);
33086         orig_conv.is_owned = ptr_is_owned(orig);
33087         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33088         orig_conv.is_owned = false;
33089         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
33090         int64_t ret_ref = 0;
33091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33093         return ret_ref;
33094 }
33095
33096 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
33097         LDKUntrustedString a_conv;
33098         a_conv.inner = untag_ptr(a);
33099         a_conv.is_owned = ptr_is_owned(a);
33100         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33101         a_conv.is_owned = false;
33102         LDKUntrustedString b_conv;
33103         b_conv.inner = untag_ptr(b);
33104         b_conv.is_owned = ptr_is_owned(b);
33105         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33106         b_conv.is_owned = false;
33107         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
33108         return ret_conv;
33109 }
33110
33111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
33112         LDKUntrustedString obj_conv;
33113         obj_conv.inner = untag_ptr(obj);
33114         obj_conv.is_owned = ptr_is_owned(obj);
33115         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33116         obj_conv.is_owned = false;
33117         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
33118         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33119         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33120         CVec_u8Z_free(ret_var);
33121         return ret_arr;
33122 }
33123
33124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33125         LDKu8slice ser_ref;
33126         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33127         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33128         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
33129         *ret_conv = UntrustedString_read(ser_ref);
33130         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33131         return tag_ptr(ret_conv, true);
33132 }
33133
33134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33135         LDKPrintableString this_obj_conv;
33136         this_obj_conv.inner = untag_ptr(this_obj);
33137         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33139         PrintableString_free(this_obj_conv);
33140 }
33141
33142 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
33143         LDKPrintableString this_ptr_conv;
33144         this_ptr_conv.inner = untag_ptr(this_ptr);
33145         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33147         this_ptr_conv.is_owned = false;
33148         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
33149         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33150         Str_free(ret_str);
33151         return ret_conv;
33152 }
33153
33154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33155         LDKPrintableString this_ptr_conv;
33156         this_ptr_conv.inner = untag_ptr(this_ptr);
33157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33159         this_ptr_conv.is_owned = false;
33160         LDKStr val_conv = java_to_owned_str(env, val);
33161         PrintableString_set_a(&this_ptr_conv, val_conv);
33162 }
33163
33164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
33165         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
33166         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
33167         int64_t ret_ref = 0;
33168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33170         return ret_ref;
33171 }
33172
33173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33174         if (!ptr_is_owned(this_ptr)) return;
33175         void* this_ptr_ptr = untag_ptr(this_ptr);
33176         CHECK_ACCESS(this_ptr_ptr);
33177         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
33178         FREE(untag_ptr(this_ptr));
33179         FutureCallback_free(this_ptr_conv);
33180 }
33181
33182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33183         LDKFuture this_obj_conv;
33184         this_obj_conv.inner = untag_ptr(this_obj);
33185         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33187         Future_free(this_obj_conv);
33188 }
33189
33190 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
33191         LDKFuture ret_var = Future_clone(arg);
33192         int64_t ret_ref = 0;
33193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33195         return ret_ref;
33196 }
33197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33198         LDKFuture arg_conv;
33199         arg_conv.inner = untag_ptr(arg);
33200         arg_conv.is_owned = ptr_is_owned(arg);
33201         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33202         arg_conv.is_owned = false;
33203         int64_t ret_conv = Future_clone_ptr(&arg_conv);
33204         return ret_conv;
33205 }
33206
33207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Future_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33208         LDKFuture orig_conv;
33209         orig_conv.inner = untag_ptr(orig);
33210         orig_conv.is_owned = ptr_is_owned(orig);
33211         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33212         orig_conv.is_owned = false;
33213         LDKFuture ret_var = Future_clone(&orig_conv);
33214         int64_t ret_ref = 0;
33215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33217         return ret_ref;
33218 }
33219
33220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
33221         LDKFuture this_arg_conv;
33222         this_arg_conv.inner = untag_ptr(this_arg);
33223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33225         this_arg_conv.is_owned = false;
33226         void* callback_ptr = untag_ptr(callback);
33227         CHECK_ACCESS(callback_ptr);
33228         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
33229         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
33230                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33231                 LDKFutureCallback_JCalls_cloned(&callback_conv);
33232         }
33233         Future_register_callback_fn(&this_arg_conv, callback_conv);
33234 }
33235
33236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
33237         LDKFuture this_arg_conv;
33238         this_arg_conv.inner = untag_ptr(this_arg);
33239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33241         this_arg_conv = Future_clone(&this_arg_conv);
33242         Future_wait(this_arg_conv);
33243 }
33244
33245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
33246         LDKFuture this_arg_conv;
33247         this_arg_conv.inner = untag_ptr(this_arg);
33248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33250         this_arg_conv = Future_clone(&this_arg_conv);
33251         jboolean ret_conv = Future_wait_timeout(this_arg_conv, max_wait);
33252         return ret_conv;
33253 }
33254
33255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33256         LDKSleeper this_obj_conv;
33257         this_obj_conv.inner = untag_ptr(this_obj);
33258         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33260         Sleeper_free(this_obj_conv);
33261 }
33262
33263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
33264         LDKFuture future_conv;
33265         future_conv.inner = untag_ptr(future);
33266         future_conv.is_owned = ptr_is_owned(future);
33267         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
33268         future_conv = Future_clone(&future_conv);
33269         LDKSleeper ret_var = Sleeper_from_single_future(future_conv);
33270         int64_t ret_ref = 0;
33271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33273         return ret_ref;
33274 }
33275
33276 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) {
33277         LDKFuture fut_a_conv;
33278         fut_a_conv.inner = untag_ptr(fut_a);
33279         fut_a_conv.is_owned = ptr_is_owned(fut_a);
33280         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
33281         fut_a_conv = Future_clone(&fut_a_conv);
33282         LDKFuture fut_b_conv;
33283         fut_b_conv.inner = untag_ptr(fut_b);
33284         fut_b_conv.is_owned = ptr_is_owned(fut_b);
33285         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
33286         fut_b_conv = Future_clone(&fut_b_conv);
33287         LDKSleeper ret_var = Sleeper_from_two_futures(fut_a_conv, fut_b_conv);
33288         int64_t ret_ref = 0;
33289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33291         return ret_ref;
33292 }
33293
33294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
33295         LDKCVec_FutureZ futures_constr;
33296         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
33297         if (futures_constr.datalen > 0)
33298                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
33299         else
33300                 futures_constr.data = NULL;
33301         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
33302         for (size_t i = 0; i < futures_constr.datalen; i++) {
33303                 int64_t futures_conv_8 = futures_vals[i];
33304                 LDKFuture futures_conv_8_conv;
33305                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
33306                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
33307                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
33308                 futures_conv_8_conv = Future_clone(&futures_conv_8_conv);
33309                 futures_constr.data[i] = futures_conv_8_conv;
33310         }
33311         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
33312         LDKSleeper ret_var = Sleeper_new(futures_constr);
33313         int64_t ret_ref = 0;
33314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33316         return ret_ref;
33317 }
33318
33319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
33320         LDKSleeper this_arg_conv;
33321         this_arg_conv.inner = untag_ptr(this_arg);
33322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33324         this_arg_conv.is_owned = false;
33325         Sleeper_wait(&this_arg_conv);
33326 }
33327
33328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
33329         LDKSleeper this_arg_conv;
33330         this_arg_conv.inner = untag_ptr(this_arg);
33331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33333         this_arg_conv.is_owned = false;
33334         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
33335         return ret_conv;
33336 }
33337
33338 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33339         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
33340         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
33341         return ret_conv;
33342 }
33343
33344 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
33345         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
33346         return ret_conv;
33347 }
33348
33349 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
33350         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
33351         return ret_conv;
33352 }
33353
33354 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
33355         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
33356         return ret_conv;
33357 }
33358
33359 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
33360         jclass ret_conv = LDKLevel_to_java(env, Level_info());
33361         return ret_conv;
33362 }
33363
33364 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
33365         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
33366         return ret_conv;
33367 }
33368
33369 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
33370         jclass ret_conv = LDKLevel_to_java(env, Level_error());
33371         return ret_conv;
33372 }
33373
33374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
33375         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
33376         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
33377         jboolean ret_conv = Level_eq(a_conv, b_conv);
33378         return ret_conv;
33379 }
33380
33381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
33382         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
33383         int64_t ret_conv = Level_hash(o_conv);
33384         return ret_conv;
33385 }
33386
33387 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
33388         jclass ret_conv = LDKLevel_to_java(env, Level_max());
33389         return ret_conv;
33390 }
33391
33392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33393         LDKRecord this_obj_conv;
33394         this_obj_conv.inner = untag_ptr(this_obj);
33395         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33397         Record_free(this_obj_conv);
33398 }
33399
33400 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
33401         LDKRecord this_ptr_conv;
33402         this_ptr_conv.inner = untag_ptr(this_ptr);
33403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33405         this_ptr_conv.is_owned = false;
33406         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
33407         return ret_conv;
33408 }
33409
33410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
33411         LDKRecord this_ptr_conv;
33412         this_ptr_conv.inner = untag_ptr(this_ptr);
33413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33415         this_ptr_conv.is_owned = false;
33416         LDKLevel val_conv = LDKLevel_from_java(env, val);
33417         Record_set_level(&this_ptr_conv, val_conv);
33418 }
33419
33420 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
33421         LDKRecord this_ptr_conv;
33422         this_ptr_conv.inner = untag_ptr(this_ptr);
33423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33425         this_ptr_conv.is_owned = false;
33426         LDKStr ret_str = Record_get_args(&this_ptr_conv);
33427         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33428         Str_free(ret_str);
33429         return ret_conv;
33430 }
33431
33432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33433         LDKRecord this_ptr_conv;
33434         this_ptr_conv.inner = untag_ptr(this_ptr);
33435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33437         this_ptr_conv.is_owned = false;
33438         LDKStr val_conv = java_to_owned_str(env, val);
33439         Record_set_args(&this_ptr_conv, val_conv);
33440 }
33441
33442 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
33443         LDKRecord this_ptr_conv;
33444         this_ptr_conv.inner = untag_ptr(this_ptr);
33445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33447         this_ptr_conv.is_owned = false;
33448         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
33449         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33450         Str_free(ret_str);
33451         return ret_conv;
33452 }
33453
33454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33455         LDKRecord this_ptr_conv;
33456         this_ptr_conv.inner = untag_ptr(this_ptr);
33457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33459         this_ptr_conv.is_owned = false;
33460         LDKStr val_conv = java_to_owned_str(env, val);
33461         Record_set_module_path(&this_ptr_conv, val_conv);
33462 }
33463
33464 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
33465         LDKRecord this_ptr_conv;
33466         this_ptr_conv.inner = untag_ptr(this_ptr);
33467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33469         this_ptr_conv.is_owned = false;
33470         LDKStr ret_str = Record_get_file(&this_ptr_conv);
33471         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
33472         Str_free(ret_str);
33473         return ret_conv;
33474 }
33475
33476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
33477         LDKRecord this_ptr_conv;
33478         this_ptr_conv.inner = untag_ptr(this_ptr);
33479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33481         this_ptr_conv.is_owned = false;
33482         LDKStr val_conv = java_to_owned_str(env, val);
33483         Record_set_file(&this_ptr_conv, val_conv);
33484 }
33485
33486 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
33487         LDKRecord this_ptr_conv;
33488         this_ptr_conv.inner = untag_ptr(this_ptr);
33489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33491         this_ptr_conv.is_owned = false;
33492         int32_t ret_conv = Record_get_line(&this_ptr_conv);
33493         return ret_conv;
33494 }
33495
33496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33497         LDKRecord this_ptr_conv;
33498         this_ptr_conv.inner = untag_ptr(this_ptr);
33499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33501         this_ptr_conv.is_owned = false;
33502         Record_set_line(&this_ptr_conv, val);
33503 }
33504
33505 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
33506         LDKRecord ret_var = Record_clone(arg);
33507         int64_t ret_ref = 0;
33508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33510         return ret_ref;
33511 }
33512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33513         LDKRecord arg_conv;
33514         arg_conv.inner = untag_ptr(arg);
33515         arg_conv.is_owned = ptr_is_owned(arg);
33516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33517         arg_conv.is_owned = false;
33518         int64_t ret_conv = Record_clone_ptr(&arg_conv);
33519         return ret_conv;
33520 }
33521
33522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33523         LDKRecord orig_conv;
33524         orig_conv.inner = untag_ptr(orig);
33525         orig_conv.is_owned = ptr_is_owned(orig);
33526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33527         orig_conv.is_owned = false;
33528         LDKRecord ret_var = Record_clone(&orig_conv);
33529         int64_t ret_ref = 0;
33530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33532         return ret_ref;
33533 }
33534
33535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33536         if (!ptr_is_owned(this_ptr)) return;
33537         void* this_ptr_ptr = untag_ptr(this_ptr);
33538         CHECK_ACCESS(this_ptr_ptr);
33539         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
33540         FREE(untag_ptr(this_ptr));
33541         Logger_free(this_ptr_conv);
33542 }
33543
33544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33545         LDKChannelHandshakeConfig this_obj_conv;
33546         this_obj_conv.inner = untag_ptr(this_obj);
33547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33549         ChannelHandshakeConfig_free(this_obj_conv);
33550 }
33551
33552 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
33553         LDKChannelHandshakeConfig this_ptr_conv;
33554         this_ptr_conv.inner = untag_ptr(this_ptr);
33555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33557         this_ptr_conv.is_owned = false;
33558         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
33559         return ret_conv;
33560 }
33561
33562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33563         LDKChannelHandshakeConfig this_ptr_conv;
33564         this_ptr_conv.inner = untag_ptr(this_ptr);
33565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33567         this_ptr_conv.is_owned = false;
33568         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
33569 }
33570
33571 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
33572         LDKChannelHandshakeConfig this_ptr_conv;
33573         this_ptr_conv.inner = untag_ptr(this_ptr);
33574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33576         this_ptr_conv.is_owned = false;
33577         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
33578         return ret_conv;
33579 }
33580
33581 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) {
33582         LDKChannelHandshakeConfig this_ptr_conv;
33583         this_ptr_conv.inner = untag_ptr(this_ptr);
33584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33586         this_ptr_conv.is_owned = false;
33587         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
33588 }
33589
33590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33591         LDKChannelHandshakeConfig this_ptr_conv;
33592         this_ptr_conv.inner = untag_ptr(this_ptr);
33593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33595         this_ptr_conv.is_owned = false;
33596         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
33597         return ret_conv;
33598 }
33599
33600 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) {
33601         LDKChannelHandshakeConfig this_ptr_conv;
33602         this_ptr_conv.inner = untag_ptr(this_ptr);
33603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33605         this_ptr_conv.is_owned = false;
33606         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
33607 }
33608
33609 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) {
33610         LDKChannelHandshakeConfig this_ptr_conv;
33611         this_ptr_conv.inner = untag_ptr(this_ptr);
33612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33614         this_ptr_conv.is_owned = false;
33615         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
33616         return ret_conv;
33617 }
33618
33619 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) {
33620         LDKChannelHandshakeConfig this_ptr_conv;
33621         this_ptr_conv.inner = untag_ptr(this_ptr);
33622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33624         this_ptr_conv.is_owned = false;
33625         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
33626 }
33627
33628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
33629         LDKChannelHandshakeConfig this_ptr_conv;
33630         this_ptr_conv.inner = untag_ptr(this_ptr);
33631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33633         this_ptr_conv.is_owned = false;
33634         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
33635         return ret_conv;
33636 }
33637
33638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33639         LDKChannelHandshakeConfig this_ptr_conv;
33640         this_ptr_conv.inner = untag_ptr(this_ptr);
33641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33643         this_ptr_conv.is_owned = false;
33644         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
33645 }
33646
33647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
33648         LDKChannelHandshakeConfig this_ptr_conv;
33649         this_ptr_conv.inner = untag_ptr(this_ptr);
33650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33652         this_ptr_conv.is_owned = false;
33653         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
33654         return ret_conv;
33655 }
33656
33657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33658         LDKChannelHandshakeConfig this_ptr_conv;
33659         this_ptr_conv.inner = untag_ptr(this_ptr);
33660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33662         this_ptr_conv.is_owned = false;
33663         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
33664 }
33665
33666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
33667         LDKChannelHandshakeConfig this_ptr_conv;
33668         this_ptr_conv.inner = untag_ptr(this_ptr);
33669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33671         this_ptr_conv.is_owned = false;
33672         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
33673         return ret_conv;
33674 }
33675
33676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33677         LDKChannelHandshakeConfig this_ptr_conv;
33678         this_ptr_conv.inner = untag_ptr(this_ptr);
33679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33681         this_ptr_conv.is_owned = false;
33682         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
33683 }
33684
33685 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
33686         LDKChannelHandshakeConfig this_ptr_conv;
33687         this_ptr_conv.inner = untag_ptr(this_ptr);
33688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33690         this_ptr_conv.is_owned = false;
33691         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
33692         return ret_conv;
33693 }
33694
33695 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) {
33696         LDKChannelHandshakeConfig this_ptr_conv;
33697         this_ptr_conv.inner = untag_ptr(this_ptr);
33698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33700         this_ptr_conv.is_owned = false;
33701         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
33702 }
33703
33704 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
33705         LDKChannelHandshakeConfig this_ptr_conv;
33706         this_ptr_conv.inner = untag_ptr(this_ptr);
33707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33709         this_ptr_conv.is_owned = false;
33710         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
33711         return ret_conv;
33712 }
33713
33714 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) {
33715         LDKChannelHandshakeConfig this_ptr_conv;
33716         this_ptr_conv.inner = untag_ptr(this_ptr);
33717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33719         this_ptr_conv.is_owned = false;
33720         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
33721 }
33722
33723 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
33724         LDKChannelHandshakeConfig this_ptr_conv;
33725         this_ptr_conv.inner = untag_ptr(this_ptr);
33726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33728         this_ptr_conv.is_owned = false;
33729         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
33730         return ret_conv;
33731 }
33732
33733 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) {
33734         LDKChannelHandshakeConfig this_ptr_conv;
33735         this_ptr_conv.inner = untag_ptr(this_ptr);
33736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33738         this_ptr_conv.is_owned = false;
33739         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
33740 }
33741
33742 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) {
33743         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);
33744         int64_t ret_ref = 0;
33745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33747         return ret_ref;
33748 }
33749
33750 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
33751         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
33752         int64_t ret_ref = 0;
33753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33755         return ret_ref;
33756 }
33757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33758         LDKChannelHandshakeConfig arg_conv;
33759         arg_conv.inner = untag_ptr(arg);
33760         arg_conv.is_owned = ptr_is_owned(arg);
33761         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33762         arg_conv.is_owned = false;
33763         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
33764         return ret_conv;
33765 }
33766
33767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33768         LDKChannelHandshakeConfig orig_conv;
33769         orig_conv.inner = untag_ptr(orig);
33770         orig_conv.is_owned = ptr_is_owned(orig);
33771         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33772         orig_conv.is_owned = false;
33773         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
33774         int64_t ret_ref = 0;
33775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33777         return ret_ref;
33778 }
33779
33780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
33781         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
33782         int64_t ret_ref = 0;
33783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33785         return ret_ref;
33786 }
33787
33788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33789         LDKChannelHandshakeLimits this_obj_conv;
33790         this_obj_conv.inner = untag_ptr(this_obj);
33791         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33793         ChannelHandshakeLimits_free(this_obj_conv);
33794 }
33795
33796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33797         LDKChannelHandshakeLimits this_ptr_conv;
33798         this_ptr_conv.inner = untag_ptr(this_ptr);
33799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33801         this_ptr_conv.is_owned = false;
33802         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
33803         return ret_conv;
33804 }
33805
33806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33807         LDKChannelHandshakeLimits this_ptr_conv;
33808         this_ptr_conv.inner = untag_ptr(this_ptr);
33809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33811         this_ptr_conv.is_owned = false;
33812         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
33813 }
33814
33815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33816         LDKChannelHandshakeLimits this_ptr_conv;
33817         this_ptr_conv.inner = untag_ptr(this_ptr);
33818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33820         this_ptr_conv.is_owned = false;
33821         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
33822         return ret_conv;
33823 }
33824
33825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33826         LDKChannelHandshakeLimits this_ptr_conv;
33827         this_ptr_conv.inner = untag_ptr(this_ptr);
33828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33830         this_ptr_conv.is_owned = false;
33831         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
33832 }
33833
33834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33835         LDKChannelHandshakeLimits this_ptr_conv;
33836         this_ptr_conv.inner = untag_ptr(this_ptr);
33837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33839         this_ptr_conv.is_owned = false;
33840         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
33841         return ret_conv;
33842 }
33843
33844 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) {
33845         LDKChannelHandshakeLimits this_ptr_conv;
33846         this_ptr_conv.inner = untag_ptr(this_ptr);
33847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33849         this_ptr_conv.is_owned = false;
33850         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
33851 }
33852
33853 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) {
33854         LDKChannelHandshakeLimits this_ptr_conv;
33855         this_ptr_conv.inner = untag_ptr(this_ptr);
33856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33858         this_ptr_conv.is_owned = false;
33859         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
33860         return ret_conv;
33861 }
33862
33863 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) {
33864         LDKChannelHandshakeLimits this_ptr_conv;
33865         this_ptr_conv.inner = untag_ptr(this_ptr);
33866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33868         this_ptr_conv.is_owned = false;
33869         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
33870 }
33871
33872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
33873         LDKChannelHandshakeLimits this_ptr_conv;
33874         this_ptr_conv.inner = untag_ptr(this_ptr);
33875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33877         this_ptr_conv.is_owned = false;
33878         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
33879         return ret_conv;
33880 }
33881
33882 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) {
33883         LDKChannelHandshakeLimits this_ptr_conv;
33884         this_ptr_conv.inner = untag_ptr(this_ptr);
33885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33887         this_ptr_conv.is_owned = false;
33888         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
33889 }
33890
33891 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
33892         LDKChannelHandshakeLimits this_ptr_conv;
33893         this_ptr_conv.inner = untag_ptr(this_ptr);
33894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33896         this_ptr_conv.is_owned = false;
33897         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
33898         return ret_conv;
33899 }
33900
33901 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) {
33902         LDKChannelHandshakeLimits this_ptr_conv;
33903         this_ptr_conv.inner = untag_ptr(this_ptr);
33904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33906         this_ptr_conv.is_owned = false;
33907         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
33908 }
33909
33910 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
33911         LDKChannelHandshakeLimits this_ptr_conv;
33912         this_ptr_conv.inner = untag_ptr(this_ptr);
33913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33915         this_ptr_conv.is_owned = false;
33916         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
33917         return ret_conv;
33918 }
33919
33920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33921         LDKChannelHandshakeLimits this_ptr_conv;
33922         this_ptr_conv.inner = untag_ptr(this_ptr);
33923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33925         this_ptr_conv.is_owned = false;
33926         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
33927 }
33928
33929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
33930         LDKChannelHandshakeLimits this_ptr_conv;
33931         this_ptr_conv.inner = untag_ptr(this_ptr);
33932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33934         this_ptr_conv.is_owned = false;
33935         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
33936         return ret_conv;
33937 }
33938
33939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33940         LDKChannelHandshakeLimits this_ptr_conv;
33941         this_ptr_conv.inner = untag_ptr(this_ptr);
33942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33944         this_ptr_conv.is_owned = false;
33945         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
33946 }
33947
33948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
33949         LDKChannelHandshakeLimits this_ptr_conv;
33950         this_ptr_conv.inner = untag_ptr(this_ptr);
33951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33953         this_ptr_conv.is_owned = false;
33954         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
33955         return ret_conv;
33956 }
33957
33958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33959         LDKChannelHandshakeLimits this_ptr_conv;
33960         this_ptr_conv.inner = untag_ptr(this_ptr);
33961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33963         this_ptr_conv.is_owned = false;
33964         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
33965 }
33966
33967 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
33968         LDKChannelHandshakeLimits this_ptr_conv;
33969         this_ptr_conv.inner = untag_ptr(this_ptr);
33970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33972         this_ptr_conv.is_owned = false;
33973         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
33974         return ret_conv;
33975 }
33976
33977 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) {
33978         LDKChannelHandshakeLimits this_ptr_conv;
33979         this_ptr_conv.inner = untag_ptr(this_ptr);
33980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33982         this_ptr_conv.is_owned = false;
33983         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
33984 }
33985
33986 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) {
33987         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);
33988         int64_t ret_ref = 0;
33989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33991         return ret_ref;
33992 }
33993
33994 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
33995         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
33996         int64_t ret_ref = 0;
33997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33999         return ret_ref;
34000 }
34001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34002         LDKChannelHandshakeLimits arg_conv;
34003         arg_conv.inner = untag_ptr(arg);
34004         arg_conv.is_owned = ptr_is_owned(arg);
34005         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34006         arg_conv.is_owned = false;
34007         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
34008         return ret_conv;
34009 }
34010
34011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34012         LDKChannelHandshakeLimits orig_conv;
34013         orig_conv.inner = untag_ptr(orig);
34014         orig_conv.is_owned = ptr_is_owned(orig);
34015         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34016         orig_conv.is_owned = false;
34017         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
34018         int64_t ret_ref = 0;
34019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34021         return ret_ref;
34022 }
34023
34024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
34025         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
34026         int64_t ret_ref = 0;
34027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34029         return ret_ref;
34030 }
34031
34032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34033         if (!ptr_is_owned(this_ptr)) return;
34034         void* this_ptr_ptr = untag_ptr(this_ptr);
34035         CHECK_ACCESS(this_ptr_ptr);
34036         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
34037         FREE(untag_ptr(this_ptr));
34038         MaxDustHTLCExposure_free(this_ptr_conv);
34039 }
34040
34041 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
34042         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34043         *ret_copy = MaxDustHTLCExposure_clone(arg);
34044         int64_t ret_ref = tag_ptr(ret_copy, true);
34045         return ret_ref;
34046 }
34047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34048         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
34049         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
34050         return ret_conv;
34051 }
34052
34053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34054         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
34055         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34056         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
34057         int64_t ret_ref = tag_ptr(ret_copy, true);
34058         return ret_ref;
34059 }
34060
34061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
34062         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34063         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
34064         int64_t ret_ref = tag_ptr(ret_copy, true);
34065         return ret_ref;
34066 }
34067
34068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
34069         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34070         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
34071         int64_t ret_ref = tag_ptr(ret_copy, true);
34072         return ret_ref;
34073 }
34074
34075 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34076         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
34077         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
34078         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
34079         return ret_conv;
34080 }
34081
34082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
34083         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
34084         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
34085         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34086         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34087         CVec_u8Z_free(ret_var);
34088         return ret_arr;
34089 }
34090
34091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34092         LDKu8slice ser_ref;
34093         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34094         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34095         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
34096         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
34097         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34098         return tag_ptr(ret_conv, true);
34099 }
34100
34101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34102         LDKChannelConfig this_obj_conv;
34103         this_obj_conv.inner = untag_ptr(this_obj);
34104         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34106         ChannelConfig_free(this_obj_conv);
34107 }
34108
34109 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
34110         LDKChannelConfig this_ptr_conv;
34111         this_ptr_conv.inner = untag_ptr(this_ptr);
34112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34114         this_ptr_conv.is_owned = false;
34115         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
34116         return ret_conv;
34117 }
34118
34119 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) {
34120         LDKChannelConfig this_ptr_conv;
34121         this_ptr_conv.inner = untag_ptr(this_ptr);
34122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34124         this_ptr_conv.is_owned = false;
34125         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
34126 }
34127
34128 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34129         LDKChannelConfig this_ptr_conv;
34130         this_ptr_conv.inner = untag_ptr(this_ptr);
34131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34133         this_ptr_conv.is_owned = false;
34134         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
34135         return ret_conv;
34136 }
34137
34138 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) {
34139         LDKChannelConfig this_ptr_conv;
34140         this_ptr_conv.inner = untag_ptr(this_ptr);
34141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34143         this_ptr_conv.is_owned = false;
34144         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
34145 }
34146
34147 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
34148         LDKChannelConfig this_ptr_conv;
34149         this_ptr_conv.inner = untag_ptr(this_ptr);
34150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34152         this_ptr_conv.is_owned = false;
34153         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
34154         return ret_conv;
34155 }
34156
34157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
34158         LDKChannelConfig this_ptr_conv;
34159         this_ptr_conv.inner = untag_ptr(this_ptr);
34160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34162         this_ptr_conv.is_owned = false;
34163         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
34164 }
34165
34166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
34167         LDKChannelConfig this_ptr_conv;
34168         this_ptr_conv.inner = untag_ptr(this_ptr);
34169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34171         this_ptr_conv.is_owned = false;
34172         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
34173         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
34174         int64_t ret_ref = tag_ptr(ret_copy, true);
34175         return ret_ref;
34176 }
34177
34178 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) {
34179         LDKChannelConfig this_ptr_conv;
34180         this_ptr_conv.inner = untag_ptr(this_ptr);
34181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34183         this_ptr_conv.is_owned = false;
34184         void* val_ptr = untag_ptr(val);
34185         CHECK_ACCESS(val_ptr);
34186         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
34187         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
34188         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
34189 }
34190
34191 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) {
34192         LDKChannelConfig this_ptr_conv;
34193         this_ptr_conv.inner = untag_ptr(this_ptr);
34194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34196         this_ptr_conv.is_owned = false;
34197         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
34198         return ret_conv;
34199 }
34200
34201 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) {
34202         LDKChannelConfig this_ptr_conv;
34203         this_ptr_conv.inner = untag_ptr(this_ptr);
34204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34206         this_ptr_conv.is_owned = false;
34207         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
34208 }
34209
34210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34211         LDKChannelConfig this_ptr_conv;
34212         this_ptr_conv.inner = untag_ptr(this_ptr);
34213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34215         this_ptr_conv.is_owned = false;
34216         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
34217         return ret_conv;
34218 }
34219
34220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34221         LDKChannelConfig this_ptr_conv;
34222         this_ptr_conv.inner = untag_ptr(this_ptr);
34223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34225         this_ptr_conv.is_owned = false;
34226         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
34227 }
34228
34229 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) {
34230         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
34231         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
34232         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
34233         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
34234         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);
34235         int64_t ret_ref = 0;
34236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34238         return ret_ref;
34239 }
34240
34241 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
34242         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
34243         int64_t ret_ref = 0;
34244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34246         return ret_ref;
34247 }
34248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34249         LDKChannelConfig arg_conv;
34250         arg_conv.inner = untag_ptr(arg);
34251         arg_conv.is_owned = ptr_is_owned(arg);
34252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34253         arg_conv.is_owned = false;
34254         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
34255         return ret_conv;
34256 }
34257
34258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34259         LDKChannelConfig orig_conv;
34260         orig_conv.inner = untag_ptr(orig);
34261         orig_conv.is_owned = ptr_is_owned(orig);
34262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34263         orig_conv.is_owned = false;
34264         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
34265         int64_t ret_ref = 0;
34266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34268         return ret_ref;
34269 }
34270
34271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34272         LDKChannelConfig a_conv;
34273         a_conv.inner = untag_ptr(a);
34274         a_conv.is_owned = ptr_is_owned(a);
34275         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34276         a_conv.is_owned = false;
34277         LDKChannelConfig b_conv;
34278         b_conv.inner = untag_ptr(b);
34279         b_conv.is_owned = ptr_is_owned(b);
34280         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34281         b_conv.is_owned = false;
34282         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
34283         return ret_conv;
34284 }
34285
34286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
34287         LDKChannelConfig this_arg_conv;
34288         this_arg_conv.inner = untag_ptr(this_arg);
34289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34291         this_arg_conv.is_owned = false;
34292         LDKChannelConfigUpdate update_conv;
34293         update_conv.inner = untag_ptr(update);
34294         update_conv.is_owned = ptr_is_owned(update);
34295         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
34296         update_conv.is_owned = false;
34297         ChannelConfig_apply(&this_arg_conv, &update_conv);
34298 }
34299
34300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
34301         LDKChannelConfig ret_var = ChannelConfig_default();
34302         int64_t ret_ref = 0;
34303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34305         return ret_ref;
34306 }
34307
34308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
34309         LDKChannelConfig obj_conv;
34310         obj_conv.inner = untag_ptr(obj);
34311         obj_conv.is_owned = ptr_is_owned(obj);
34312         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34313         obj_conv.is_owned = false;
34314         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
34315         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34316         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34317         CVec_u8Z_free(ret_var);
34318         return ret_arr;
34319 }
34320
34321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34322         LDKu8slice ser_ref;
34323         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34324         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34325         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
34326         *ret_conv = ChannelConfig_read(ser_ref);
34327         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34328         return tag_ptr(ret_conv, true);
34329 }
34330
34331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34332         LDKChannelConfigUpdate this_obj_conv;
34333         this_obj_conv.inner = untag_ptr(this_obj);
34334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34336         ChannelConfigUpdate_free(this_obj_conv);
34337 }
34338
34339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
34340         LDKChannelConfigUpdate this_ptr_conv;
34341         this_ptr_conv.inner = untag_ptr(this_ptr);
34342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34344         this_ptr_conv.is_owned = false;
34345         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34346         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
34347         int64_t ret_ref = tag_ptr(ret_copy, true);
34348         return ret_ref;
34349 }
34350
34351 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) {
34352         LDKChannelConfigUpdate this_ptr_conv;
34353         this_ptr_conv.inner = untag_ptr(this_ptr);
34354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34356         this_ptr_conv.is_owned = false;
34357         void* val_ptr = untag_ptr(val);
34358         CHECK_ACCESS(val_ptr);
34359         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34360         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34361         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
34362 }
34363
34364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34365         LDKChannelConfigUpdate this_ptr_conv;
34366         this_ptr_conv.inner = untag_ptr(this_ptr);
34367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34369         this_ptr_conv.is_owned = false;
34370         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34371         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
34372         int64_t ret_ref = tag_ptr(ret_copy, true);
34373         return ret_ref;
34374 }
34375
34376 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) {
34377         LDKChannelConfigUpdate this_ptr_conv;
34378         this_ptr_conv.inner = untag_ptr(this_ptr);
34379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34381         this_ptr_conv.is_owned = false;
34382         void* val_ptr = untag_ptr(val);
34383         CHECK_ACCESS(val_ptr);
34384         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34385         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
34386         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
34387 }
34388
34389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
34390         LDKChannelConfigUpdate this_ptr_conv;
34391         this_ptr_conv.inner = untag_ptr(this_ptr);
34392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34394         this_ptr_conv.is_owned = false;
34395         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
34396         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34397         int64_t ret_ref = tag_ptr(ret_copy, true);
34398         return ret_ref;
34399 }
34400
34401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34402         LDKChannelConfigUpdate this_ptr_conv;
34403         this_ptr_conv.inner = untag_ptr(this_ptr);
34404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34406         this_ptr_conv.is_owned = false;
34407         void* val_ptr = untag_ptr(val);
34408         CHECK_ACCESS(val_ptr);
34409         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
34410         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
34411         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
34412 }
34413
34414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34415         LDKChannelConfigUpdate this_ptr_conv;
34416         this_ptr_conv.inner = untag_ptr(this_ptr);
34417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34419         this_ptr_conv.is_owned = false;
34420         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
34421         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
34422         int64_t ret_ref = tag_ptr(ret_copy, true);
34423         return ret_ref;
34424 }
34425
34426 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) {
34427         LDKChannelConfigUpdate this_ptr_conv;
34428         this_ptr_conv.inner = untag_ptr(this_ptr);
34429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34431         this_ptr_conv.is_owned = false;
34432         void* val_ptr = untag_ptr(val);
34433         CHECK_ACCESS(val_ptr);
34434         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
34435         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
34436         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
34437 }
34438
34439 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) {
34440         LDKChannelConfigUpdate this_ptr_conv;
34441         this_ptr_conv.inner = untag_ptr(this_ptr);
34442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34444         this_ptr_conv.is_owned = false;
34445         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
34446         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
34447         int64_t ret_ref = tag_ptr(ret_copy, true);
34448         return ret_ref;
34449 }
34450
34451 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) {
34452         LDKChannelConfigUpdate this_ptr_conv;
34453         this_ptr_conv.inner = untag_ptr(this_ptr);
34454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34456         this_ptr_conv.is_owned = false;
34457         void* val_ptr = untag_ptr(val);
34458         CHECK_ACCESS(val_ptr);
34459         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
34460         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
34461         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
34462 }
34463
34464 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) {
34465         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
34466         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
34467         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
34468         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
34469         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
34470         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
34471         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
34472         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
34473         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
34474         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
34475         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
34476         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
34477         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
34478         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
34479         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
34480         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
34481         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
34482         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
34483         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
34484         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
34485         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);
34486         int64_t ret_ref = 0;
34487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34489         return ret_ref;
34490 }
34491
34492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
34493         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
34494         int64_t ret_ref = 0;
34495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34497         return ret_ref;
34498 }
34499
34500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34501         LDKUserConfig this_obj_conv;
34502         this_obj_conv.inner = untag_ptr(this_obj);
34503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34505         UserConfig_free(this_obj_conv);
34506 }
34507
34508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
34509         LDKUserConfig this_ptr_conv;
34510         this_ptr_conv.inner = untag_ptr(this_ptr);
34511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34513         this_ptr_conv.is_owned = false;
34514         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
34515         int64_t ret_ref = 0;
34516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34518         return ret_ref;
34519 }
34520
34521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34522         LDKUserConfig this_ptr_conv;
34523         this_ptr_conv.inner = untag_ptr(this_ptr);
34524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34526         this_ptr_conv.is_owned = false;
34527         LDKChannelHandshakeConfig val_conv;
34528         val_conv.inner = untag_ptr(val);
34529         val_conv.is_owned = ptr_is_owned(val);
34530         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34531         val_conv = ChannelHandshakeConfig_clone(&val_conv);
34532         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
34533 }
34534
34535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
34536         LDKUserConfig this_ptr_conv;
34537         this_ptr_conv.inner = untag_ptr(this_ptr);
34538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34540         this_ptr_conv.is_owned = false;
34541         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
34542         int64_t ret_ref = 0;
34543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34545         return ret_ref;
34546 }
34547
34548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34549         LDKUserConfig this_ptr_conv;
34550         this_ptr_conv.inner = untag_ptr(this_ptr);
34551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34553         this_ptr_conv.is_owned = false;
34554         LDKChannelHandshakeLimits val_conv;
34555         val_conv.inner = untag_ptr(val);
34556         val_conv.is_owned = ptr_is_owned(val);
34557         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34558         val_conv = ChannelHandshakeLimits_clone(&val_conv);
34559         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
34560 }
34561
34562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
34563         LDKUserConfig this_ptr_conv;
34564         this_ptr_conv.inner = untag_ptr(this_ptr);
34565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34567         this_ptr_conv.is_owned = false;
34568         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
34569         int64_t ret_ref = 0;
34570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34572         return ret_ref;
34573 }
34574
34575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34576         LDKUserConfig this_ptr_conv;
34577         this_ptr_conv.inner = untag_ptr(this_ptr);
34578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34580         this_ptr_conv.is_owned = false;
34581         LDKChannelConfig val_conv;
34582         val_conv.inner = untag_ptr(val);
34583         val_conv.is_owned = ptr_is_owned(val);
34584         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34585         val_conv = ChannelConfig_clone(&val_conv);
34586         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
34587 }
34588
34589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
34590         LDKUserConfig this_ptr_conv;
34591         this_ptr_conv.inner = untag_ptr(this_ptr);
34592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34594         this_ptr_conv.is_owned = false;
34595         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
34596         return ret_conv;
34597 }
34598
34599 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) {
34600         LDKUserConfig this_ptr_conv;
34601         this_ptr_conv.inner = untag_ptr(this_ptr);
34602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34604         this_ptr_conv.is_owned = false;
34605         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
34606 }
34607
34608 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
34609         LDKUserConfig this_ptr_conv;
34610         this_ptr_conv.inner = untag_ptr(this_ptr);
34611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34613         this_ptr_conv.is_owned = false;
34614         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
34615         return ret_conv;
34616 }
34617
34618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34619         LDKUserConfig this_ptr_conv;
34620         this_ptr_conv.inner = untag_ptr(this_ptr);
34621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34623         this_ptr_conv.is_owned = false;
34624         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
34625 }
34626
34627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
34628         LDKUserConfig this_ptr_conv;
34629         this_ptr_conv.inner = untag_ptr(this_ptr);
34630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34632         this_ptr_conv.is_owned = false;
34633         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
34634         return ret_conv;
34635 }
34636
34637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34638         LDKUserConfig this_ptr_conv;
34639         this_ptr_conv.inner = untag_ptr(this_ptr);
34640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34642         this_ptr_conv.is_owned = false;
34643         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
34644 }
34645
34646 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34647         LDKUserConfig this_ptr_conv;
34648         this_ptr_conv.inner = untag_ptr(this_ptr);
34649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34651         this_ptr_conv.is_owned = false;
34652         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
34653         return ret_conv;
34654 }
34655
34656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34657         LDKUserConfig this_ptr_conv;
34658         this_ptr_conv.inner = untag_ptr(this_ptr);
34659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34661         this_ptr_conv.is_owned = false;
34662         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
34663 }
34664
34665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
34666         LDKUserConfig this_ptr_conv;
34667         this_ptr_conv.inner = untag_ptr(this_ptr);
34668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34670         this_ptr_conv.is_owned = false;
34671         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
34672         return ret_conv;
34673 }
34674
34675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34676         LDKUserConfig this_ptr_conv;
34677         this_ptr_conv.inner = untag_ptr(this_ptr);
34678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34680         this_ptr_conv.is_owned = false;
34681         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
34682 }
34683
34684 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) {
34685         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
34686         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
34687         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
34688         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
34689         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
34690         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
34691         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
34692         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
34693         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
34694         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
34695         LDKChannelConfig channel_config_arg_conv;
34696         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
34697         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
34698         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
34699         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
34700         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);
34701         int64_t ret_ref = 0;
34702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34704         return ret_ref;
34705 }
34706
34707 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
34708         LDKUserConfig ret_var = UserConfig_clone(arg);
34709         int64_t ret_ref = 0;
34710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34712         return ret_ref;
34713 }
34714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34715         LDKUserConfig arg_conv;
34716         arg_conv.inner = untag_ptr(arg);
34717         arg_conv.is_owned = ptr_is_owned(arg);
34718         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34719         arg_conv.is_owned = false;
34720         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
34721         return ret_conv;
34722 }
34723
34724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34725         LDKUserConfig orig_conv;
34726         orig_conv.inner = untag_ptr(orig);
34727         orig_conv.is_owned = ptr_is_owned(orig);
34728         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34729         orig_conv.is_owned = false;
34730         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
34731         int64_t ret_ref = 0;
34732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34734         return ret_ref;
34735 }
34736
34737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
34738         LDKUserConfig ret_var = UserConfig_default();
34739         int64_t ret_ref = 0;
34740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34742         return ret_ref;
34743 }
34744
34745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34746         LDKBestBlock this_obj_conv;
34747         this_obj_conv.inner = untag_ptr(this_obj);
34748         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34750         BestBlock_free(this_obj_conv);
34751 }
34752
34753 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
34754         LDKBestBlock ret_var = BestBlock_clone(arg);
34755         int64_t ret_ref = 0;
34756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34758         return ret_ref;
34759 }
34760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34761         LDKBestBlock arg_conv;
34762         arg_conv.inner = untag_ptr(arg);
34763         arg_conv.is_owned = ptr_is_owned(arg);
34764         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34765         arg_conv.is_owned = false;
34766         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
34767         return ret_conv;
34768 }
34769
34770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34771         LDKBestBlock orig_conv;
34772         orig_conv.inner = untag_ptr(orig);
34773         orig_conv.is_owned = ptr_is_owned(orig);
34774         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34775         orig_conv.is_owned = false;
34776         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
34777         int64_t ret_ref = 0;
34778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34780         return ret_ref;
34781 }
34782
34783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34784         LDKBestBlock a_conv;
34785         a_conv.inner = untag_ptr(a);
34786         a_conv.is_owned = ptr_is_owned(a);
34787         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34788         a_conv.is_owned = false;
34789         LDKBestBlock b_conv;
34790         b_conv.inner = untag_ptr(b);
34791         b_conv.is_owned = ptr_is_owned(b);
34792         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34793         b_conv.is_owned = false;
34794         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
34795         return ret_conv;
34796 }
34797
34798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
34799         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
34800         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
34801         int64_t ret_ref = 0;
34802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34804         return ret_ref;
34805 }
34806
34807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
34808         LDKThirtyTwoBytes block_hash_ref;
34809         CHECK((*env)->GetArrayLength(env, block_hash) == 32);
34810         (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
34811         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
34812         int64_t ret_ref = 0;
34813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34815         return ret_ref;
34816 }
34817
34818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
34819         LDKBestBlock this_arg_conv;
34820         this_arg_conv.inner = untag_ptr(this_arg);
34821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34823         this_arg_conv.is_owned = false;
34824         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34825         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
34826         return ret_arr;
34827 }
34828
34829 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
34830         LDKBestBlock this_arg_conv;
34831         this_arg_conv.inner = untag_ptr(this_arg);
34832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34834         this_arg_conv.is_owned = false;
34835         int32_t ret_conv = BestBlock_height(&this_arg_conv);
34836         return ret_conv;
34837 }
34838
34839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34840         if (!ptr_is_owned(this_ptr)) return;
34841         void* this_ptr_ptr = untag_ptr(this_ptr);
34842         CHECK_ACCESS(this_ptr_ptr);
34843         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
34844         FREE(untag_ptr(this_ptr));
34845         Listen_free(this_ptr_conv);
34846 }
34847
34848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34849         if (!ptr_is_owned(this_ptr)) return;
34850         void* this_ptr_ptr = untag_ptr(this_ptr);
34851         CHECK_ACCESS(this_ptr_ptr);
34852         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
34853         FREE(untag_ptr(this_ptr));
34854         Confirm_free(this_ptr_conv);
34855 }
34856
34857 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34858         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
34859         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
34860         return ret_conv;
34861 }
34862
34863 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
34864         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
34865         return ret_conv;
34866 }
34867
34868 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
34869         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
34870         return ret_conv;
34871 }
34872
34873 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1permanent_1failure(JNIEnv *env, jclass clz) {
34874         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_permanent_failure());
34875         return ret_conv;
34876 }
34877
34878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
34879         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
34880         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
34881         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
34882         return ret_conv;
34883 }
34884
34885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34886         if (!ptr_is_owned(this_ptr)) return;
34887         void* this_ptr_ptr = untag_ptr(this_ptr);
34888         CHECK_ACCESS(this_ptr_ptr);
34889         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
34890         FREE(untag_ptr(this_ptr));
34891         Watch_free(this_ptr_conv);
34892 }
34893
34894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34895         if (!ptr_is_owned(this_ptr)) return;
34896         void* this_ptr_ptr = untag_ptr(this_ptr);
34897         CHECK_ACCESS(this_ptr_ptr);
34898         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
34899         FREE(untag_ptr(this_ptr));
34900         Filter_free(this_ptr_conv);
34901 }
34902
34903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34904         LDKWatchedOutput this_obj_conv;
34905         this_obj_conv.inner = untag_ptr(this_obj);
34906         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34908         WatchedOutput_free(this_obj_conv);
34909 }
34910
34911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34912         LDKWatchedOutput this_ptr_conv;
34913         this_ptr_conv.inner = untag_ptr(this_ptr);
34914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34916         this_ptr_conv.is_owned = false;
34917         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
34918         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
34919         int64_t ret_ref = tag_ptr(ret_copy, true);
34920         return ret_ref;
34921 }
34922
34923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34924         LDKWatchedOutput this_ptr_conv;
34925         this_ptr_conv.inner = untag_ptr(this_ptr);
34926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34928         this_ptr_conv.is_owned = false;
34929         void* val_ptr = untag_ptr(val);
34930         CHECK_ACCESS(val_ptr);
34931         LDKCOption_BlockHashZ val_conv = *(LDKCOption_BlockHashZ*)(val_ptr);
34932         val_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(val));
34933         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
34934 }
34935
34936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
34937         LDKWatchedOutput this_ptr_conv;
34938         this_ptr_conv.inner = untag_ptr(this_ptr);
34939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34941         this_ptr_conv.is_owned = false;
34942         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
34943         int64_t ret_ref = 0;
34944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34946         return ret_ref;
34947 }
34948
34949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34950         LDKWatchedOutput this_ptr_conv;
34951         this_ptr_conv.inner = untag_ptr(this_ptr);
34952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34954         this_ptr_conv.is_owned = false;
34955         LDKOutPoint val_conv;
34956         val_conv.inner = untag_ptr(val);
34957         val_conv.is_owned = ptr_is_owned(val);
34958         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34959         val_conv = OutPoint_clone(&val_conv);
34960         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
34961 }
34962
34963 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
34964         LDKWatchedOutput this_ptr_conv;
34965         this_ptr_conv.inner = untag_ptr(this_ptr);
34966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34968         this_ptr_conv.is_owned = false;
34969         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
34970         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34971         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34972         return ret_arr;
34973 }
34974
34975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34976         LDKWatchedOutput this_ptr_conv;
34977         this_ptr_conv.inner = untag_ptr(this_ptr);
34978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34980         this_ptr_conv.is_owned = false;
34981         LDKCVec_u8Z val_ref;
34982         val_ref.datalen = (*env)->GetArrayLength(env, val);
34983         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34984         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
34985         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
34986 }
34987
34988 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) {
34989         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
34990         CHECK_ACCESS(block_hash_arg_ptr);
34991         LDKCOption_BlockHashZ block_hash_arg_conv = *(LDKCOption_BlockHashZ*)(block_hash_arg_ptr);
34992         block_hash_arg_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(block_hash_arg));
34993         LDKOutPoint outpoint_arg_conv;
34994         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
34995         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
34996         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
34997         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
34998         LDKCVec_u8Z script_pubkey_arg_ref;
34999         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
35000         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
35001         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
35002         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
35003         int64_t ret_ref = 0;
35004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35006         return ret_ref;
35007 }
35008
35009 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
35010         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
35011         int64_t ret_ref = 0;
35012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35014         return ret_ref;
35015 }
35016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35017         LDKWatchedOutput arg_conv;
35018         arg_conv.inner = untag_ptr(arg);
35019         arg_conv.is_owned = ptr_is_owned(arg);
35020         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35021         arg_conv.is_owned = false;
35022         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
35023         return ret_conv;
35024 }
35025
35026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35027         LDKWatchedOutput orig_conv;
35028         orig_conv.inner = untag_ptr(orig);
35029         orig_conv.is_owned = ptr_is_owned(orig);
35030         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35031         orig_conv.is_owned = false;
35032         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
35033         int64_t ret_ref = 0;
35034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35036         return ret_ref;
35037 }
35038
35039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35040         LDKWatchedOutput a_conv;
35041         a_conv.inner = untag_ptr(a);
35042         a_conv.is_owned = ptr_is_owned(a);
35043         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35044         a_conv.is_owned = false;
35045         LDKWatchedOutput b_conv;
35046         b_conv.inner = untag_ptr(b);
35047         b_conv.is_owned = ptr_is_owned(b);
35048         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35049         b_conv.is_owned = false;
35050         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
35051         return ret_conv;
35052 }
35053
35054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
35055         LDKWatchedOutput o_conv;
35056         o_conv.inner = untag_ptr(o);
35057         o_conv.is_owned = ptr_is_owned(o);
35058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35059         o_conv.is_owned = false;
35060         int64_t ret_conv = WatchedOutput_hash(&o_conv);
35061         return ret_conv;
35062 }
35063
35064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35065         if (!ptr_is_owned(this_ptr)) return;
35066         void* this_ptr_ptr = untag_ptr(this_ptr);
35067         CHECK_ACCESS(this_ptr_ptr);
35068         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
35069         FREE(untag_ptr(this_ptr));
35070         BroadcasterInterface_free(this_ptr_conv);
35071 }
35072
35073 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35074         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
35075         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
35076         return ret_conv;
35077 }
35078
35079 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1mempool_1minimum(JNIEnv *env, jclass clz) {
35080         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_mempool_minimum());
35081         return ret_conv;
35082 }
35083
35084 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
35085         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
35086         return ret_conv;
35087 }
35088
35089 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
35090         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
35091         return ret_conv;
35092 }
35093
35094 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
35095         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
35096         return ret_conv;
35097 }
35098
35099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
35100         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
35101         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
35102         return ret_conv;
35103 }
35104
35105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35106         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
35107         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
35108         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
35109         return ret_conv;
35110 }
35111
35112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35113         if (!ptr_is_owned(this_ptr)) return;
35114         void* this_ptr_ptr = untag_ptr(this_ptr);
35115         CHECK_ACCESS(this_ptr_ptr);
35116         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
35117         FREE(untag_ptr(this_ptr));
35118         FeeEstimator_free(this_ptr_conv);
35119 }
35120
35121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35122         LDKMonitorUpdateId this_obj_conv;
35123         this_obj_conv.inner = untag_ptr(this_obj);
35124         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35126         MonitorUpdateId_free(this_obj_conv);
35127 }
35128
35129 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
35130         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
35131         int64_t ret_ref = 0;
35132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35134         return ret_ref;
35135 }
35136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35137         LDKMonitorUpdateId arg_conv;
35138         arg_conv.inner = untag_ptr(arg);
35139         arg_conv.is_owned = ptr_is_owned(arg);
35140         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35141         arg_conv.is_owned = false;
35142         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
35143         return ret_conv;
35144 }
35145
35146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35147         LDKMonitorUpdateId orig_conv;
35148         orig_conv.inner = untag_ptr(orig);
35149         orig_conv.is_owned = ptr_is_owned(orig);
35150         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35151         orig_conv.is_owned = false;
35152         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
35153         int64_t ret_ref = 0;
35154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35156         return ret_ref;
35157 }
35158
35159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
35160         LDKMonitorUpdateId o_conv;
35161         o_conv.inner = untag_ptr(o);
35162         o_conv.is_owned = ptr_is_owned(o);
35163         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35164         o_conv.is_owned = false;
35165         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
35166         return ret_conv;
35167 }
35168
35169 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35170         LDKMonitorUpdateId a_conv;
35171         a_conv.inner = untag_ptr(a);
35172         a_conv.is_owned = ptr_is_owned(a);
35173         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35174         a_conv.is_owned = false;
35175         LDKMonitorUpdateId b_conv;
35176         b_conv.inner = untag_ptr(b);
35177         b_conv.is_owned = ptr_is_owned(b);
35178         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35179         b_conv.is_owned = false;
35180         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
35181         return ret_conv;
35182 }
35183
35184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35185         if (!ptr_is_owned(this_ptr)) return;
35186         void* this_ptr_ptr = untag_ptr(this_ptr);
35187         CHECK_ACCESS(this_ptr_ptr);
35188         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
35189         FREE(untag_ptr(this_ptr));
35190         Persist_free(this_ptr_conv);
35191 }
35192
35193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35194         LDKLockedChannelMonitor this_obj_conv;
35195         this_obj_conv.inner = untag_ptr(this_obj);
35196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35198         LockedChannelMonitor_free(this_obj_conv);
35199 }
35200
35201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35202         LDKChainMonitor this_obj_conv;
35203         this_obj_conv.inner = untag_ptr(this_obj);
35204         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35206         ChainMonitor_free(this_obj_conv);
35207 }
35208
35209 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) {
35210         void* chain_source_ptr = untag_ptr(chain_source);
35211         CHECK_ACCESS(chain_source_ptr);
35212         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
35213         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
35214         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
35215                 // Manually implement clone for Java trait instances
35216                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
35217                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35218                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
35219                 }
35220         }
35221         void* broadcaster_ptr = untag_ptr(broadcaster);
35222         CHECK_ACCESS(broadcaster_ptr);
35223         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
35224         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
35225                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35226                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
35227         }
35228         void* logger_ptr = untag_ptr(logger);
35229         CHECK_ACCESS(logger_ptr);
35230         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35231         if (logger_conv.free == LDKLogger_JCalls_free) {
35232                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35233                 LDKLogger_JCalls_cloned(&logger_conv);
35234         }
35235         void* feeest_ptr = untag_ptr(feeest);
35236         CHECK_ACCESS(feeest_ptr);
35237         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
35238         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
35239                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35240                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
35241         }
35242         void* persister_ptr = untag_ptr(persister);
35243         CHECK_ACCESS(persister_ptr);
35244         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
35245         if (persister_conv.free == LDKPersist_JCalls_free) {
35246                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35247                 LDKPersist_JCalls_cloned(&persister_conv);
35248         }
35249         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
35250         int64_t ret_ref = 0;
35251         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35252         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35253         return ret_ref;
35254 }
35255
35256 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) {
35257         LDKChainMonitor this_arg_conv;
35258         this_arg_conv.inner = untag_ptr(this_arg);
35259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35261         this_arg_conv.is_owned = false;
35262         LDKCVec_ChannelDetailsZ ignored_channels_constr;
35263         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
35264         if (ignored_channels_constr.datalen > 0)
35265                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
35266         else
35267                 ignored_channels_constr.data = NULL;
35268         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
35269         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
35270                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
35271                 LDKChannelDetails ignored_channels_conv_16_conv;
35272                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
35273                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
35274                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
35275                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
35276                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
35277         }
35278         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
35279         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
35280         int64_tArray ret_arr = NULL;
35281         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35282         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35283         for (size_t j = 0; j < ret_var.datalen; j++) {
35284                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35285                 *ret_conv_9_copy = ret_var.data[j];
35286                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
35287                 ret_arr_ptr[j] = ret_conv_9_ref;
35288         }
35289         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35290         FREE(ret_var.data);
35291         return ret_arr;
35292 }
35293
35294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
35295         LDKChainMonitor this_arg_conv;
35296         this_arg_conv.inner = untag_ptr(this_arg);
35297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35299         this_arg_conv.is_owned = false;
35300         LDKOutPoint funding_txo_conv;
35301         funding_txo_conv.inner = untag_ptr(funding_txo);
35302         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35303         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35304         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35305         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
35306         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
35307         return tag_ptr(ret_conv, true);
35308 }
35309
35310 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
35311         LDKChainMonitor this_arg_conv;
35312         this_arg_conv.inner = untag_ptr(this_arg);
35313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35315         this_arg_conv.is_owned = false;
35316         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
35317         int64_tArray ret_arr = NULL;
35318         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35319         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35320         for (size_t k = 0; k < ret_var.datalen; k++) {
35321                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
35322                 int64_t ret_conv_10_ref = 0;
35323                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
35324                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
35325                 ret_arr_ptr[k] = ret_conv_10_ref;
35326         }
35327         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35328         FREE(ret_var.data);
35329         return ret_arr;
35330 }
35331
35332 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
35333         LDKChainMonitor this_arg_conv;
35334         this_arg_conv.inner = untag_ptr(this_arg);
35335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35337         this_arg_conv.is_owned = false;
35338         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
35339         int64_tArray ret_arr = NULL;
35340         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35341         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35342         for (size_t p = 0; p < ret_var.datalen; p++) {
35343                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
35344                 *ret_conv_41_conv = ret_var.data[p];
35345                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
35346         }
35347         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35348         FREE(ret_var.data);
35349         return ret_arr;
35350 }
35351
35352 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) {
35353         LDKChainMonitor this_arg_conv;
35354         this_arg_conv.inner = untag_ptr(this_arg);
35355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35357         this_arg_conv.is_owned = false;
35358         LDKOutPoint funding_txo_conv;
35359         funding_txo_conv.inner = untag_ptr(funding_txo);
35360         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35361         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35362         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35363         LDKMonitorUpdateId completed_update_id_conv;
35364         completed_update_id_conv.inner = untag_ptr(completed_update_id);
35365         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
35366         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
35367         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
35368         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
35369         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
35370         return tag_ptr(ret_conv, true);
35371 }
35372
35373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
35374         LDKChainMonitor this_arg_conv;
35375         this_arg_conv.inner = untag_ptr(this_arg);
35376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35378         this_arg_conv.is_owned = false;
35379         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
35380         int64_t ret_ref = 0;
35381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35383         return ret_ref;
35384 }
35385
35386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
35387         LDKChainMonitor this_arg_conv;
35388         this_arg_conv.inner = untag_ptr(this_arg);
35389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35391         this_arg_conv.is_owned = false;
35392         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
35393 }
35394
35395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
35396         LDKChainMonitor this_arg_conv;
35397         this_arg_conv.inner = untag_ptr(this_arg);
35398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35400         this_arg_conv.is_owned = false;
35401         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
35402         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
35403         return tag_ptr(ret_ret, true);
35404 }
35405
35406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
35407         LDKChainMonitor this_arg_conv;
35408         this_arg_conv.inner = untag_ptr(this_arg);
35409         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35411         this_arg_conv.is_owned = false;
35412         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
35413         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
35414         return tag_ptr(ret_ret, true);
35415 }
35416
35417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
35418         LDKChainMonitor this_arg_conv;
35419         this_arg_conv.inner = untag_ptr(this_arg);
35420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35422         this_arg_conv.is_owned = false;
35423         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
35424         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
35425         return tag_ptr(ret_ret, true);
35426 }
35427
35428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
35429         LDKChainMonitor this_arg_conv;
35430         this_arg_conv.inner = untag_ptr(this_arg);
35431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35433         this_arg_conv.is_owned = false;
35434         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
35435         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
35436         return tag_ptr(ret_ret, true);
35437 }
35438
35439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35440         LDKChannelMonitorUpdate this_obj_conv;
35441         this_obj_conv.inner = untag_ptr(this_obj);
35442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35444         ChannelMonitorUpdate_free(this_obj_conv);
35445 }
35446
35447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
35448         LDKChannelMonitorUpdate this_ptr_conv;
35449         this_ptr_conv.inner = untag_ptr(this_ptr);
35450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35452         this_ptr_conv.is_owned = false;
35453         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
35454         return ret_conv;
35455 }
35456
35457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35458         LDKChannelMonitorUpdate this_ptr_conv;
35459         this_ptr_conv.inner = untag_ptr(this_ptr);
35460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35462         this_ptr_conv.is_owned = false;
35463         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
35464 }
35465
35466 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
35467         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
35468         int64_t ret_ref = 0;
35469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35471         return ret_ref;
35472 }
35473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35474         LDKChannelMonitorUpdate arg_conv;
35475         arg_conv.inner = untag_ptr(arg);
35476         arg_conv.is_owned = ptr_is_owned(arg);
35477         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35478         arg_conv.is_owned = false;
35479         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
35480         return ret_conv;
35481 }
35482
35483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35484         LDKChannelMonitorUpdate orig_conv;
35485         orig_conv.inner = untag_ptr(orig);
35486         orig_conv.is_owned = ptr_is_owned(orig);
35487         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35488         orig_conv.is_owned = false;
35489         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
35490         int64_t ret_ref = 0;
35491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35493         return ret_ref;
35494 }
35495
35496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35497         LDKChannelMonitorUpdate a_conv;
35498         a_conv.inner = untag_ptr(a);
35499         a_conv.is_owned = ptr_is_owned(a);
35500         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35501         a_conv.is_owned = false;
35502         LDKChannelMonitorUpdate b_conv;
35503         b_conv.inner = untag_ptr(b);
35504         b_conv.is_owned = ptr_is_owned(b);
35505         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35506         b_conv.is_owned = false;
35507         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
35508         return ret_conv;
35509 }
35510
35511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35512         LDKChannelMonitorUpdate obj_conv;
35513         obj_conv.inner = untag_ptr(obj);
35514         obj_conv.is_owned = ptr_is_owned(obj);
35515         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35516         obj_conv.is_owned = false;
35517         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
35518         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35519         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35520         CVec_u8Z_free(ret_var);
35521         return ret_arr;
35522 }
35523
35524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35525         LDKu8slice ser_ref;
35526         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35527         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35528         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
35529         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
35530         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35531         return tag_ptr(ret_conv, true);
35532 }
35533
35534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35535         if (!ptr_is_owned(this_ptr)) return;
35536         void* this_ptr_ptr = untag_ptr(this_ptr);
35537         CHECK_ACCESS(this_ptr_ptr);
35538         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
35539         FREE(untag_ptr(this_ptr));
35540         MonitorEvent_free(this_ptr_conv);
35541 }
35542
35543 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
35544         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35545         *ret_copy = MonitorEvent_clone(arg);
35546         int64_t ret_ref = tag_ptr(ret_copy, true);
35547         return ret_ref;
35548 }
35549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35550         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
35551         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
35552         return ret_conv;
35553 }
35554
35555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35556         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
35557         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35558         *ret_copy = MonitorEvent_clone(orig_conv);
35559         int64_t ret_ref = tag_ptr(ret_copy, true);
35560         return ret_ref;
35561 }
35562
35563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
35564         LDKHTLCUpdate a_conv;
35565         a_conv.inner = untag_ptr(a);
35566         a_conv.is_owned = ptr_is_owned(a);
35567         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35568         a_conv = HTLCUpdate_clone(&a_conv);
35569         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35570         *ret_copy = MonitorEvent_htlcevent(a_conv);
35571         int64_t ret_ref = tag_ptr(ret_copy, true);
35572         return ret_ref;
35573 }
35574
35575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
35576         LDKOutPoint a_conv;
35577         a_conv.inner = untag_ptr(a);
35578         a_conv.is_owned = ptr_is_owned(a);
35579         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35580         a_conv = OutPoint_clone(&a_conv);
35581         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35582         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
35583         int64_t ret_ref = tag_ptr(ret_copy, true);
35584         return ret_ref;
35585 }
35586
35587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
35588         LDKOutPoint funding_txo_conv;
35589         funding_txo_conv.inner = untag_ptr(funding_txo);
35590         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
35591         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
35592         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
35593         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35594         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
35595         int64_t ret_ref = tag_ptr(ret_copy, true);
35596         return ret_ref;
35597 }
35598
35599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
35600         LDKOutPoint a_conv;
35601         a_conv.inner = untag_ptr(a);
35602         a_conv.is_owned = ptr_is_owned(a);
35603         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35604         a_conv = OutPoint_clone(&a_conv);
35605         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35606         *ret_copy = MonitorEvent_update_failed(a_conv);
35607         int64_t ret_ref = tag_ptr(ret_copy, true);
35608         return ret_ref;
35609 }
35610
35611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35612         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
35613         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
35614         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
35615         return ret_conv;
35616 }
35617
35618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
35619         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
35620         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
35621         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35622         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35623         CVec_u8Z_free(ret_var);
35624         return ret_arr;
35625 }
35626
35627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35628         LDKu8slice ser_ref;
35629         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35630         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35631         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
35632         *ret_conv = MonitorEvent_read(ser_ref);
35633         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35634         return tag_ptr(ret_conv, true);
35635 }
35636
35637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35638         LDKHTLCUpdate this_obj_conv;
35639         this_obj_conv.inner = untag_ptr(this_obj);
35640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35642         HTLCUpdate_free(this_obj_conv);
35643 }
35644
35645 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
35646         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
35647         int64_t ret_ref = 0;
35648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35650         return ret_ref;
35651 }
35652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35653         LDKHTLCUpdate arg_conv;
35654         arg_conv.inner = untag_ptr(arg);
35655         arg_conv.is_owned = ptr_is_owned(arg);
35656         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35657         arg_conv.is_owned = false;
35658         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
35659         return ret_conv;
35660 }
35661
35662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35663         LDKHTLCUpdate orig_conv;
35664         orig_conv.inner = untag_ptr(orig);
35665         orig_conv.is_owned = ptr_is_owned(orig);
35666         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35667         orig_conv.is_owned = false;
35668         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
35669         int64_t ret_ref = 0;
35670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35672         return ret_ref;
35673 }
35674
35675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35676         LDKHTLCUpdate a_conv;
35677         a_conv.inner = untag_ptr(a);
35678         a_conv.is_owned = ptr_is_owned(a);
35679         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35680         a_conv.is_owned = false;
35681         LDKHTLCUpdate b_conv;
35682         b_conv.inner = untag_ptr(b);
35683         b_conv.is_owned = ptr_is_owned(b);
35684         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35685         b_conv.is_owned = false;
35686         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
35687         return ret_conv;
35688 }
35689
35690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35691         LDKHTLCUpdate obj_conv;
35692         obj_conv.inner = untag_ptr(obj);
35693         obj_conv.is_owned = ptr_is_owned(obj);
35694         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35695         obj_conv.is_owned = false;
35696         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
35697         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35698         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35699         CVec_u8Z_free(ret_var);
35700         return ret_arr;
35701 }
35702
35703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35704         LDKu8slice ser_ref;
35705         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35706         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35707         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
35708         *ret_conv = HTLCUpdate_read(ser_ref);
35709         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35710         return tag_ptr(ret_conv, true);
35711 }
35712
35713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35714         if (!ptr_is_owned(this_ptr)) return;
35715         void* this_ptr_ptr = untag_ptr(this_ptr);
35716         CHECK_ACCESS(this_ptr_ptr);
35717         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
35718         FREE(untag_ptr(this_ptr));
35719         Balance_free(this_ptr_conv);
35720 }
35721
35722 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
35723         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35724         *ret_copy = Balance_clone(arg);
35725         int64_t ret_ref = tag_ptr(ret_copy, true);
35726         return ret_ref;
35727 }
35728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35729         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
35730         int64_t ret_conv = Balance_clone_ptr(arg_conv);
35731         return ret_conv;
35732 }
35733
35734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35735         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
35736         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35737         *ret_copy = Balance_clone(orig_conv);
35738         int64_t ret_ref = tag_ptr(ret_copy, true);
35739         return ret_ref;
35740 }
35741
35742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
35743         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35744         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
35745         int64_t ret_ref = tag_ptr(ret_copy, true);
35746         return ret_ref;
35747 }
35748
35749 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) {
35750         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35751         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
35752         int64_t ret_ref = tag_ptr(ret_copy, true);
35753         return ret_ref;
35754 }
35755
35756 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) {
35757         LDKThirtyTwoBytes payment_hash_ref;
35758         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
35759         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
35760         LDKThirtyTwoBytes payment_preimage_ref;
35761         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
35762         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
35763         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35764         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
35765         int64_t ret_ref = tag_ptr(ret_copy, true);
35766         return ret_ref;
35767 }
35768
35769 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) {
35770         LDKThirtyTwoBytes payment_hash_ref;
35771         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
35772         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
35773         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35774         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
35775         int64_t ret_ref = tag_ptr(ret_copy, true);
35776         return ret_ref;
35777 }
35778
35779 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) {
35780         LDKThirtyTwoBytes payment_hash_ref;
35781         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
35782         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
35783         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35784         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
35785         int64_t ret_ref = tag_ptr(ret_copy, true);
35786         return ret_ref;
35787 }
35788
35789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
35790         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
35791         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
35792         int64_t ret_ref = tag_ptr(ret_copy, true);
35793         return ret_ref;
35794 }
35795
35796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
35797         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
35798         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
35799         jboolean ret_conv = Balance_eq(a_conv, b_conv);
35800         return ret_conv;
35801 }
35802
35803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
35804         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
35805         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
35806         return ret_conv;
35807 }
35808
35809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35810         LDKChannelMonitor this_obj_conv;
35811         this_obj_conv.inner = untag_ptr(this_obj);
35812         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35814         ChannelMonitor_free(this_obj_conv);
35815 }
35816
35817 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
35818         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
35819         int64_t ret_ref = 0;
35820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35822         return ret_ref;
35823 }
35824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35825         LDKChannelMonitor arg_conv;
35826         arg_conv.inner = untag_ptr(arg);
35827         arg_conv.is_owned = ptr_is_owned(arg);
35828         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35829         arg_conv.is_owned = false;
35830         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
35831         return ret_conv;
35832 }
35833
35834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35835         LDKChannelMonitor orig_conv;
35836         orig_conv.inner = untag_ptr(orig);
35837         orig_conv.is_owned = ptr_is_owned(orig);
35838         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35839         orig_conv.is_owned = false;
35840         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
35841         int64_t ret_ref = 0;
35842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35844         return ret_ref;
35845 }
35846
35847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
35848         LDKChannelMonitor obj_conv;
35849         obj_conv.inner = untag_ptr(obj);
35850         obj_conv.is_owned = ptr_is_owned(obj);
35851         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35852         obj_conv.is_owned = false;
35853         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
35854         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35855         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35856         CVec_u8Z_free(ret_var);
35857         return ret_arr;
35858 }
35859
35860 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) {
35861         LDKChannelMonitor this_arg_conv;
35862         this_arg_conv.inner = untag_ptr(this_arg);
35863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35865         this_arg_conv.is_owned = false;
35866         LDKChannelMonitorUpdate updates_conv;
35867         updates_conv.inner = untag_ptr(updates);
35868         updates_conv.is_owned = ptr_is_owned(updates);
35869         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
35870         updates_conv.is_owned = false;
35871         void* broadcaster_ptr = untag_ptr(broadcaster);
35872         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
35873         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
35874         void* fee_estimator_ptr = untag_ptr(fee_estimator);
35875         CHECK_ACCESS(fee_estimator_ptr);
35876         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
35877         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
35878                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35879                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
35880         }
35881         void* logger_ptr = untag_ptr(logger);
35882         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35883         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35884         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
35885         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
35886         return tag_ptr(ret_conv, true);
35887 }
35888
35889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
35890         LDKChannelMonitor this_arg_conv;
35891         this_arg_conv.inner = untag_ptr(this_arg);
35892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35894         this_arg_conv.is_owned = false;
35895         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
35896         return ret_conv;
35897 }
35898
35899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
35900         LDKChannelMonitor this_arg_conv;
35901         this_arg_conv.inner = untag_ptr(this_arg);
35902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35904         this_arg_conv.is_owned = false;
35905         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
35906         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
35907         return tag_ptr(ret_conv, true);
35908 }
35909
35910 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
35911         LDKChannelMonitor this_arg_conv;
35912         this_arg_conv.inner = untag_ptr(this_arg);
35913         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35915         this_arg_conv.is_owned = false;
35916         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
35917         int64_tArray ret_arr = NULL;
35918         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35919         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35920         for (size_t o = 0; o < ret_var.datalen; o++) {
35921                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
35922                 *ret_conv_40_conv = ret_var.data[o];
35923                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
35924         }
35925         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35926         FREE(ret_var.data);
35927         return ret_arr;
35928 }
35929
35930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
35931         LDKChannelMonitor this_arg_conv;
35932         this_arg_conv.inner = untag_ptr(this_arg);
35933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35935         this_arg_conv.is_owned = false;
35936         void* filter_ptr = untag_ptr(filter);
35937         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
35938         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
35939         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
35940 }
35941
35942 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
35943         LDKChannelMonitor this_arg_conv;
35944         this_arg_conv.inner = untag_ptr(this_arg);
35945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35947         this_arg_conv.is_owned = false;
35948         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
35949         int64_tArray ret_arr = NULL;
35950         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35951         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35952         for (size_t o = 0; o < ret_var.datalen; o++) {
35953                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
35954                 *ret_conv_14_copy = ret_var.data[o];
35955                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
35956                 ret_arr_ptr[o] = ret_conv_14_ref;
35957         }
35958         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35959         FREE(ret_var.data);
35960         return ret_arr;
35961 }
35962
35963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
35964         LDKChannelMonitor this_arg_conv;
35965         this_arg_conv.inner = untag_ptr(this_arg);
35966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35968         this_arg_conv.is_owned = false;
35969         void* handler_ptr = untag_ptr(handler);
35970         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
35971         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
35972         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
35973 }
35974
35975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
35976         LDKChannelMonitor this_arg_conv;
35977         this_arg_conv.inner = untag_ptr(this_arg);
35978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35980         this_arg_conv.is_owned = false;
35981         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
35982         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
35983         return ret_arr;
35984 }
35985
35986 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) {
35987         LDKChannelMonitor this_arg_conv;
35988         this_arg_conv.inner = untag_ptr(this_arg);
35989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35991         this_arg_conv.is_owned = false;
35992         void* logger_ptr = untag_ptr(logger);
35993         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
35994         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
35995         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
35996         jobjectArray ret_arr = NULL;
35997         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
35998         ;
35999         for (size_t i = 0; i < ret_var.datalen; i++) {
36000                 LDKTransaction ret_conv_8_var = ret_var.data[i];
36001                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
36002                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
36003                 Transaction_free(ret_conv_8_var);
36004                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
36005         }
36006         
36007         FREE(ret_var.data);
36008         return ret_arr;
36009 }
36010
36011 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) {
36012         LDKChannelMonitor this_arg_conv;
36013         this_arg_conv.inner = untag_ptr(this_arg);
36014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36016         this_arg_conv.is_owned = false;
36017         uint8_t header_arr[80];
36018         CHECK((*env)->GetArrayLength(env, header) == 80);
36019         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
36020         uint8_t (*header_ref)[80] = &header_arr;
36021         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
36022         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
36023         if (txdata_constr.datalen > 0)
36024                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
36025         else
36026                 txdata_constr.data = NULL;
36027         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
36028         for (size_t c = 0; c < txdata_constr.datalen; c++) {
36029                 int64_t txdata_conv_28 = txdata_vals[c];
36030                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
36031                 CHECK_ACCESS(txdata_conv_28_ptr);
36032                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
36033                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
36034                 txdata_constr.data[c] = txdata_conv_28_conv;
36035         }
36036         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
36037         void* broadcaster_ptr = untag_ptr(broadcaster);
36038         CHECK_ACCESS(broadcaster_ptr);
36039         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36040         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36041                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36042                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36043         }
36044         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36045         CHECK_ACCESS(fee_estimator_ptr);
36046         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36047         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36048                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36049                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36050         }
36051         void* logger_ptr = untag_ptr(logger);
36052         CHECK_ACCESS(logger_ptr);
36053         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36054         if (logger_conv.free == LDKLogger_JCalls_free) {
36055                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36056                 LDKLogger_JCalls_cloned(&logger_conv);
36057         }
36058         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);
36059         int64_tArray ret_arr = NULL;
36060         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36061         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36062         for (size_t n = 0; n < ret_var.datalen; n++) {
36063                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
36064                 *ret_conv_39_conv = ret_var.data[n];
36065                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
36066         }
36067         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36068         FREE(ret_var.data);
36069         return ret_arr;
36070 }
36071
36072 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) {
36073         LDKChannelMonitor this_arg_conv;
36074         this_arg_conv.inner = untag_ptr(this_arg);
36075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36077         this_arg_conv.is_owned = false;
36078         uint8_t header_arr[80];
36079         CHECK((*env)->GetArrayLength(env, header) == 80);
36080         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
36081         uint8_t (*header_ref)[80] = &header_arr;
36082         void* broadcaster_ptr = untag_ptr(broadcaster);
36083         CHECK_ACCESS(broadcaster_ptr);
36084         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36085         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36086                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36087                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36088         }
36089         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36090         CHECK_ACCESS(fee_estimator_ptr);
36091         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36092         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36093                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36094                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36095         }
36096         void* logger_ptr = untag_ptr(logger);
36097         CHECK_ACCESS(logger_ptr);
36098         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36099         if (logger_conv.free == LDKLogger_JCalls_free) {
36100                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36101                 LDKLogger_JCalls_cloned(&logger_conv);
36102         }
36103         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
36104 }
36105
36106 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) {
36107         LDKChannelMonitor this_arg_conv;
36108         this_arg_conv.inner = untag_ptr(this_arg);
36109         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36111         this_arg_conv.is_owned = false;
36112         uint8_t header_arr[80];
36113         CHECK((*env)->GetArrayLength(env, header) == 80);
36114         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
36115         uint8_t (*header_ref)[80] = &header_arr;
36116         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
36117         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
36118         if (txdata_constr.datalen > 0)
36119                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
36120         else
36121                 txdata_constr.data = NULL;
36122         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
36123         for (size_t c = 0; c < txdata_constr.datalen; c++) {
36124                 int64_t txdata_conv_28 = txdata_vals[c];
36125                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
36126                 CHECK_ACCESS(txdata_conv_28_ptr);
36127                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
36128                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
36129                 txdata_constr.data[c] = txdata_conv_28_conv;
36130         }
36131         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
36132         void* broadcaster_ptr = untag_ptr(broadcaster);
36133         CHECK_ACCESS(broadcaster_ptr);
36134         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36135         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36136                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36137                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36138         }
36139         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36140         CHECK_ACCESS(fee_estimator_ptr);
36141         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36142         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36143                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36144                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36145         }
36146         void* logger_ptr = untag_ptr(logger);
36147         CHECK_ACCESS(logger_ptr);
36148         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36149         if (logger_conv.free == LDKLogger_JCalls_free) {
36150                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36151                 LDKLogger_JCalls_cloned(&logger_conv);
36152         }
36153         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);
36154         int64_tArray ret_arr = NULL;
36155         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36156         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36157         for (size_t n = 0; n < ret_var.datalen; n++) {
36158                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
36159                 *ret_conv_39_conv = ret_var.data[n];
36160                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
36161         }
36162         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36163         FREE(ret_var.data);
36164         return ret_arr;
36165 }
36166
36167 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) {
36168         LDKChannelMonitor this_arg_conv;
36169         this_arg_conv.inner = untag_ptr(this_arg);
36170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36172         this_arg_conv.is_owned = false;
36173         uint8_t txid_arr[32];
36174         CHECK((*env)->GetArrayLength(env, txid) == 32);
36175         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
36176         uint8_t (*txid_ref)[32] = &txid_arr;
36177         void* broadcaster_ptr = untag_ptr(broadcaster);
36178         CHECK_ACCESS(broadcaster_ptr);
36179         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36180         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36181                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36182                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36183         }
36184         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36185         CHECK_ACCESS(fee_estimator_ptr);
36186         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36187         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36188                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36189                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36190         }
36191         void* logger_ptr = untag_ptr(logger);
36192         CHECK_ACCESS(logger_ptr);
36193         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36194         if (logger_conv.free == LDKLogger_JCalls_free) {
36195                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36196                 LDKLogger_JCalls_cloned(&logger_conv);
36197         }
36198         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
36199 }
36200
36201 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) {
36202         LDKChannelMonitor this_arg_conv;
36203         this_arg_conv.inner = untag_ptr(this_arg);
36204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36206         this_arg_conv.is_owned = false;
36207         uint8_t header_arr[80];
36208         CHECK((*env)->GetArrayLength(env, header) == 80);
36209         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
36210         uint8_t (*header_ref)[80] = &header_arr;
36211         void* broadcaster_ptr = untag_ptr(broadcaster);
36212         CHECK_ACCESS(broadcaster_ptr);
36213         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36214         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36215                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36216                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36217         }
36218         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36219         CHECK_ACCESS(fee_estimator_ptr);
36220         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36221         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36222                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36223                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36224         }
36225         void* logger_ptr = untag_ptr(logger);
36226         CHECK_ACCESS(logger_ptr);
36227         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36228         if (logger_conv.free == LDKLogger_JCalls_free) {
36229                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36230                 LDKLogger_JCalls_cloned(&logger_conv);
36231         }
36232         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
36233         int64_tArray ret_arr = NULL;
36234         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36235         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36236         for (size_t n = 0; n < ret_var.datalen; n++) {
36237                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
36238                 *ret_conv_39_conv = ret_var.data[n];
36239                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
36240         }
36241         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36242         FREE(ret_var.data);
36243         return ret_arr;
36244 }
36245
36246 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
36247         LDKChannelMonitor this_arg_conv;
36248         this_arg_conv.inner = untag_ptr(this_arg);
36249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36251         this_arg_conv.is_owned = false;
36252         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
36253         int64_tArray ret_arr = NULL;
36254         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36255         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36256         for (size_t i = 0; i < ret_var.datalen; i++) {
36257                 LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv_34_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
36258                 *ret_conv_34_conv = ret_var.data[i];
36259                 ret_arr_ptr[i] = tag_ptr(ret_conv_34_conv, true);
36260         }
36261         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36262         FREE(ret_var.data);
36263         return ret_arr;
36264 }
36265
36266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
36267         LDKChannelMonitor this_arg_conv;
36268         this_arg_conv.inner = untag_ptr(this_arg);
36269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36271         this_arg_conv.is_owned = false;
36272         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
36273         int64_t ret_ref = 0;
36274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36276         return ret_ref;
36277 }
36278
36279 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) {
36280         LDKChannelMonitor this_arg_conv;
36281         this_arg_conv.inner = untag_ptr(this_arg);
36282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36284         this_arg_conv.is_owned = false;
36285         void* broadcaster_ptr = untag_ptr(broadcaster);
36286         CHECK_ACCESS(broadcaster_ptr);
36287         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
36288         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
36289                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36290                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
36291         }
36292         void* fee_estimator_ptr = untag_ptr(fee_estimator);
36293         CHECK_ACCESS(fee_estimator_ptr);
36294         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
36295         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
36296                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36297                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
36298         }
36299         void* logger_ptr = untag_ptr(logger);
36300         CHECK_ACCESS(logger_ptr);
36301         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36302         if (logger_conv.free == LDKLogger_JCalls_free) {
36303                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36304                 LDKLogger_JCalls_cloned(&logger_conv);
36305         }
36306         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
36307 }
36308
36309 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
36310         LDKChannelMonitor this_arg_conv;
36311         this_arg_conv.inner = untag_ptr(this_arg);
36312         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36314         this_arg_conv.is_owned = false;
36315         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
36316         int64_tArray ret_arr = NULL;
36317         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
36318         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
36319         for (size_t j = 0; j < ret_var.datalen; j++) {
36320                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
36321                 *ret_conv_9_copy = ret_var.data[j];
36322                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
36323                 ret_arr_ptr[j] = ret_conv_9_ref;
36324         }
36325         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
36326         FREE(ret_var.data);
36327         return ret_arr;
36328 }
36329
36330 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) {
36331         LDKu8slice ser_ref;
36332         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36333         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36334         void* arg_a_ptr = untag_ptr(arg_a);
36335         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
36336         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
36337         void* arg_b_ptr = untag_ptr(arg_b);
36338         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
36339         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
36340         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
36341         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
36342         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36343         return tag_ptr(ret_conv, true);
36344 }
36345
36346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36347         LDKOutPoint this_obj_conv;
36348         this_obj_conv.inner = untag_ptr(this_obj);
36349         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36351         OutPoint_free(this_obj_conv);
36352 }
36353
36354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
36355         LDKOutPoint this_ptr_conv;
36356         this_ptr_conv.inner = untag_ptr(this_ptr);
36357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36359         this_ptr_conv.is_owned = false;
36360         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36361         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
36362         return ret_arr;
36363 }
36364
36365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36366         LDKOutPoint this_ptr_conv;
36367         this_ptr_conv.inner = untag_ptr(this_ptr);
36368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36370         this_ptr_conv.is_owned = false;
36371         LDKThirtyTwoBytes val_ref;
36372         CHECK((*env)->GetArrayLength(env, val) == 32);
36373         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36374         OutPoint_set_txid(&this_ptr_conv, val_ref);
36375 }
36376
36377 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
36378         LDKOutPoint this_ptr_conv;
36379         this_ptr_conv.inner = untag_ptr(this_ptr);
36380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36382         this_ptr_conv.is_owned = false;
36383         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
36384         return ret_conv;
36385 }
36386
36387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36388         LDKOutPoint this_ptr_conv;
36389         this_ptr_conv.inner = untag_ptr(this_ptr);
36390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36392         this_ptr_conv.is_owned = false;
36393         OutPoint_set_index(&this_ptr_conv, val);
36394 }
36395
36396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
36397         LDKThirtyTwoBytes txid_arg_ref;
36398         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
36399         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
36400         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
36401         int64_t ret_ref = 0;
36402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36404         return ret_ref;
36405 }
36406
36407 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
36408         LDKOutPoint ret_var = OutPoint_clone(arg);
36409         int64_t ret_ref = 0;
36410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36412         return ret_ref;
36413 }
36414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36415         LDKOutPoint arg_conv;
36416         arg_conv.inner = untag_ptr(arg);
36417         arg_conv.is_owned = ptr_is_owned(arg);
36418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36419         arg_conv.is_owned = false;
36420         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
36421         return ret_conv;
36422 }
36423
36424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36425         LDKOutPoint orig_conv;
36426         orig_conv.inner = untag_ptr(orig);
36427         orig_conv.is_owned = ptr_is_owned(orig);
36428         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36429         orig_conv.is_owned = false;
36430         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
36431         int64_t ret_ref = 0;
36432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36434         return ret_ref;
36435 }
36436
36437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36438         LDKOutPoint a_conv;
36439         a_conv.inner = untag_ptr(a);
36440         a_conv.is_owned = ptr_is_owned(a);
36441         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36442         a_conv.is_owned = false;
36443         LDKOutPoint b_conv;
36444         b_conv.inner = untag_ptr(b);
36445         b_conv.is_owned = ptr_is_owned(b);
36446         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36447         b_conv.is_owned = false;
36448         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
36449         return ret_conv;
36450 }
36451
36452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
36453         LDKOutPoint o_conv;
36454         o_conv.inner = untag_ptr(o);
36455         o_conv.is_owned = ptr_is_owned(o);
36456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36457         o_conv.is_owned = false;
36458         int64_t ret_conv = OutPoint_hash(&o_conv);
36459         return ret_conv;
36460 }
36461
36462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
36463         LDKOutPoint this_arg_conv;
36464         this_arg_conv.inner = untag_ptr(this_arg);
36465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36467         this_arg_conv.is_owned = false;
36468         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36469         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
36470         return ret_arr;
36471 }
36472
36473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
36474         LDKOutPoint obj_conv;
36475         obj_conv.inner = untag_ptr(obj);
36476         obj_conv.is_owned = ptr_is_owned(obj);
36477         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36478         obj_conv.is_owned = false;
36479         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
36480         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36481         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36482         CVec_u8Z_free(ret_var);
36483         return ret_arr;
36484 }
36485
36486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36487         LDKu8slice ser_ref;
36488         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36489         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36490         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
36491         *ret_conv = OutPoint_read(ser_ref);
36492         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36493         return tag_ptr(ret_conv, true);
36494 }
36495
36496 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36497         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
36498         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_clone(orig_conv));
36499         return ret_conv;
36500 }
36501
36502 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
36503         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_temporary_node_failure());
36504         return ret_conv;
36505 }
36506
36507 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
36508         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_required_node_feature_missing());
36509         return ret_conv;
36510 }
36511
36512 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
36513         jclass ret_conv = LDKFailureCode_to_java(env, FailureCode_incorrect_or_unknown_payment_details());
36514         return ret_conv;
36515 }
36516
36517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36518         LDKChannelManager this_obj_conv;
36519         this_obj_conv.inner = untag_ptr(this_obj);
36520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36522         ChannelManager_free(this_obj_conv);
36523 }
36524
36525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36526         LDKChainParameters this_obj_conv;
36527         this_obj_conv.inner = untag_ptr(this_obj);
36528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36530         ChainParameters_free(this_obj_conv);
36531 }
36532
36533 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
36534         LDKChainParameters this_ptr_conv;
36535         this_ptr_conv.inner = untag_ptr(this_ptr);
36536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36538         this_ptr_conv.is_owned = false;
36539         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
36540         return ret_conv;
36541 }
36542
36543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
36544         LDKChainParameters this_ptr_conv;
36545         this_ptr_conv.inner = untag_ptr(this_ptr);
36546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36548         this_ptr_conv.is_owned = false;
36549         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
36550         ChainParameters_set_network(&this_ptr_conv, val_conv);
36551 }
36552
36553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
36554         LDKChainParameters this_ptr_conv;
36555         this_ptr_conv.inner = untag_ptr(this_ptr);
36556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36558         this_ptr_conv.is_owned = false;
36559         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
36560         int64_t ret_ref = 0;
36561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36563         return ret_ref;
36564 }
36565
36566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36567         LDKChainParameters this_ptr_conv;
36568         this_ptr_conv.inner = untag_ptr(this_ptr);
36569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36571         this_ptr_conv.is_owned = false;
36572         LDKBestBlock val_conv;
36573         val_conv.inner = untag_ptr(val);
36574         val_conv.is_owned = ptr_is_owned(val);
36575         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36576         val_conv = BestBlock_clone(&val_conv);
36577         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
36578 }
36579
36580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
36581         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
36582         LDKBestBlock best_block_arg_conv;
36583         best_block_arg_conv.inner = untag_ptr(best_block_arg);
36584         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
36585         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
36586         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
36587         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
36588         int64_t ret_ref = 0;
36589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36591         return ret_ref;
36592 }
36593
36594 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
36595         LDKChainParameters ret_var = ChainParameters_clone(arg);
36596         int64_t ret_ref = 0;
36597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36599         return ret_ref;
36600 }
36601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36602         LDKChainParameters arg_conv;
36603         arg_conv.inner = untag_ptr(arg);
36604         arg_conv.is_owned = ptr_is_owned(arg);
36605         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36606         arg_conv.is_owned = false;
36607         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
36608         return ret_conv;
36609 }
36610
36611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36612         LDKChainParameters orig_conv;
36613         orig_conv.inner = untag_ptr(orig);
36614         orig_conv.is_owned = ptr_is_owned(orig);
36615         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36616         orig_conv.is_owned = false;
36617         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
36618         int64_t ret_ref = 0;
36619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36621         return ret_ref;
36622 }
36623
36624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36625         LDKCounterpartyForwardingInfo this_obj_conv;
36626         this_obj_conv.inner = untag_ptr(this_obj);
36627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36629         CounterpartyForwardingInfo_free(this_obj_conv);
36630 }
36631
36632 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36633         LDKCounterpartyForwardingInfo this_ptr_conv;
36634         this_ptr_conv.inner = untag_ptr(this_ptr);
36635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36637         this_ptr_conv.is_owned = false;
36638         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
36639         return ret_conv;
36640 }
36641
36642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36643         LDKCounterpartyForwardingInfo this_ptr_conv;
36644         this_ptr_conv.inner = untag_ptr(this_ptr);
36645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36647         this_ptr_conv.is_owned = false;
36648         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
36649 }
36650
36651 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
36652         LDKCounterpartyForwardingInfo this_ptr_conv;
36653         this_ptr_conv.inner = untag_ptr(this_ptr);
36654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36656         this_ptr_conv.is_owned = false;
36657         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
36658         return ret_conv;
36659 }
36660
36661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36662         LDKCounterpartyForwardingInfo this_ptr_conv;
36663         this_ptr_conv.inner = untag_ptr(this_ptr);
36664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36666         this_ptr_conv.is_owned = false;
36667         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
36668 }
36669
36670 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
36671         LDKCounterpartyForwardingInfo this_ptr_conv;
36672         this_ptr_conv.inner = untag_ptr(this_ptr);
36673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36675         this_ptr_conv.is_owned = false;
36676         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
36677         return ret_conv;
36678 }
36679
36680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
36681         LDKCounterpartyForwardingInfo this_ptr_conv;
36682         this_ptr_conv.inner = untag_ptr(this_ptr);
36683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36685         this_ptr_conv.is_owned = false;
36686         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
36687 }
36688
36689 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) {
36690         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
36691         int64_t ret_ref = 0;
36692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36694         return ret_ref;
36695 }
36696
36697 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
36698         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
36699         int64_t ret_ref = 0;
36700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36702         return ret_ref;
36703 }
36704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36705         LDKCounterpartyForwardingInfo arg_conv;
36706         arg_conv.inner = untag_ptr(arg);
36707         arg_conv.is_owned = ptr_is_owned(arg);
36708         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36709         arg_conv.is_owned = false;
36710         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
36711         return ret_conv;
36712 }
36713
36714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36715         LDKCounterpartyForwardingInfo orig_conv;
36716         orig_conv.inner = untag_ptr(orig);
36717         orig_conv.is_owned = ptr_is_owned(orig);
36718         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36719         orig_conv.is_owned = false;
36720         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
36721         int64_t ret_ref = 0;
36722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36724         return ret_ref;
36725 }
36726
36727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36728         LDKChannelCounterparty this_obj_conv;
36729         this_obj_conv.inner = untag_ptr(this_obj);
36730         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36732         ChannelCounterparty_free(this_obj_conv);
36733 }
36734
36735 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36736         LDKChannelCounterparty this_ptr_conv;
36737         this_ptr_conv.inner = untag_ptr(this_ptr);
36738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36740         this_ptr_conv.is_owned = false;
36741         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36742         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
36743         return ret_arr;
36744 }
36745
36746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36747         LDKChannelCounterparty this_ptr_conv;
36748         this_ptr_conv.inner = untag_ptr(this_ptr);
36749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36751         this_ptr_conv.is_owned = false;
36752         LDKPublicKey val_ref;
36753         CHECK((*env)->GetArrayLength(env, val) == 33);
36754         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36755         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
36756 }
36757
36758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
36759         LDKChannelCounterparty this_ptr_conv;
36760         this_ptr_conv.inner = untag_ptr(this_ptr);
36761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36763         this_ptr_conv.is_owned = false;
36764         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
36765         int64_t ret_ref = 0;
36766         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36767         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36768         return ret_ref;
36769 }
36770
36771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36772         LDKChannelCounterparty this_ptr_conv;
36773         this_ptr_conv.inner = untag_ptr(this_ptr);
36774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36776         this_ptr_conv.is_owned = false;
36777         LDKInitFeatures val_conv;
36778         val_conv.inner = untag_ptr(val);
36779         val_conv.is_owned = ptr_is_owned(val);
36780         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36781         val_conv = InitFeatures_clone(&val_conv);
36782         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
36783 }
36784
36785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
36786         LDKChannelCounterparty this_ptr_conv;
36787         this_ptr_conv.inner = untag_ptr(this_ptr);
36788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36790         this_ptr_conv.is_owned = false;
36791         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
36792         return ret_conv;
36793 }
36794
36795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36796         LDKChannelCounterparty this_ptr_conv;
36797         this_ptr_conv.inner = untag_ptr(this_ptr);
36798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36800         this_ptr_conv.is_owned = false;
36801         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
36802 }
36803
36804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
36805         LDKChannelCounterparty this_ptr_conv;
36806         this_ptr_conv.inner = untag_ptr(this_ptr);
36807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36809         this_ptr_conv.is_owned = false;
36810         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
36811         int64_t ret_ref = 0;
36812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36814         return ret_ref;
36815 }
36816
36817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36818         LDKChannelCounterparty this_ptr_conv;
36819         this_ptr_conv.inner = untag_ptr(this_ptr);
36820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36822         this_ptr_conv.is_owned = false;
36823         LDKCounterpartyForwardingInfo val_conv;
36824         val_conv.inner = untag_ptr(val);
36825         val_conv.is_owned = ptr_is_owned(val);
36826         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36827         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
36828         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
36829 }
36830
36831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36832         LDKChannelCounterparty this_ptr_conv;
36833         this_ptr_conv.inner = untag_ptr(this_ptr);
36834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36836         this_ptr_conv.is_owned = false;
36837         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36838         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
36839         int64_t ret_ref = tag_ptr(ret_copy, true);
36840         return ret_ref;
36841 }
36842
36843 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) {
36844         LDKChannelCounterparty this_ptr_conv;
36845         this_ptr_conv.inner = untag_ptr(this_ptr);
36846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36848         this_ptr_conv.is_owned = false;
36849         void* val_ptr = untag_ptr(val);
36850         CHECK_ACCESS(val_ptr);
36851         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36852         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36853         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
36854 }
36855
36856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36857         LDKChannelCounterparty this_ptr_conv;
36858         this_ptr_conv.inner = untag_ptr(this_ptr);
36859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36861         this_ptr_conv.is_owned = false;
36862         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
36863         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
36864         int64_t ret_ref = tag_ptr(ret_copy, true);
36865         return ret_ref;
36866 }
36867
36868 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) {
36869         LDKChannelCounterparty this_ptr_conv;
36870         this_ptr_conv.inner = untag_ptr(this_ptr);
36871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36873         this_ptr_conv.is_owned = false;
36874         void* val_ptr = untag_ptr(val);
36875         CHECK_ACCESS(val_ptr);
36876         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
36877         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
36878         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
36879 }
36880
36881 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) {
36882         LDKPublicKey node_id_arg_ref;
36883         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
36884         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
36885         LDKInitFeatures features_arg_conv;
36886         features_arg_conv.inner = untag_ptr(features_arg);
36887         features_arg_conv.is_owned = ptr_is_owned(features_arg);
36888         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
36889         features_arg_conv = InitFeatures_clone(&features_arg_conv);
36890         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
36891         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
36892         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
36893         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
36894         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
36895         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
36896         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
36897         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
36898         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
36899         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
36900         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
36901         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
36902         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
36903         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);
36904         int64_t ret_ref = 0;
36905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36907         return ret_ref;
36908 }
36909
36910 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
36911         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
36912         int64_t ret_ref = 0;
36913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36915         return ret_ref;
36916 }
36917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36918         LDKChannelCounterparty arg_conv;
36919         arg_conv.inner = untag_ptr(arg);
36920         arg_conv.is_owned = ptr_is_owned(arg);
36921         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36922         arg_conv.is_owned = false;
36923         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
36924         return ret_conv;
36925 }
36926
36927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36928         LDKChannelCounterparty orig_conv;
36929         orig_conv.inner = untag_ptr(orig);
36930         orig_conv.is_owned = ptr_is_owned(orig);
36931         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36932         orig_conv.is_owned = false;
36933         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
36934         int64_t ret_ref = 0;
36935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36937         return ret_ref;
36938 }
36939
36940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36941         LDKChannelDetails this_obj_conv;
36942         this_obj_conv.inner = untag_ptr(this_obj);
36943         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36945         ChannelDetails_free(this_obj_conv);
36946 }
36947
36948 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
36949         LDKChannelDetails this_ptr_conv;
36950         this_ptr_conv.inner = untag_ptr(this_ptr);
36951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36953         this_ptr_conv.is_owned = false;
36954         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36955         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
36956         return ret_arr;
36957 }
36958
36959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36960         LDKChannelDetails this_ptr_conv;
36961         this_ptr_conv.inner = untag_ptr(this_ptr);
36962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36964         this_ptr_conv.is_owned = false;
36965         LDKThirtyTwoBytes val_ref;
36966         CHECK((*env)->GetArrayLength(env, val) == 32);
36967         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36968         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
36969 }
36970
36971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
36972         LDKChannelDetails this_ptr_conv;
36973         this_ptr_conv.inner = untag_ptr(this_ptr);
36974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36976         this_ptr_conv.is_owned = false;
36977         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
36978         int64_t ret_ref = 0;
36979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36981         return ret_ref;
36982 }
36983
36984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36985         LDKChannelDetails this_ptr_conv;
36986         this_ptr_conv.inner = untag_ptr(this_ptr);
36987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36989         this_ptr_conv.is_owned = false;
36990         LDKChannelCounterparty val_conv;
36991         val_conv.inner = untag_ptr(val);
36992         val_conv.is_owned = ptr_is_owned(val);
36993         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36994         val_conv = ChannelCounterparty_clone(&val_conv);
36995         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
36996 }
36997
36998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
36999         LDKChannelDetails this_ptr_conv;
37000         this_ptr_conv.inner = untag_ptr(this_ptr);
37001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37003         this_ptr_conv.is_owned = false;
37004         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
37005         int64_t ret_ref = 0;
37006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37008         return ret_ref;
37009 }
37010
37011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37012         LDKChannelDetails this_ptr_conv;
37013         this_ptr_conv.inner = untag_ptr(this_ptr);
37014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37016         this_ptr_conv.is_owned = false;
37017         LDKOutPoint val_conv;
37018         val_conv.inner = untag_ptr(val);
37019         val_conv.is_owned = ptr_is_owned(val);
37020         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37021         val_conv = OutPoint_clone(&val_conv);
37022         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
37023 }
37024
37025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
37026         LDKChannelDetails this_ptr_conv;
37027         this_ptr_conv.inner = untag_ptr(this_ptr);
37028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37030         this_ptr_conv.is_owned = false;
37031         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
37032         int64_t ret_ref = 0;
37033         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37034         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37035         return ret_ref;
37036 }
37037
37038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37039         LDKChannelDetails this_ptr_conv;
37040         this_ptr_conv.inner = untag_ptr(this_ptr);
37041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37043         this_ptr_conv.is_owned = false;
37044         LDKChannelTypeFeatures val_conv;
37045         val_conv.inner = untag_ptr(val);
37046         val_conv.is_owned = ptr_is_owned(val);
37047         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37048         val_conv = ChannelTypeFeatures_clone(&val_conv);
37049         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
37050 }
37051
37052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37053         LDKChannelDetails this_ptr_conv;
37054         this_ptr_conv.inner = untag_ptr(this_ptr);
37055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37057         this_ptr_conv.is_owned = false;
37058         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37059         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
37060         int64_t ret_ref = tag_ptr(ret_copy, true);
37061         return ret_ref;
37062 }
37063
37064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37065         LDKChannelDetails this_ptr_conv;
37066         this_ptr_conv.inner = untag_ptr(this_ptr);
37067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37069         this_ptr_conv.is_owned = false;
37070         void* val_ptr = untag_ptr(val);
37071         CHECK_ACCESS(val_ptr);
37072         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37073         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37074         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
37075 }
37076
37077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
37078         LDKChannelDetails this_ptr_conv;
37079         this_ptr_conv.inner = untag_ptr(this_ptr);
37080         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37082         this_ptr_conv.is_owned = false;
37083         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37084         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
37085         int64_t ret_ref = tag_ptr(ret_copy, true);
37086         return ret_ref;
37087 }
37088
37089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37090         LDKChannelDetails this_ptr_conv;
37091         this_ptr_conv.inner = untag_ptr(this_ptr);
37092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37094         this_ptr_conv.is_owned = false;
37095         void* val_ptr = untag_ptr(val);
37096         CHECK_ACCESS(val_ptr);
37097         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37098         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37099         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
37100 }
37101
37102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
37103         LDKChannelDetails this_ptr_conv;
37104         this_ptr_conv.inner = untag_ptr(this_ptr);
37105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37107         this_ptr_conv.is_owned = false;
37108         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37109         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
37110         int64_t ret_ref = tag_ptr(ret_copy, true);
37111         return ret_ref;
37112 }
37113
37114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37115         LDKChannelDetails this_ptr_conv;
37116         this_ptr_conv.inner = untag_ptr(this_ptr);
37117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37119         this_ptr_conv.is_owned = false;
37120         void* val_ptr = untag_ptr(val);
37121         CHECK_ACCESS(val_ptr);
37122         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37123         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37124         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
37125 }
37126
37127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
37128         LDKChannelDetails this_ptr_conv;
37129         this_ptr_conv.inner = untag_ptr(this_ptr);
37130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37132         this_ptr_conv.is_owned = false;
37133         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
37134         return ret_conv;
37135 }
37136
37137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37138         LDKChannelDetails this_ptr_conv;
37139         this_ptr_conv.inner = untag_ptr(this_ptr);
37140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37142         this_ptr_conv.is_owned = false;
37143         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
37144 }
37145
37146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
37147         LDKChannelDetails this_ptr_conv;
37148         this_ptr_conv.inner = untag_ptr(this_ptr);
37149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37151         this_ptr_conv.is_owned = false;
37152         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37153         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
37154         int64_t ret_ref = tag_ptr(ret_copy, true);
37155         return ret_ref;
37156 }
37157
37158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37159         LDKChannelDetails this_ptr_conv;
37160         this_ptr_conv.inner = untag_ptr(this_ptr);
37161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37163         this_ptr_conv.is_owned = false;
37164         void* val_ptr = untag_ptr(val);
37165         CHECK_ACCESS(val_ptr);
37166         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37167         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37168         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
37169 }
37170
37171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
37172         LDKChannelDetails this_ptr_conv;
37173         this_ptr_conv.inner = untag_ptr(this_ptr);
37174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37176         this_ptr_conv.is_owned = false;
37177         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
37178         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
37179         return ret_arr;
37180 }
37181
37182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37183         LDKChannelDetails this_ptr_conv;
37184         this_ptr_conv.inner = untag_ptr(this_ptr);
37185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37187         this_ptr_conv.is_owned = false;
37188         LDKU128 val_ref;
37189         CHECK((*env)->GetArrayLength(env, val) == 16);
37190         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
37191         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
37192 }
37193
37194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
37195         LDKChannelDetails this_ptr_conv;
37196         this_ptr_conv.inner = untag_ptr(this_ptr);
37197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37199         this_ptr_conv.is_owned = false;
37200         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37201         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
37202         int64_t ret_ref = tag_ptr(ret_copy, true);
37203         return ret_ref;
37204 }
37205
37206 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) {
37207         LDKChannelDetails this_ptr_conv;
37208         this_ptr_conv.inner = untag_ptr(this_ptr);
37209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37211         this_ptr_conv.is_owned = false;
37212         void* val_ptr = untag_ptr(val);
37213         CHECK_ACCESS(val_ptr);
37214         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37215         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37216         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
37217 }
37218
37219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37220         LDKChannelDetails this_ptr_conv;
37221         this_ptr_conv.inner = untag_ptr(this_ptr);
37222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37224         this_ptr_conv.is_owned = false;
37225         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
37226         return ret_conv;
37227 }
37228
37229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37230         LDKChannelDetails this_ptr_conv;
37231         this_ptr_conv.inner = untag_ptr(this_ptr);
37232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37234         this_ptr_conv.is_owned = false;
37235         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
37236 }
37237
37238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37239         LDKChannelDetails this_ptr_conv;
37240         this_ptr_conv.inner = untag_ptr(this_ptr);
37241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37243         this_ptr_conv.is_owned = false;
37244         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
37245         return ret_conv;
37246 }
37247
37248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37249         LDKChannelDetails this_ptr_conv;
37250         this_ptr_conv.inner = untag_ptr(this_ptr);
37251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37253         this_ptr_conv.is_owned = false;
37254         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
37255 }
37256
37257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37258         LDKChannelDetails this_ptr_conv;
37259         this_ptr_conv.inner = untag_ptr(this_ptr);
37260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37262         this_ptr_conv.is_owned = false;
37263         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
37264         return ret_conv;
37265 }
37266
37267 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) {
37268         LDKChannelDetails this_ptr_conv;
37269         this_ptr_conv.inner = untag_ptr(this_ptr);
37270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37272         this_ptr_conv.is_owned = false;
37273         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
37274 }
37275
37276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37277         LDKChannelDetails this_ptr_conv;
37278         this_ptr_conv.inner = untag_ptr(this_ptr);
37279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37281         this_ptr_conv.is_owned = false;
37282         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
37283         return ret_conv;
37284 }
37285
37286 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) {
37287         LDKChannelDetails this_ptr_conv;
37288         this_ptr_conv.inner = untag_ptr(this_ptr);
37289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37291         this_ptr_conv.is_owned = false;
37292         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
37293 }
37294
37295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37296         LDKChannelDetails this_ptr_conv;
37297         this_ptr_conv.inner = untag_ptr(this_ptr);
37298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37300         this_ptr_conv.is_owned = false;
37301         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
37302         return ret_conv;
37303 }
37304
37305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37306         LDKChannelDetails this_ptr_conv;
37307         this_ptr_conv.inner = untag_ptr(this_ptr);
37308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37310         this_ptr_conv.is_owned = false;
37311         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
37312 }
37313
37314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
37315         LDKChannelDetails this_ptr_conv;
37316         this_ptr_conv.inner = untag_ptr(this_ptr);
37317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37319         this_ptr_conv.is_owned = false;
37320         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37321         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
37322         int64_t ret_ref = tag_ptr(ret_copy, true);
37323         return ret_ref;
37324 }
37325
37326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37327         LDKChannelDetails this_ptr_conv;
37328         this_ptr_conv.inner = untag_ptr(this_ptr);
37329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37331         this_ptr_conv.is_owned = false;
37332         void* val_ptr = untag_ptr(val);
37333         CHECK_ACCESS(val_ptr);
37334         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37335         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37336         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
37337 }
37338
37339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
37340         LDKChannelDetails this_ptr_conv;
37341         this_ptr_conv.inner = untag_ptr(this_ptr);
37342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37344         this_ptr_conv.is_owned = false;
37345         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37346         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
37347         int64_t ret_ref = tag_ptr(ret_copy, true);
37348         return ret_ref;
37349 }
37350
37351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37352         LDKChannelDetails this_ptr_conv;
37353         this_ptr_conv.inner = untag_ptr(this_ptr);
37354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37356         this_ptr_conv.is_owned = false;
37357         void* val_ptr = untag_ptr(val);
37358         CHECK_ACCESS(val_ptr);
37359         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37360         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37361         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
37362 }
37363
37364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
37365         LDKChannelDetails this_ptr_conv;
37366         this_ptr_conv.inner = untag_ptr(this_ptr);
37367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37369         this_ptr_conv.is_owned = false;
37370         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
37371         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
37372         int64_t ret_ref = tag_ptr(ret_copy, true);
37373         return ret_ref;
37374 }
37375
37376 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) {
37377         LDKChannelDetails this_ptr_conv;
37378         this_ptr_conv.inner = untag_ptr(this_ptr);
37379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37381         this_ptr_conv.is_owned = false;
37382         void* val_ptr = untag_ptr(val);
37383         CHECK_ACCESS(val_ptr);
37384         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
37385         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
37386         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
37387 }
37388
37389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
37390         LDKChannelDetails this_ptr_conv;
37391         this_ptr_conv.inner = untag_ptr(this_ptr);
37392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37394         this_ptr_conv.is_owned = false;
37395         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
37396         return ret_conv;
37397 }
37398
37399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37400         LDKChannelDetails this_ptr_conv;
37401         this_ptr_conv.inner = untag_ptr(this_ptr);
37402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37404         this_ptr_conv.is_owned = false;
37405         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
37406 }
37407
37408 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
37409         LDKChannelDetails this_ptr_conv;
37410         this_ptr_conv.inner = untag_ptr(this_ptr);
37411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37413         this_ptr_conv.is_owned = false;
37414         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
37415         return ret_conv;
37416 }
37417
37418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37419         LDKChannelDetails this_ptr_conv;
37420         this_ptr_conv.inner = untag_ptr(this_ptr);
37421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37423         this_ptr_conv.is_owned = false;
37424         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
37425 }
37426
37427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
37428         LDKChannelDetails this_ptr_conv;
37429         this_ptr_conv.inner = untag_ptr(this_ptr);
37430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37432         this_ptr_conv.is_owned = false;
37433         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
37434         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
37435         int64_t ret_ref = tag_ptr(ret_copy, true);
37436         return ret_ref;
37437 }
37438
37439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37440         LDKChannelDetails this_ptr_conv;
37441         this_ptr_conv.inner = untag_ptr(this_ptr);
37442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37444         this_ptr_conv.is_owned = false;
37445         void* val_ptr = untag_ptr(val);
37446         CHECK_ACCESS(val_ptr);
37447         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
37448         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
37449         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
37450 }
37451
37452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
37453         LDKChannelDetails this_ptr_conv;
37454         this_ptr_conv.inner = untag_ptr(this_ptr);
37455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37457         this_ptr_conv.is_owned = false;
37458         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
37459         return ret_conv;
37460 }
37461
37462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37463         LDKChannelDetails this_ptr_conv;
37464         this_ptr_conv.inner = untag_ptr(this_ptr);
37465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37467         this_ptr_conv.is_owned = false;
37468         ChannelDetails_set_is_usable(&this_ptr_conv, val);
37469 }
37470
37471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
37472         LDKChannelDetails this_ptr_conv;
37473         this_ptr_conv.inner = untag_ptr(this_ptr);
37474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37476         this_ptr_conv.is_owned = false;
37477         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
37478         return ret_conv;
37479 }
37480
37481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37482         LDKChannelDetails this_ptr_conv;
37483         this_ptr_conv.inner = untag_ptr(this_ptr);
37484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37486         this_ptr_conv.is_owned = false;
37487         ChannelDetails_set_is_public(&this_ptr_conv, val);
37488 }
37489
37490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37491         LDKChannelDetails this_ptr_conv;
37492         this_ptr_conv.inner = untag_ptr(this_ptr);
37493         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37495         this_ptr_conv.is_owned = false;
37496         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37497         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
37498         int64_t ret_ref = tag_ptr(ret_copy, true);
37499         return ret_ref;
37500 }
37501
37502 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) {
37503         LDKChannelDetails this_ptr_conv;
37504         this_ptr_conv.inner = untag_ptr(this_ptr);
37505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37507         this_ptr_conv.is_owned = false;
37508         void* val_ptr = untag_ptr(val);
37509         CHECK_ACCESS(val_ptr);
37510         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37511         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37512         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
37513 }
37514
37515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37516         LDKChannelDetails this_ptr_conv;
37517         this_ptr_conv.inner = untag_ptr(this_ptr);
37518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37520         this_ptr_conv.is_owned = false;
37521         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37522         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
37523         int64_t ret_ref = tag_ptr(ret_copy, true);
37524         return ret_ref;
37525 }
37526
37527 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) {
37528         LDKChannelDetails this_ptr_conv;
37529         this_ptr_conv.inner = untag_ptr(this_ptr);
37530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37532         this_ptr_conv.is_owned = false;
37533         void* val_ptr = untag_ptr(val);
37534         CHECK_ACCESS(val_ptr);
37535         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37536         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37537         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
37538 }
37539
37540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
37541         LDKChannelDetails this_ptr_conv;
37542         this_ptr_conv.inner = untag_ptr(this_ptr);
37543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37545         this_ptr_conv.is_owned = false;
37546         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
37547         int64_t ret_ref = 0;
37548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37550         return ret_ref;
37551 }
37552
37553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37554         LDKChannelDetails this_ptr_conv;
37555         this_ptr_conv.inner = untag_ptr(this_ptr);
37556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37558         this_ptr_conv.is_owned = false;
37559         LDKChannelConfig val_conv;
37560         val_conv.inner = untag_ptr(val);
37561         val_conv.is_owned = ptr_is_owned(val);
37562         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37563         val_conv = ChannelConfig_clone(&val_conv);
37564         ChannelDetails_set_config(&this_ptr_conv, val_conv);
37565 }
37566
37567 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) {
37568         LDKThirtyTwoBytes channel_id_arg_ref;
37569         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
37570         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
37571         LDKChannelCounterparty counterparty_arg_conv;
37572         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
37573         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
37574         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
37575         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
37576         LDKOutPoint funding_txo_arg_conv;
37577         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
37578         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
37579         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
37580         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
37581         LDKChannelTypeFeatures channel_type_arg_conv;
37582         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
37583         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
37584         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
37585         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
37586         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
37587         CHECK_ACCESS(short_channel_id_arg_ptr);
37588         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
37589         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
37590         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
37591         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
37592         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
37593         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
37594         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
37595         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
37596         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
37597         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
37598         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
37599         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
37600         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
37601         LDKU128 user_channel_id_arg_ref;
37602         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
37603         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
37604         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
37605         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
37606         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
37607         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
37608         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
37609         CHECK_ACCESS(confirmations_required_arg_ptr);
37610         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
37611         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
37612         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
37613         CHECK_ACCESS(confirmations_arg_ptr);
37614         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
37615         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
37616         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
37617         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
37618         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
37619         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
37620         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
37621         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
37622         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
37623         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
37624         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
37625         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
37626         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
37627         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
37628         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
37629         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
37630         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
37631         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
37632         LDKChannelConfig config_arg_conv;
37633         config_arg_conv.inner = untag_ptr(config_arg);
37634         config_arg_conv.is_owned = ptr_is_owned(config_arg);
37635         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
37636         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
37637         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);
37638         int64_t ret_ref = 0;
37639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37641         return ret_ref;
37642 }
37643
37644 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
37645         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
37646         int64_t ret_ref = 0;
37647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37649         return ret_ref;
37650 }
37651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37652         LDKChannelDetails arg_conv;
37653         arg_conv.inner = untag_ptr(arg);
37654         arg_conv.is_owned = ptr_is_owned(arg);
37655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37656         arg_conv.is_owned = false;
37657         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
37658         return ret_conv;
37659 }
37660
37661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37662         LDKChannelDetails orig_conv;
37663         orig_conv.inner = untag_ptr(orig);
37664         orig_conv.is_owned = ptr_is_owned(orig);
37665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37666         orig_conv.is_owned = false;
37667         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
37668         int64_t ret_ref = 0;
37669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37671         return ret_ref;
37672 }
37673
37674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
37675         LDKChannelDetails this_arg_conv;
37676         this_arg_conv.inner = untag_ptr(this_arg);
37677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37679         this_arg_conv.is_owned = false;
37680         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37681         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
37682         int64_t ret_ref = tag_ptr(ret_copy, true);
37683         return ret_ref;
37684 }
37685
37686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
37687         LDKChannelDetails this_arg_conv;
37688         this_arg_conv.inner = untag_ptr(this_arg);
37689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37691         this_arg_conv.is_owned = false;
37692         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37693         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
37694         int64_t ret_ref = tag_ptr(ret_copy, true);
37695         return ret_ref;
37696 }
37697
37698 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37699         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
37700         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
37701         return ret_conv;
37702 }
37703
37704 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
37705         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
37706         return ret_conv;
37707 }
37708
37709 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
37710         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
37711         return ret_conv;
37712 }
37713
37714 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
37715         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
37716         return ret_conv;
37717 }
37718
37719 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
37720         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
37721         return ret_conv;
37722 }
37723
37724 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
37725         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
37726         return ret_conv;
37727 }
37728
37729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37730         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
37731         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
37732         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
37733         return ret_conv;
37734 }
37735
37736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37737         if (!ptr_is_owned(this_ptr)) return;
37738         void* this_ptr_ptr = untag_ptr(this_ptr);
37739         CHECK_ACCESS(this_ptr_ptr);
37740         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
37741         FREE(untag_ptr(this_ptr));
37742         RecentPaymentDetails_free(this_ptr_conv);
37743 }
37744
37745 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
37746         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37747         *ret_copy = RecentPaymentDetails_clone(arg);
37748         int64_t ret_ref = tag_ptr(ret_copy, true);
37749         return ret_ref;
37750 }
37751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37752         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
37753         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
37754         return ret_conv;
37755 }
37756
37757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37758         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
37759         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37760         *ret_copy = RecentPaymentDetails_clone(orig_conv);
37761         int64_t ret_ref = tag_ptr(ret_copy, true);
37762         return ret_ref;
37763 }
37764
37765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1pending(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t total_msat) {
37766         LDKThirtyTwoBytes payment_hash_ref;
37767         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37768         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37769         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37770         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
37771         int64_t ret_ref = tag_ptr(ret_copy, true);
37772         return ret_ref;
37773 }
37774
37775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int64_t payment_hash) {
37776         void* payment_hash_ptr = untag_ptr(payment_hash);
37777         CHECK_ACCESS(payment_hash_ptr);
37778         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
37779         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
37780         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37781         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_conv);
37782         int64_t ret_ref = tag_ptr(ret_copy, true);
37783         return ret_ref;
37784 }
37785
37786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
37787         LDKThirtyTwoBytes payment_hash_ref;
37788         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
37789         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
37790         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
37791         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
37792         int64_t ret_ref = tag_ptr(ret_copy, true);
37793         return ret_ref;
37794 }
37795
37796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37797         LDKPhantomRouteHints this_obj_conv;
37798         this_obj_conv.inner = untag_ptr(this_obj);
37799         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37801         PhantomRouteHints_free(this_obj_conv);
37802 }
37803
37804 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
37805         LDKPhantomRouteHints this_ptr_conv;
37806         this_ptr_conv.inner = untag_ptr(this_ptr);
37807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37809         this_ptr_conv.is_owned = false;
37810         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
37811         int64_tArray ret_arr = NULL;
37812         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
37813         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
37814         for (size_t q = 0; q < ret_var.datalen; q++) {
37815                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
37816                 int64_t ret_conv_16_ref = 0;
37817                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
37818                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
37819                 ret_arr_ptr[q] = ret_conv_16_ref;
37820         }
37821         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
37822         FREE(ret_var.data);
37823         return ret_arr;
37824 }
37825
37826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
37827         LDKPhantomRouteHints this_ptr_conv;
37828         this_ptr_conv.inner = untag_ptr(this_ptr);
37829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37831         this_ptr_conv.is_owned = false;
37832         LDKCVec_ChannelDetailsZ val_constr;
37833         val_constr.datalen = (*env)->GetArrayLength(env, val);
37834         if (val_constr.datalen > 0)
37835                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37836         else
37837                 val_constr.data = NULL;
37838         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
37839         for (size_t q = 0; q < val_constr.datalen; q++) {
37840                 int64_t val_conv_16 = val_vals[q];
37841                 LDKChannelDetails val_conv_16_conv;
37842                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
37843                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
37844                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
37845                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
37846                 val_constr.data[q] = val_conv_16_conv;
37847         }
37848         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
37849         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
37850 }
37851
37852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
37853         LDKPhantomRouteHints this_ptr_conv;
37854         this_ptr_conv.inner = untag_ptr(this_ptr);
37855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37857         this_ptr_conv.is_owned = false;
37858         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
37859         return ret_conv;
37860 }
37861
37862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37863         LDKPhantomRouteHints this_ptr_conv;
37864         this_ptr_conv.inner = untag_ptr(this_ptr);
37865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37867         this_ptr_conv.is_owned = false;
37868         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
37869 }
37870
37871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37872         LDKPhantomRouteHints this_ptr_conv;
37873         this_ptr_conv.inner = untag_ptr(this_ptr);
37874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37876         this_ptr_conv.is_owned = false;
37877         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37878         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
37879         return ret_arr;
37880 }
37881
37882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37883         LDKPhantomRouteHints this_ptr_conv;
37884         this_ptr_conv.inner = untag_ptr(this_ptr);
37885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37887         this_ptr_conv.is_owned = false;
37888         LDKPublicKey val_ref;
37889         CHECK((*env)->GetArrayLength(env, val) == 33);
37890         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37891         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
37892 }
37893
37894 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) {
37895         LDKCVec_ChannelDetailsZ channels_arg_constr;
37896         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
37897         if (channels_arg_constr.datalen > 0)
37898                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
37899         else
37900                 channels_arg_constr.data = NULL;
37901         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
37902         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
37903                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
37904                 LDKChannelDetails channels_arg_conv_16_conv;
37905                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
37906                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
37907                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
37908                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
37909                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
37910         }
37911         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
37912         LDKPublicKey real_node_pubkey_arg_ref;
37913         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
37914         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
37915         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
37916         int64_t ret_ref = 0;
37917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37919         return ret_ref;
37920 }
37921
37922 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
37923         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
37924         int64_t ret_ref = 0;
37925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37927         return ret_ref;
37928 }
37929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37930         LDKPhantomRouteHints arg_conv;
37931         arg_conv.inner = untag_ptr(arg);
37932         arg_conv.is_owned = ptr_is_owned(arg);
37933         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37934         arg_conv.is_owned = false;
37935         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
37936         return ret_conv;
37937 }
37938
37939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37940         LDKPhantomRouteHints orig_conv;
37941         orig_conv.inner = untag_ptr(orig);
37942         orig_conv.is_owned = ptr_is_owned(orig);
37943         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37944         orig_conv.is_owned = false;
37945         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
37946         int64_t ret_ref = 0;
37947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37949         return ret_ref;
37950 }
37951
37952 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) {
37953         void* fee_est_ptr = untag_ptr(fee_est);
37954         CHECK_ACCESS(fee_est_ptr);
37955         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
37956         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
37957                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37958                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
37959         }
37960         void* chain_monitor_ptr = untag_ptr(chain_monitor);
37961         CHECK_ACCESS(chain_monitor_ptr);
37962         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
37963         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
37964                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37965                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
37966         }
37967         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
37968         CHECK_ACCESS(tx_broadcaster_ptr);
37969         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
37970         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
37971                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37972                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
37973         }
37974         void* router_ptr = untag_ptr(router);
37975         CHECK_ACCESS(router_ptr);
37976         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
37977         if (router_conv.free == LDKRouter_JCalls_free) {
37978                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37979                 LDKRouter_JCalls_cloned(&router_conv);
37980         }
37981         void* logger_ptr = untag_ptr(logger);
37982         CHECK_ACCESS(logger_ptr);
37983         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37984         if (logger_conv.free == LDKLogger_JCalls_free) {
37985                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37986                 LDKLogger_JCalls_cloned(&logger_conv);
37987         }
37988         void* entropy_source_ptr = untag_ptr(entropy_source);
37989         CHECK_ACCESS(entropy_source_ptr);
37990         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
37991         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
37992                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37993                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
37994         }
37995         void* node_signer_ptr = untag_ptr(node_signer);
37996         CHECK_ACCESS(node_signer_ptr);
37997         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
37998         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
37999                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38000                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
38001         }
38002         void* signer_provider_ptr = untag_ptr(signer_provider);
38003         CHECK_ACCESS(signer_provider_ptr);
38004         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
38005         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
38006                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38007                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
38008         }
38009         LDKUserConfig config_conv;
38010         config_conv.inner = untag_ptr(config);
38011         config_conv.is_owned = ptr_is_owned(config);
38012         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38013         config_conv = UserConfig_clone(&config_conv);
38014         LDKChainParameters params_conv;
38015         params_conv.inner = untag_ptr(params);
38016         params_conv.is_owned = ptr_is_owned(params);
38017         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
38018         params_conv = ChainParameters_clone(&params_conv);
38019         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);
38020         int64_t ret_ref = 0;
38021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38023         return ret_ref;
38024 }
38025
38026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
38027         LDKChannelManager this_arg_conv;
38028         this_arg_conv.inner = untag_ptr(this_arg);
38029         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38031         this_arg_conv.is_owned = false;
38032         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
38033         int64_t ret_ref = 0;
38034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38036         return ret_ref;
38037 }
38038
38039 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) {
38040         LDKChannelManager this_arg_conv;
38041         this_arg_conv.inner = untag_ptr(this_arg);
38042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38044         this_arg_conv.is_owned = false;
38045         LDKPublicKey their_network_key_ref;
38046         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
38047         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
38048         LDKU128 user_channel_id_ref;
38049         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
38050         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
38051         LDKUserConfig override_config_conv;
38052         override_config_conv.inner = untag_ptr(override_config);
38053         override_config_conv.is_owned = ptr_is_owned(override_config);
38054         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
38055         override_config_conv = UserConfig_clone(&override_config_conv);
38056         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
38057         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
38058         return tag_ptr(ret_conv, true);
38059 }
38060
38061 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
38062         LDKChannelManager this_arg_conv;
38063         this_arg_conv.inner = untag_ptr(this_arg);
38064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38066         this_arg_conv.is_owned = false;
38067         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
38068         int64_tArray ret_arr = NULL;
38069         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38070         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38071         for (size_t q = 0; q < ret_var.datalen; q++) {
38072                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38073                 int64_t ret_conv_16_ref = 0;
38074                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38075                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38076                 ret_arr_ptr[q] = ret_conv_16_ref;
38077         }
38078         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38079         FREE(ret_var.data);
38080         return ret_arr;
38081 }
38082
38083 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
38084         LDKChannelManager this_arg_conv;
38085         this_arg_conv.inner = untag_ptr(this_arg);
38086         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38087         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38088         this_arg_conv.is_owned = false;
38089         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
38090         int64_tArray ret_arr = NULL;
38091         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38092         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38093         for (size_t q = 0; q < ret_var.datalen; q++) {
38094                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38095                 int64_t ret_conv_16_ref = 0;
38096                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38097                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38098                 ret_arr_ptr[q] = ret_conv_16_ref;
38099         }
38100         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38101         FREE(ret_var.data);
38102         return ret_arr;
38103 }
38104
38105 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) {
38106         LDKChannelManager this_arg_conv;
38107         this_arg_conv.inner = untag_ptr(this_arg);
38108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38110         this_arg_conv.is_owned = false;
38111         LDKPublicKey counterparty_node_id_ref;
38112         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38113         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38114         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
38115         int64_tArray ret_arr = NULL;
38116         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38117         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38118         for (size_t q = 0; q < ret_var.datalen; q++) {
38119                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
38120                 int64_t ret_conv_16_ref = 0;
38121                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
38122                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
38123                 ret_arr_ptr[q] = ret_conv_16_ref;
38124         }
38125         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38126         FREE(ret_var.data);
38127         return ret_arr;
38128 }
38129
38130 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
38131         LDKChannelManager this_arg_conv;
38132         this_arg_conv.inner = untag_ptr(this_arg);
38133         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38135         this_arg_conv.is_owned = false;
38136         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
38137         int64_tArray ret_arr = NULL;
38138         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
38139         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
38140         for (size_t w = 0; w < ret_var.datalen; w++) {
38141                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
38142                 *ret_conv_22_copy = ret_var.data[w];
38143                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
38144                 ret_arr_ptr[w] = ret_conv_22_ref;
38145         }
38146         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
38147         FREE(ret_var.data);
38148         return ret_arr;
38149 }
38150
38151 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) {
38152         LDKChannelManager this_arg_conv;
38153         this_arg_conv.inner = untag_ptr(this_arg);
38154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38156         this_arg_conv.is_owned = false;
38157         uint8_t channel_id_arr[32];
38158         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
38159         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
38160         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38161         LDKPublicKey counterparty_node_id_ref;
38162         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38163         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38164         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38165         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38166         return tag_ptr(ret_conv, true);
38167 }
38168
38169 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) {
38170         LDKChannelManager this_arg_conv;
38171         this_arg_conv.inner = untag_ptr(this_arg);
38172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38174         this_arg_conv.is_owned = false;
38175         uint8_t channel_id_arr[32];
38176         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
38177         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
38178         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38179         LDKPublicKey counterparty_node_id_ref;
38180         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38181         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38182         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
38183         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
38184         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
38185         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
38186         LDKShutdownScript shutdown_script_conv;
38187         shutdown_script_conv.inner = untag_ptr(shutdown_script);
38188         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
38189         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
38190         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
38191         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38192         *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);
38193         return tag_ptr(ret_conv, true);
38194 }
38195
38196 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) {
38197         LDKChannelManager this_arg_conv;
38198         this_arg_conv.inner = untag_ptr(this_arg);
38199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38201         this_arg_conv.is_owned = false;
38202         uint8_t channel_id_arr[32];
38203         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
38204         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
38205         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38206         LDKPublicKey counterparty_node_id_ref;
38207         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38208         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38209         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38210         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38211         return tag_ptr(ret_conv, true);
38212 }
38213
38214 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) {
38215         LDKChannelManager this_arg_conv;
38216         this_arg_conv.inner = untag_ptr(this_arg);
38217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38219         this_arg_conv.is_owned = false;
38220         uint8_t channel_id_arr[32];
38221         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
38222         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
38223         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
38224         LDKPublicKey counterparty_node_id_ref;
38225         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38226         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38227         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38228         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
38229         return tag_ptr(ret_conv, true);
38230 }
38231
38232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
38233         LDKChannelManager this_arg_conv;
38234         this_arg_conv.inner = untag_ptr(this_arg);
38235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38237         this_arg_conv.is_owned = false;
38238         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
38239 }
38240
38241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
38242         LDKChannelManager this_arg_conv;
38243         this_arg_conv.inner = untag_ptr(this_arg);
38244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38246         this_arg_conv.is_owned = false;
38247         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
38248 }
38249
38250 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) {
38251         LDKChannelManager this_arg_conv;
38252         this_arg_conv.inner = untag_ptr(this_arg);
38253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38255         this_arg_conv.is_owned = false;
38256         LDKRoute route_conv;
38257         route_conv.inner = untag_ptr(route);
38258         route_conv.is_owned = ptr_is_owned(route);
38259         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38260         route_conv.is_owned = false;
38261         LDKThirtyTwoBytes payment_hash_ref;
38262         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38263         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38264         LDKRecipientOnionFields recipient_onion_conv;
38265         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38266         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38267         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38268         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38269         LDKThirtyTwoBytes payment_id_ref;
38270         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38271         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38272         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
38273         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
38274         return tag_ptr(ret_conv, true);
38275 }
38276
38277 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) {
38278         LDKChannelManager this_arg_conv;
38279         this_arg_conv.inner = untag_ptr(this_arg);
38280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38282         this_arg_conv.is_owned = false;
38283         LDKThirtyTwoBytes payment_hash_ref;
38284         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38285         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38286         LDKRecipientOnionFields recipient_onion_conv;
38287         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38288         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38289         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38290         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38291         LDKThirtyTwoBytes payment_id_ref;
38292         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38293         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38294         LDKRouteParameters route_params_conv;
38295         route_params_conv.inner = untag_ptr(route_params);
38296         route_params_conv.is_owned = ptr_is_owned(route_params);
38297         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38298         route_params_conv = RouteParameters_clone(&route_params_conv);
38299         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38300         CHECK_ACCESS(retry_strategy_ptr);
38301         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38302         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38303         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
38304         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
38305         return tag_ptr(ret_conv, true);
38306 }
38307
38308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
38309         LDKChannelManager this_arg_conv;
38310         this_arg_conv.inner = untag_ptr(this_arg);
38311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38313         this_arg_conv.is_owned = false;
38314         LDKThirtyTwoBytes payment_id_ref;
38315         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38316         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38317         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
38318 }
38319
38320 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) {
38321         LDKChannelManager this_arg_conv;
38322         this_arg_conv.inner = untag_ptr(this_arg);
38323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38325         this_arg_conv.is_owned = false;
38326         LDKRoute route_conv;
38327         route_conv.inner = untag_ptr(route);
38328         route_conv.is_owned = ptr_is_owned(route);
38329         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
38330         route_conv.is_owned = false;
38331         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38332         CHECK_ACCESS(payment_preimage_ptr);
38333         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
38334         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
38335         LDKRecipientOnionFields recipient_onion_conv;
38336         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38337         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38338         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38339         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38340         LDKThirtyTwoBytes payment_id_ref;
38341         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38342         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38343         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
38344         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
38345         return tag_ptr(ret_conv, true);
38346 }
38347
38348 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) {
38349         LDKChannelManager this_arg_conv;
38350         this_arg_conv.inner = untag_ptr(this_arg);
38351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38353         this_arg_conv.is_owned = false;
38354         void* payment_preimage_ptr = untag_ptr(payment_preimage);
38355         CHECK_ACCESS(payment_preimage_ptr);
38356         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
38357         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
38358         LDKRecipientOnionFields recipient_onion_conv;
38359         recipient_onion_conv.inner = untag_ptr(recipient_onion);
38360         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
38361         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
38362         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
38363         LDKThirtyTwoBytes payment_id_ref;
38364         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
38365         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
38366         LDKRouteParameters route_params_conv;
38367         route_params_conv.inner = untag_ptr(route_params);
38368         route_params_conv.is_owned = ptr_is_owned(route_params);
38369         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
38370         route_params_conv = RouteParameters_clone(&route_params_conv);
38371         void* retry_strategy_ptr = untag_ptr(retry_strategy);
38372         CHECK_ACCESS(retry_strategy_ptr);
38373         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
38374         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
38375         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
38376         *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);
38377         return tag_ptr(ret_conv, true);
38378 }
38379
38380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
38381         LDKChannelManager this_arg_conv;
38382         this_arg_conv.inner = untag_ptr(this_arg);
38383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38385         this_arg_conv.is_owned = false;
38386         LDKPath path_conv;
38387         path_conv.inner = untag_ptr(path);
38388         path_conv.is_owned = ptr_is_owned(path);
38389         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
38390         path_conv = Path_clone(&path_conv);
38391         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
38392         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
38393         return tag_ptr(ret_conv, true);
38394 }
38395
38396 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) {
38397         LDKChannelManager this_arg_conv;
38398         this_arg_conv.inner = untag_ptr(this_arg);
38399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38401         this_arg_conv.is_owned = false;
38402         uint8_t temporary_channel_id_arr[32];
38403         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
38404         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
38405         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38406         LDKPublicKey counterparty_node_id_ref;
38407         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38408         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38409         LDKTransaction funding_transaction_ref;
38410         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
38411         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
38412         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
38413         funding_transaction_ref.data_is_owned = true;
38414         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38415         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
38416         return tag_ptr(ret_conv, true);
38417 }
38418
38419 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) {
38420         LDKChannelManager this_arg_conv;
38421         this_arg_conv.inner = untag_ptr(this_arg);
38422         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38424         this_arg_conv.is_owned = false;
38425         LDKPublicKey counterparty_node_id_ref;
38426         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38427         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38428         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38429         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
38430         if (channel_ids_constr.datalen > 0)
38431                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38432         else
38433                 channel_ids_constr.data = NULL;
38434         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
38435                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
38436                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
38437                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
38438                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
38439                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
38440         }
38441         LDKChannelConfigUpdate config_update_conv;
38442         config_update_conv.inner = untag_ptr(config_update);
38443         config_update_conv.is_owned = ptr_is_owned(config_update);
38444         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
38445         config_update_conv.is_owned = false;
38446         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38447         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
38448         return tag_ptr(ret_conv, true);
38449 }
38450
38451 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) {
38452         LDKChannelManager this_arg_conv;
38453         this_arg_conv.inner = untag_ptr(this_arg);
38454         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38456         this_arg_conv.is_owned = false;
38457         LDKPublicKey counterparty_node_id_ref;
38458         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38459         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38460         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
38461         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
38462         if (channel_ids_constr.datalen > 0)
38463                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
38464         else
38465                 channel_ids_constr.data = NULL;
38466         for (size_t i = 0; i < channel_ids_constr.datalen; i++) {
38467                 int8_tArray channel_ids_conv_8 = (*env)->GetObjectArrayElement(env, channel_ids, i);
38468                 LDKThirtyTwoBytes channel_ids_conv_8_ref;
38469                 CHECK((*env)->GetArrayLength(env, channel_ids_conv_8) == 32);
38470                 (*env)->GetByteArrayRegion(env, channel_ids_conv_8, 0, 32, channel_ids_conv_8_ref.data);
38471                 channel_ids_constr.data[i] = channel_ids_conv_8_ref;
38472         }
38473         LDKChannelConfig config_conv;
38474         config_conv.inner = untag_ptr(config);
38475         config_conv.is_owned = ptr_is_owned(config);
38476         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38477         config_conv.is_owned = false;
38478         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38479         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
38480         return tag_ptr(ret_conv, true);
38481 }
38482
38483 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) {
38484         LDKChannelManager this_arg_conv;
38485         this_arg_conv.inner = untag_ptr(this_arg);
38486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38488         this_arg_conv.is_owned = false;
38489         LDKThirtyTwoBytes intercept_id_ref;
38490         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
38491         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
38492         uint8_t next_hop_channel_id_arr[32];
38493         CHECK((*env)->GetArrayLength(env, next_hop_channel_id) == 32);
38494         (*env)->GetByteArrayRegion(env, next_hop_channel_id, 0, 32, next_hop_channel_id_arr);
38495         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
38496         LDKPublicKey next_node_id_ref;
38497         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
38498         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
38499         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38500         *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);
38501         return tag_ptr(ret_conv, true);
38502 }
38503
38504 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) {
38505         LDKChannelManager this_arg_conv;
38506         this_arg_conv.inner = untag_ptr(this_arg);
38507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38509         this_arg_conv.is_owned = false;
38510         LDKThirtyTwoBytes intercept_id_ref;
38511         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
38512         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
38513         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38514         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
38515         return tag_ptr(ret_conv, true);
38516 }
38517
38518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
38519         LDKChannelManager this_arg_conv;
38520         this_arg_conv.inner = untag_ptr(this_arg);
38521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38523         this_arg_conv.is_owned = false;
38524         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
38525 }
38526
38527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
38528         LDKChannelManager this_arg_conv;
38529         this_arg_conv.inner = untag_ptr(this_arg);
38530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38532         this_arg_conv.is_owned = false;
38533         ChannelManager_timer_tick_occurred(&this_arg_conv);
38534 }
38535
38536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
38537         LDKChannelManager this_arg_conv;
38538         this_arg_conv.inner = untag_ptr(this_arg);
38539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38541         this_arg_conv.is_owned = false;
38542         uint8_t payment_hash_arr[32];
38543         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38544         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
38545         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
38546         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
38547 }
38548
38549 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) {
38550         LDKChannelManager this_arg_conv;
38551         this_arg_conv.inner = untag_ptr(this_arg);
38552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38554         this_arg_conv.is_owned = false;
38555         uint8_t payment_hash_arr[32];
38556         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38557         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
38558         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
38559         LDKFailureCode failure_code_conv = LDKFailureCode_from_java(env, failure_code);
38560         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
38561 }
38562
38563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
38564         LDKChannelManager this_arg_conv;
38565         this_arg_conv.inner = untag_ptr(this_arg);
38566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38568         this_arg_conv.is_owned = false;
38569         LDKThirtyTwoBytes payment_preimage_ref;
38570         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
38571         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
38572         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
38573 }
38574
38575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
38576         LDKChannelManager this_arg_conv;
38577         this_arg_conv.inner = untag_ptr(this_arg);
38578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38580         this_arg_conv.is_owned = false;
38581         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38582         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
38583         return ret_arr;
38584 }
38585
38586 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) {
38587         LDKChannelManager this_arg_conv;
38588         this_arg_conv.inner = untag_ptr(this_arg);
38589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38591         this_arg_conv.is_owned = false;
38592         uint8_t temporary_channel_id_arr[32];
38593         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
38594         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
38595         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38596         LDKPublicKey counterparty_node_id_ref;
38597         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38598         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38599         LDKU128 user_channel_id_ref;
38600         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
38601         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
38602         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38603         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
38604         return tag_ptr(ret_conv, true);
38605 }
38606
38607 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) {
38608         LDKChannelManager this_arg_conv;
38609         this_arg_conv.inner = untag_ptr(this_arg);
38610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38612         this_arg_conv.is_owned = false;
38613         uint8_t temporary_channel_id_arr[32];
38614         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
38615         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
38616         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
38617         LDKPublicKey counterparty_node_id_ref;
38618         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
38619         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
38620         LDKU128 user_channel_id_ref;
38621         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
38622         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
38623         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
38624         *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);
38625         return tag_ptr(ret_conv, true);
38626 }
38627
38628 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) {
38629         LDKChannelManager this_arg_conv;
38630         this_arg_conv.inner = untag_ptr(this_arg);
38631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38633         this_arg_conv.is_owned = false;
38634         void* min_value_msat_ptr = untag_ptr(min_value_msat);
38635         CHECK_ACCESS(min_value_msat_ptr);
38636         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
38637         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
38638         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
38639         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
38640         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
38641         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
38642         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
38643         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
38644         return tag_ptr(ret_conv, true);
38645 }
38646
38647 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) {
38648         LDKChannelManager this_arg_conv;
38649         this_arg_conv.inner = untag_ptr(this_arg);
38650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38652         this_arg_conv.is_owned = false;
38653         LDKThirtyTwoBytes payment_hash_ref;
38654         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38655         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38656         void* min_value_msat_ptr = untag_ptr(min_value_msat);
38657         CHECK_ACCESS(min_value_msat_ptr);
38658         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
38659         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
38660         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
38661         CHECK_ACCESS(min_final_cltv_expiry_ptr);
38662         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
38663         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
38664         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
38665         *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);
38666         return tag_ptr(ret_conv, true);
38667 }
38668
38669 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) {
38670         LDKChannelManager this_arg_conv;
38671         this_arg_conv.inner = untag_ptr(this_arg);
38672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38674         this_arg_conv.is_owned = false;
38675         LDKThirtyTwoBytes payment_hash_ref;
38676         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
38677         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
38678         LDKThirtyTwoBytes payment_secret_ref;
38679         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
38680         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
38681         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
38682         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
38683         return tag_ptr(ret_conv, true);
38684 }
38685
38686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
38687         LDKChannelManager this_arg_conv;
38688         this_arg_conv.inner = untag_ptr(this_arg);
38689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38691         this_arg_conv.is_owned = false;
38692         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
38693         return ret_conv;
38694 }
38695
38696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
38697         LDKChannelManager this_arg_conv;
38698         this_arg_conv.inner = untag_ptr(this_arg);
38699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38701         this_arg_conv.is_owned = false;
38702         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
38703         int64_t ret_ref = 0;
38704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38706         return ret_ref;
38707 }
38708
38709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
38710         LDKChannelManager this_arg_conv;
38711         this_arg_conv.inner = untag_ptr(this_arg);
38712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38714         this_arg_conv.is_owned = false;
38715         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
38716         return ret_conv;
38717 }
38718
38719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
38720         LDKChannelManager this_arg_conv;
38721         this_arg_conv.inner = untag_ptr(this_arg);
38722         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38724         this_arg_conv.is_owned = false;
38725         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
38726         int64_t ret_ref = 0;
38727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38729         return ret_ref;
38730 }
38731
38732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38733         LDKChannelManager this_arg_conv;
38734         this_arg_conv.inner = untag_ptr(this_arg);
38735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38737         this_arg_conv.is_owned = false;
38738         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
38739         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
38740         return tag_ptr(ret_ret, true);
38741 }
38742
38743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
38744         LDKChannelManager this_arg_conv;
38745         this_arg_conv.inner = untag_ptr(this_arg);
38746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38748         this_arg_conv.is_owned = false;
38749         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
38750         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
38751         return tag_ptr(ret_ret, true);
38752 }
38753
38754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
38755         LDKChannelManager this_arg_conv;
38756         this_arg_conv.inner = untag_ptr(this_arg);
38757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38759         this_arg_conv.is_owned = false;
38760         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
38761         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
38762         return tag_ptr(ret_ret, true);
38763 }
38764
38765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
38766         LDKChannelManager this_arg_conv;
38767         this_arg_conv.inner = untag_ptr(this_arg);
38768         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38770         this_arg_conv.is_owned = false;
38771         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
38772         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
38773         return tag_ptr(ret_ret, true);
38774 }
38775
38776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1persistable_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
38777         LDKChannelManager this_arg_conv;
38778         this_arg_conv.inner = untag_ptr(this_arg);
38779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38781         this_arg_conv.is_owned = false;
38782         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
38783         int64_t ret_ref = 0;
38784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38786         return ret_ref;
38787 }
38788
38789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
38790         LDKChannelManager this_arg_conv;
38791         this_arg_conv.inner = untag_ptr(this_arg);
38792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38794         this_arg_conv.is_owned = false;
38795         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
38796         int64_t ret_ref = 0;
38797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38799         return ret_ref;
38800 }
38801
38802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
38803         LDKChannelManager this_arg_conv;
38804         this_arg_conv.inner = untag_ptr(this_arg);
38805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38807         this_arg_conv.is_owned = false;
38808         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
38809         int64_t ret_ref = 0;
38810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38812         return ret_ref;
38813 }
38814
38815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
38816         LDKChannelManager this_arg_conv;
38817         this_arg_conv.inner = untag_ptr(this_arg);
38818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38820         this_arg_conv.is_owned = false;
38821         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
38822         int64_t ret_ref = 0;
38823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38825         return ret_ref;
38826 }
38827
38828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
38829         LDKChannelManager this_arg_conv;
38830         this_arg_conv.inner = untag_ptr(this_arg);
38831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38833         this_arg_conv.is_owned = false;
38834         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
38835         int64_t ret_ref = 0;
38836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38838         return ret_ref;
38839 }
38840
38841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
38842         LDKChannelManager this_arg_conv;
38843         this_arg_conv.inner = untag_ptr(this_arg);
38844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38846         this_arg_conv.is_owned = false;
38847         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
38848         int64_t ret_ref = 0;
38849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38851         return ret_ref;
38852 }
38853
38854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
38855         LDKChannelManager this_arg_conv;
38856         this_arg_conv.inner = untag_ptr(this_arg);
38857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38859         this_arg_conv.is_owned = false;
38860         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
38861         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
38862         return tag_ptr(ret_ret, true);
38863 }
38864
38865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
38866         LDKUserConfig config_conv;
38867         config_conv.inner = untag_ptr(config);
38868         config_conv.is_owned = ptr_is_owned(config);
38869         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
38870         config_conv.is_owned = false;
38871         LDKInitFeatures ret_var = provided_init_features(&config_conv);
38872         int64_t ret_ref = 0;
38873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38875         return ret_ref;
38876 }
38877
38878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
38879         LDKCounterpartyForwardingInfo obj_conv;
38880         obj_conv.inner = untag_ptr(obj);
38881         obj_conv.is_owned = ptr_is_owned(obj);
38882         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38883         obj_conv.is_owned = false;
38884         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
38885         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38886         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38887         CVec_u8Z_free(ret_var);
38888         return ret_arr;
38889 }
38890
38891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38892         LDKu8slice ser_ref;
38893         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38894         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38895         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
38896         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
38897         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38898         return tag_ptr(ret_conv, true);
38899 }
38900
38901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
38902         LDKChannelCounterparty obj_conv;
38903         obj_conv.inner = untag_ptr(obj);
38904         obj_conv.is_owned = ptr_is_owned(obj);
38905         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38906         obj_conv.is_owned = false;
38907         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
38908         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38909         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38910         CVec_u8Z_free(ret_var);
38911         return ret_arr;
38912 }
38913
38914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38915         LDKu8slice ser_ref;
38916         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38917         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38918         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
38919         *ret_conv = ChannelCounterparty_read(ser_ref);
38920         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38921         return tag_ptr(ret_conv, true);
38922 }
38923
38924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
38925         LDKChannelDetails obj_conv;
38926         obj_conv.inner = untag_ptr(obj);
38927         obj_conv.is_owned = ptr_is_owned(obj);
38928         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38929         obj_conv.is_owned = false;
38930         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
38931         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38932         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38933         CVec_u8Z_free(ret_var);
38934         return ret_arr;
38935 }
38936
38937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38938         LDKu8slice ser_ref;
38939         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38940         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38941         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
38942         *ret_conv = ChannelDetails_read(ser_ref);
38943         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38944         return tag_ptr(ret_conv, true);
38945 }
38946
38947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
38948         LDKPhantomRouteHints obj_conv;
38949         obj_conv.inner = untag_ptr(obj);
38950         obj_conv.is_owned = ptr_is_owned(obj);
38951         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38952         obj_conv.is_owned = false;
38953         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
38954         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38955         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38956         CVec_u8Z_free(ret_var);
38957         return ret_arr;
38958 }
38959
38960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38961         LDKu8slice ser_ref;
38962         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38963         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38964         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
38965         *ret_conv = PhantomRouteHints_read(ser_ref);
38966         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38967         return tag_ptr(ret_conv, true);
38968 }
38969
38970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
38971         LDKChannelManager obj_conv;
38972         obj_conv.inner = untag_ptr(obj);
38973         obj_conv.is_owned = ptr_is_owned(obj);
38974         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38975         obj_conv.is_owned = false;
38976         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
38977         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38978         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38979         CVec_u8Z_free(ret_var);
38980         return ret_arr;
38981 }
38982
38983 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
38984         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
38985         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
38986         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38987         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38988         CVec_u8Z_free(ret_var);
38989         return ret_arr;
38990 }
38991
38992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38993         LDKu8slice ser_ref;
38994         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38995         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38996         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
38997         *ret_conv = ChannelShutdownState_read(ser_ref);
38998         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38999         return tag_ptr(ret_conv, true);
39000 }
39001
39002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39003         LDKChannelManagerReadArgs this_obj_conv;
39004         this_obj_conv.inner = untag_ptr(this_obj);
39005         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39007         ChannelManagerReadArgs_free(this_obj_conv);
39008 }
39009
39010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
39011         LDKChannelManagerReadArgs this_ptr_conv;
39012         this_ptr_conv.inner = untag_ptr(this_ptr);
39013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39015         this_ptr_conv.is_owned = false;
39016         // WARNING: This object doesn't live past this scope, needs clone!
39017         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
39018         return ret_ret;
39019 }
39020
39021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39022         LDKChannelManagerReadArgs this_ptr_conv;
39023         this_ptr_conv.inner = untag_ptr(this_ptr);
39024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39026         this_ptr_conv.is_owned = false;
39027         void* val_ptr = untag_ptr(val);
39028         CHECK_ACCESS(val_ptr);
39029         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
39030         if (val_conv.free == LDKEntropySource_JCalls_free) {
39031                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39032                 LDKEntropySource_JCalls_cloned(&val_conv);
39033         }
39034         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
39035 }
39036
39037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
39038         LDKChannelManagerReadArgs this_ptr_conv;
39039         this_ptr_conv.inner = untag_ptr(this_ptr);
39040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39042         this_ptr_conv.is_owned = false;
39043         // WARNING: This object doesn't live past this scope, needs clone!
39044         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
39045         return ret_ret;
39046 }
39047
39048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39049         LDKChannelManagerReadArgs this_ptr_conv;
39050         this_ptr_conv.inner = untag_ptr(this_ptr);
39051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39053         this_ptr_conv.is_owned = false;
39054         void* val_ptr = untag_ptr(val);
39055         CHECK_ACCESS(val_ptr);
39056         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
39057         if (val_conv.free == LDKNodeSigner_JCalls_free) {
39058                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39059                 LDKNodeSigner_JCalls_cloned(&val_conv);
39060         }
39061         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
39062 }
39063
39064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
39065         LDKChannelManagerReadArgs this_ptr_conv;
39066         this_ptr_conv.inner = untag_ptr(this_ptr);
39067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39069         this_ptr_conv.is_owned = false;
39070         // WARNING: This object doesn't live past this scope, needs clone!
39071         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
39072         return ret_ret;
39073 }
39074
39075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39076         LDKChannelManagerReadArgs this_ptr_conv;
39077         this_ptr_conv.inner = untag_ptr(this_ptr);
39078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39080         this_ptr_conv.is_owned = false;
39081         void* val_ptr = untag_ptr(val);
39082         CHECK_ACCESS(val_ptr);
39083         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
39084         if (val_conv.free == LDKSignerProvider_JCalls_free) {
39085                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39086                 LDKSignerProvider_JCalls_cloned(&val_conv);
39087         }
39088         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
39089 }
39090
39091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
39092         LDKChannelManagerReadArgs this_ptr_conv;
39093         this_ptr_conv.inner = untag_ptr(this_ptr);
39094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39096         this_ptr_conv.is_owned = false;
39097         // WARNING: This object doesn't live past this scope, needs clone!
39098         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
39099         return ret_ret;
39100 }
39101
39102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39103         LDKChannelManagerReadArgs this_ptr_conv;
39104         this_ptr_conv.inner = untag_ptr(this_ptr);
39105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39107         this_ptr_conv.is_owned = false;
39108         void* val_ptr = untag_ptr(val);
39109         CHECK_ACCESS(val_ptr);
39110         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
39111         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
39112                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39113                 LDKFeeEstimator_JCalls_cloned(&val_conv);
39114         }
39115         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
39116 }
39117
39118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
39119         LDKChannelManagerReadArgs this_ptr_conv;
39120         this_ptr_conv.inner = untag_ptr(this_ptr);
39121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39123         this_ptr_conv.is_owned = false;
39124         // WARNING: This object doesn't live past this scope, needs clone!
39125         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
39126         return ret_ret;
39127 }
39128
39129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39130         LDKChannelManagerReadArgs this_ptr_conv;
39131         this_ptr_conv.inner = untag_ptr(this_ptr);
39132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39134         this_ptr_conv.is_owned = false;
39135         void* val_ptr = untag_ptr(val);
39136         CHECK_ACCESS(val_ptr);
39137         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
39138         if (val_conv.free == LDKWatch_JCalls_free) {
39139                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39140                 LDKWatch_JCalls_cloned(&val_conv);
39141         }
39142         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
39143 }
39144
39145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
39146         LDKChannelManagerReadArgs this_ptr_conv;
39147         this_ptr_conv.inner = untag_ptr(this_ptr);
39148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39150         this_ptr_conv.is_owned = false;
39151         // WARNING: This object doesn't live past this scope, needs clone!
39152         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
39153         return ret_ret;
39154 }
39155
39156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39157         LDKChannelManagerReadArgs this_ptr_conv;
39158         this_ptr_conv.inner = untag_ptr(this_ptr);
39159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39161         this_ptr_conv.is_owned = false;
39162         void* val_ptr = untag_ptr(val);
39163         CHECK_ACCESS(val_ptr);
39164         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
39165         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
39166                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39167                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
39168         }
39169         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
39170 }
39171
39172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
39173         LDKChannelManagerReadArgs this_ptr_conv;
39174         this_ptr_conv.inner = untag_ptr(this_ptr);
39175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39177         this_ptr_conv.is_owned = false;
39178         // WARNING: This object doesn't live past this scope, needs clone!
39179         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
39180         return ret_ret;
39181 }
39182
39183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39184         LDKChannelManagerReadArgs this_ptr_conv;
39185         this_ptr_conv.inner = untag_ptr(this_ptr);
39186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39188         this_ptr_conv.is_owned = false;
39189         void* val_ptr = untag_ptr(val);
39190         CHECK_ACCESS(val_ptr);
39191         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
39192         if (val_conv.free == LDKRouter_JCalls_free) {
39193                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39194                 LDKRouter_JCalls_cloned(&val_conv);
39195         }
39196         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
39197 }
39198
39199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
39200         LDKChannelManagerReadArgs this_ptr_conv;
39201         this_ptr_conv.inner = untag_ptr(this_ptr);
39202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39204         this_ptr_conv.is_owned = false;
39205         // WARNING: This object doesn't live past this scope, needs clone!
39206         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
39207         return ret_ret;
39208 }
39209
39210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39211         LDKChannelManagerReadArgs this_ptr_conv;
39212         this_ptr_conv.inner = untag_ptr(this_ptr);
39213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39215         this_ptr_conv.is_owned = false;
39216         void* val_ptr = untag_ptr(val);
39217         CHECK_ACCESS(val_ptr);
39218         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
39219         if (val_conv.free == LDKLogger_JCalls_free) {
39220                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39221                 LDKLogger_JCalls_cloned(&val_conv);
39222         }
39223         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
39224 }
39225
39226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
39227         LDKChannelManagerReadArgs this_ptr_conv;
39228         this_ptr_conv.inner = untag_ptr(this_ptr);
39229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39231         this_ptr_conv.is_owned = false;
39232         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
39233         int64_t ret_ref = 0;
39234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39236         return ret_ref;
39237 }
39238
39239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39240         LDKChannelManagerReadArgs this_ptr_conv;
39241         this_ptr_conv.inner = untag_ptr(this_ptr);
39242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39244         this_ptr_conv.is_owned = false;
39245         LDKUserConfig val_conv;
39246         val_conv.inner = untag_ptr(val);
39247         val_conv.is_owned = ptr_is_owned(val);
39248         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39249         val_conv = UserConfig_clone(&val_conv);
39250         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
39251 }
39252
39253 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) {
39254         void* entropy_source_ptr = untag_ptr(entropy_source);
39255         CHECK_ACCESS(entropy_source_ptr);
39256         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
39257         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
39258                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39259                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
39260         }
39261         void* node_signer_ptr = untag_ptr(node_signer);
39262         CHECK_ACCESS(node_signer_ptr);
39263         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
39264         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
39265                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39266                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
39267         }
39268         void* signer_provider_ptr = untag_ptr(signer_provider);
39269         CHECK_ACCESS(signer_provider_ptr);
39270         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
39271         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
39272                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39273                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
39274         }
39275         void* fee_estimator_ptr = untag_ptr(fee_estimator);
39276         CHECK_ACCESS(fee_estimator_ptr);
39277         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
39278         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
39279                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39280                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
39281         }
39282         void* chain_monitor_ptr = untag_ptr(chain_monitor);
39283         CHECK_ACCESS(chain_monitor_ptr);
39284         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
39285         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
39286                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39287                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
39288         }
39289         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
39290         CHECK_ACCESS(tx_broadcaster_ptr);
39291         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
39292         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
39293                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39294                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
39295         }
39296         void* router_ptr = untag_ptr(router);
39297         CHECK_ACCESS(router_ptr);
39298         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
39299         if (router_conv.free == LDKRouter_JCalls_free) {
39300                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39301                 LDKRouter_JCalls_cloned(&router_conv);
39302         }
39303         void* logger_ptr = untag_ptr(logger);
39304         CHECK_ACCESS(logger_ptr);
39305         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39306         if (logger_conv.free == LDKLogger_JCalls_free) {
39307                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39308                 LDKLogger_JCalls_cloned(&logger_conv);
39309         }
39310         LDKUserConfig default_config_conv;
39311         default_config_conv.inner = untag_ptr(default_config);
39312         default_config_conv.is_owned = ptr_is_owned(default_config);
39313         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
39314         default_config_conv = UserConfig_clone(&default_config_conv);
39315         LDKCVec_ChannelMonitorZ channel_monitors_constr;
39316         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
39317         if (channel_monitors_constr.datalen > 0)
39318                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
39319         else
39320                 channel_monitors_constr.data = NULL;
39321         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
39322         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
39323                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
39324                 LDKChannelMonitor channel_monitors_conv_16_conv;
39325                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
39326                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
39327                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
39328                 channel_monitors_conv_16_conv.is_owned = false;
39329                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
39330         }
39331         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
39332         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);
39333         int64_t ret_ref = 0;
39334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39336         return ret_ref;
39337 }
39338
39339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
39340         LDKu8slice ser_ref;
39341         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39342         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39343         LDKChannelManagerReadArgs arg_conv;
39344         arg_conv.inner = untag_ptr(arg);
39345         arg_conv.is_owned = ptr_is_owned(arg);
39346         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39347         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
39348         
39349         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
39350         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
39351         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39352         return tag_ptr(ret_conv, true);
39353 }
39354
39355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39356         LDKExpandedKey this_obj_conv;
39357         this_obj_conv.inner = untag_ptr(this_obj);
39358         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39360         ExpandedKey_free(this_obj_conv);
39361 }
39362
39363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
39364         uint8_t key_material_arr[32];
39365         CHECK((*env)->GetArrayLength(env, key_material) == 32);
39366         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
39367         uint8_t (*key_material_ref)[32] = &key_material_arr;
39368         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
39369         int64_t ret_ref = 0;
39370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39372         return ret_ref;
39373 }
39374
39375 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) {
39376         LDKExpandedKey keys_conv;
39377         keys_conv.inner = untag_ptr(keys);
39378         keys_conv.is_owned = ptr_is_owned(keys);
39379         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
39380         keys_conv.is_owned = false;
39381         void* min_value_msat_ptr = untag_ptr(min_value_msat);
39382         CHECK_ACCESS(min_value_msat_ptr);
39383         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
39384         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
39385         void* entropy_source_ptr = untag_ptr(entropy_source);
39386         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
39387         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
39388         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
39389         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
39390         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
39391         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
39392         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
39393         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
39394         return tag_ptr(ret_conv, true);
39395 }
39396
39397 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) {
39398         LDKExpandedKey keys_conv;
39399         keys_conv.inner = untag_ptr(keys);
39400         keys_conv.is_owned = ptr_is_owned(keys);
39401         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
39402         keys_conv.is_owned = false;
39403         void* min_value_msat_ptr = untag_ptr(min_value_msat);
39404         CHECK_ACCESS(min_value_msat_ptr);
39405         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
39406         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
39407         LDKThirtyTwoBytes payment_hash_ref;
39408         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
39409         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
39410         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
39411         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
39412         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
39413         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
39414         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
39415         *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);
39416         return tag_ptr(ret_conv, true);
39417 }
39418
39419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39420         if (!ptr_is_owned(this_ptr)) return;
39421         void* this_ptr_ptr = untag_ptr(this_ptr);
39422         CHECK_ACCESS(this_ptr_ptr);
39423         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
39424         FREE(untag_ptr(this_ptr));
39425         DecodeError_free(this_ptr_conv);
39426 }
39427
39428 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
39429         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39430         *ret_copy = DecodeError_clone(arg);
39431         int64_t ret_ref = tag_ptr(ret_copy, true);
39432         return ret_ref;
39433 }
39434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39435         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
39436         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
39437         return ret_conv;
39438 }
39439
39440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39441         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
39442         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39443         *ret_copy = DecodeError_clone(orig_conv);
39444         int64_t ret_ref = tag_ptr(ret_copy, true);
39445         return ret_ref;
39446 }
39447
39448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
39449         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39450         *ret_copy = DecodeError_unknown_version();
39451         int64_t ret_ref = tag_ptr(ret_copy, true);
39452         return ret_ref;
39453 }
39454
39455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
39456         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39457         *ret_copy = DecodeError_unknown_required_feature();
39458         int64_t ret_ref = tag_ptr(ret_copy, true);
39459         return ret_ref;
39460 }
39461
39462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
39463         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39464         *ret_copy = DecodeError_invalid_value();
39465         int64_t ret_ref = tag_ptr(ret_copy, true);
39466         return ret_ref;
39467 }
39468
39469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
39470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39471         *ret_copy = DecodeError_short_read();
39472         int64_t ret_ref = tag_ptr(ret_copy, true);
39473         return ret_ref;
39474 }
39475
39476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
39477         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39478         *ret_copy = DecodeError_bad_length_descriptor();
39479         int64_t ret_ref = tag_ptr(ret_copy, true);
39480         return ret_ref;
39481 }
39482
39483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
39484         LDKIOError a_conv = LDKIOError_from_java(env, a);
39485         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39486         *ret_copy = DecodeError_io(a_conv);
39487         int64_t ret_ref = tag_ptr(ret_copy, true);
39488         return ret_ref;
39489 }
39490
39491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
39492         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
39493         *ret_copy = DecodeError_unsupported_compression();
39494         int64_t ret_ref = tag_ptr(ret_copy, true);
39495         return ret_ref;
39496 }
39497
39498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39499         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
39500         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
39501         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
39502         return ret_conv;
39503 }
39504
39505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39506         LDKInit this_obj_conv;
39507         this_obj_conv.inner = untag_ptr(this_obj);
39508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39510         Init_free(this_obj_conv);
39511 }
39512
39513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
39514         LDKInit this_ptr_conv;
39515         this_ptr_conv.inner = untag_ptr(this_ptr);
39516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39518         this_ptr_conv.is_owned = false;
39519         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
39520         int64_t ret_ref = 0;
39521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39523         return ret_ref;
39524 }
39525
39526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39527         LDKInit this_ptr_conv;
39528         this_ptr_conv.inner = untag_ptr(this_ptr);
39529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39531         this_ptr_conv.is_owned = false;
39532         LDKInitFeatures val_conv;
39533         val_conv.inner = untag_ptr(val);
39534         val_conv.is_owned = ptr_is_owned(val);
39535         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39536         val_conv = InitFeatures_clone(&val_conv);
39537         Init_set_features(&this_ptr_conv, val_conv);
39538 }
39539
39540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
39541         LDKInit this_ptr_conv;
39542         this_ptr_conv.inner = untag_ptr(this_ptr);
39543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39545         this_ptr_conv.is_owned = false;
39546         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
39547         *ret_copy = Init_get_networks(&this_ptr_conv);
39548         int64_t ret_ref = tag_ptr(ret_copy, true);
39549         return ret_ref;
39550 }
39551
39552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39553         LDKInit this_ptr_conv;
39554         this_ptr_conv.inner = untag_ptr(this_ptr);
39555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39557         this_ptr_conv.is_owned = false;
39558         void* val_ptr = untag_ptr(val);
39559         CHECK_ACCESS(val_ptr);
39560         LDKCOption_CVec_ChainHashZZ val_conv = *(LDKCOption_CVec_ChainHashZZ*)(val_ptr);
39561         val_conv = COption_CVec_ChainHashZZ_clone((LDKCOption_CVec_ChainHashZZ*)untag_ptr(val));
39562         Init_set_networks(&this_ptr_conv, val_conv);
39563 }
39564
39565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
39566         LDKInit this_ptr_conv;
39567         this_ptr_conv.inner = untag_ptr(this_ptr);
39568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39570         this_ptr_conv.is_owned = false;
39571         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
39572         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
39573         int64_t ret_ref = tag_ptr(ret_copy, true);
39574         return ret_ref;
39575 }
39576
39577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39578         LDKInit this_ptr_conv;
39579         this_ptr_conv.inner = untag_ptr(this_ptr);
39580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39582         this_ptr_conv.is_owned = false;
39583         void* val_ptr = untag_ptr(val);
39584         CHECK_ACCESS(val_ptr);
39585         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
39586         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
39587         Init_set_remote_network_address(&this_ptr_conv, val_conv);
39588 }
39589
39590 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) {
39591         LDKInitFeatures features_arg_conv;
39592         features_arg_conv.inner = untag_ptr(features_arg);
39593         features_arg_conv.is_owned = ptr_is_owned(features_arg);
39594         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
39595         features_arg_conv = InitFeatures_clone(&features_arg_conv);
39596         void* networks_arg_ptr = untag_ptr(networks_arg);
39597         CHECK_ACCESS(networks_arg_ptr);
39598         LDKCOption_CVec_ChainHashZZ networks_arg_conv = *(LDKCOption_CVec_ChainHashZZ*)(networks_arg_ptr);
39599         networks_arg_conv = COption_CVec_ChainHashZZ_clone((LDKCOption_CVec_ChainHashZZ*)untag_ptr(networks_arg));
39600         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
39601         CHECK_ACCESS(remote_network_address_arg_ptr);
39602         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
39603         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
39604         int64_t ret_ref = 0;
39605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39607         return ret_ref;
39608 }
39609
39610 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
39611         LDKInit ret_var = Init_clone(arg);
39612         int64_t ret_ref = 0;
39613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39615         return ret_ref;
39616 }
39617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39618         LDKInit arg_conv;
39619         arg_conv.inner = untag_ptr(arg);
39620         arg_conv.is_owned = ptr_is_owned(arg);
39621         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39622         arg_conv.is_owned = false;
39623         int64_t ret_conv = Init_clone_ptr(&arg_conv);
39624         return ret_conv;
39625 }
39626
39627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39628         LDKInit orig_conv;
39629         orig_conv.inner = untag_ptr(orig);
39630         orig_conv.is_owned = ptr_is_owned(orig);
39631         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39632         orig_conv.is_owned = false;
39633         LDKInit ret_var = Init_clone(&orig_conv);
39634         int64_t ret_ref = 0;
39635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39637         return ret_ref;
39638 }
39639
39640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39641         LDKInit a_conv;
39642         a_conv.inner = untag_ptr(a);
39643         a_conv.is_owned = ptr_is_owned(a);
39644         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39645         a_conv.is_owned = false;
39646         LDKInit b_conv;
39647         b_conv.inner = untag_ptr(b);
39648         b_conv.is_owned = ptr_is_owned(b);
39649         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39650         b_conv.is_owned = false;
39651         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
39652         return ret_conv;
39653 }
39654
39655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39656         LDKErrorMessage this_obj_conv;
39657         this_obj_conv.inner = untag_ptr(this_obj);
39658         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39660         ErrorMessage_free(this_obj_conv);
39661 }
39662
39663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39664         LDKErrorMessage this_ptr_conv;
39665         this_ptr_conv.inner = untag_ptr(this_ptr);
39666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39668         this_ptr_conv.is_owned = false;
39669         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39670         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
39671         return ret_arr;
39672 }
39673
39674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39675         LDKErrorMessage this_ptr_conv;
39676         this_ptr_conv.inner = untag_ptr(this_ptr);
39677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39679         this_ptr_conv.is_owned = false;
39680         LDKThirtyTwoBytes val_ref;
39681         CHECK((*env)->GetArrayLength(env, val) == 32);
39682         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39683         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
39684 }
39685
39686 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
39687         LDKErrorMessage this_ptr_conv;
39688         this_ptr_conv.inner = untag_ptr(this_ptr);
39689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39691         this_ptr_conv.is_owned = false;
39692         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
39693         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
39694         Str_free(ret_str);
39695         return ret_conv;
39696 }
39697
39698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
39699         LDKErrorMessage this_ptr_conv;
39700         this_ptr_conv.inner = untag_ptr(this_ptr);
39701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39703         this_ptr_conv.is_owned = false;
39704         LDKStr val_conv = java_to_owned_str(env, val);
39705         ErrorMessage_set_data(&this_ptr_conv, val_conv);
39706 }
39707
39708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
39709         LDKThirtyTwoBytes channel_id_arg_ref;
39710         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
39711         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
39712         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
39713         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
39714         int64_t ret_ref = 0;
39715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39717         return ret_ref;
39718 }
39719
39720 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
39721         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
39722         int64_t ret_ref = 0;
39723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39725         return ret_ref;
39726 }
39727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39728         LDKErrorMessage arg_conv;
39729         arg_conv.inner = untag_ptr(arg);
39730         arg_conv.is_owned = ptr_is_owned(arg);
39731         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39732         arg_conv.is_owned = false;
39733         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
39734         return ret_conv;
39735 }
39736
39737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39738         LDKErrorMessage orig_conv;
39739         orig_conv.inner = untag_ptr(orig);
39740         orig_conv.is_owned = ptr_is_owned(orig);
39741         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39742         orig_conv.is_owned = false;
39743         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
39744         int64_t ret_ref = 0;
39745         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39746         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39747         return ret_ref;
39748 }
39749
39750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39751         LDKErrorMessage a_conv;
39752         a_conv.inner = untag_ptr(a);
39753         a_conv.is_owned = ptr_is_owned(a);
39754         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39755         a_conv.is_owned = false;
39756         LDKErrorMessage b_conv;
39757         b_conv.inner = untag_ptr(b);
39758         b_conv.is_owned = ptr_is_owned(b);
39759         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39760         b_conv.is_owned = false;
39761         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
39762         return ret_conv;
39763 }
39764
39765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39766         LDKWarningMessage this_obj_conv;
39767         this_obj_conv.inner = untag_ptr(this_obj);
39768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39770         WarningMessage_free(this_obj_conv);
39771 }
39772
39773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39774         LDKWarningMessage this_ptr_conv;
39775         this_ptr_conv.inner = untag_ptr(this_ptr);
39776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39778         this_ptr_conv.is_owned = false;
39779         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
39780         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
39781         return ret_arr;
39782 }
39783
39784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39785         LDKWarningMessage this_ptr_conv;
39786         this_ptr_conv.inner = untag_ptr(this_ptr);
39787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39789         this_ptr_conv.is_owned = false;
39790         LDKThirtyTwoBytes val_ref;
39791         CHECK((*env)->GetArrayLength(env, val) == 32);
39792         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
39793         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
39794 }
39795
39796 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
39797         LDKWarningMessage this_ptr_conv;
39798         this_ptr_conv.inner = untag_ptr(this_ptr);
39799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39801         this_ptr_conv.is_owned = false;
39802         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
39803         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
39804         Str_free(ret_str);
39805         return ret_conv;
39806 }
39807
39808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
39809         LDKWarningMessage this_ptr_conv;
39810         this_ptr_conv.inner = untag_ptr(this_ptr);
39811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39813         this_ptr_conv.is_owned = false;
39814         LDKStr val_conv = java_to_owned_str(env, val);
39815         WarningMessage_set_data(&this_ptr_conv, val_conv);
39816 }
39817
39818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
39819         LDKThirtyTwoBytes channel_id_arg_ref;
39820         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
39821         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
39822         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
39823         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
39824         int64_t ret_ref = 0;
39825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39827         return ret_ref;
39828 }
39829
39830 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
39831         LDKWarningMessage ret_var = WarningMessage_clone(arg);
39832         int64_t ret_ref = 0;
39833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39835         return ret_ref;
39836 }
39837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39838         LDKWarningMessage arg_conv;
39839         arg_conv.inner = untag_ptr(arg);
39840         arg_conv.is_owned = ptr_is_owned(arg);
39841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39842         arg_conv.is_owned = false;
39843         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
39844         return ret_conv;
39845 }
39846
39847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39848         LDKWarningMessage orig_conv;
39849         orig_conv.inner = untag_ptr(orig);
39850         orig_conv.is_owned = ptr_is_owned(orig);
39851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39852         orig_conv.is_owned = false;
39853         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
39854         int64_t ret_ref = 0;
39855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39857         return ret_ref;
39858 }
39859
39860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39861         LDKWarningMessage a_conv;
39862         a_conv.inner = untag_ptr(a);
39863         a_conv.is_owned = ptr_is_owned(a);
39864         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39865         a_conv.is_owned = false;
39866         LDKWarningMessage b_conv;
39867         b_conv.inner = untag_ptr(b);
39868         b_conv.is_owned = ptr_is_owned(b);
39869         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39870         b_conv.is_owned = false;
39871         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
39872         return ret_conv;
39873 }
39874
39875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39876         LDKPing this_obj_conv;
39877         this_obj_conv.inner = untag_ptr(this_obj);
39878         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39880         Ping_free(this_obj_conv);
39881 }
39882
39883 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
39884         LDKPing this_ptr_conv;
39885         this_ptr_conv.inner = untag_ptr(this_ptr);
39886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39888         this_ptr_conv.is_owned = false;
39889         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
39890         return ret_conv;
39891 }
39892
39893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39894         LDKPing this_ptr_conv;
39895         this_ptr_conv.inner = untag_ptr(this_ptr);
39896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39898         this_ptr_conv.is_owned = false;
39899         Ping_set_ponglen(&this_ptr_conv, val);
39900 }
39901
39902 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
39903         LDKPing this_ptr_conv;
39904         this_ptr_conv.inner = untag_ptr(this_ptr);
39905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39907         this_ptr_conv.is_owned = false;
39908         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
39909         return ret_conv;
39910 }
39911
39912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39913         LDKPing this_ptr_conv;
39914         this_ptr_conv.inner = untag_ptr(this_ptr);
39915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39917         this_ptr_conv.is_owned = false;
39918         Ping_set_byteslen(&this_ptr_conv, val);
39919 }
39920
39921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
39922         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
39923         int64_t ret_ref = 0;
39924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39926         return ret_ref;
39927 }
39928
39929 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
39930         LDKPing ret_var = Ping_clone(arg);
39931         int64_t ret_ref = 0;
39932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39934         return ret_ref;
39935 }
39936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39937         LDKPing arg_conv;
39938         arg_conv.inner = untag_ptr(arg);
39939         arg_conv.is_owned = ptr_is_owned(arg);
39940         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39941         arg_conv.is_owned = false;
39942         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
39943         return ret_conv;
39944 }
39945
39946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39947         LDKPing orig_conv;
39948         orig_conv.inner = untag_ptr(orig);
39949         orig_conv.is_owned = ptr_is_owned(orig);
39950         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39951         orig_conv.is_owned = false;
39952         LDKPing ret_var = Ping_clone(&orig_conv);
39953         int64_t ret_ref = 0;
39954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39956         return ret_ref;
39957 }
39958
39959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39960         LDKPing a_conv;
39961         a_conv.inner = untag_ptr(a);
39962         a_conv.is_owned = ptr_is_owned(a);
39963         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39964         a_conv.is_owned = false;
39965         LDKPing b_conv;
39966         b_conv.inner = untag_ptr(b);
39967         b_conv.is_owned = ptr_is_owned(b);
39968         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39969         b_conv.is_owned = false;
39970         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
39971         return ret_conv;
39972 }
39973
39974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39975         LDKPong this_obj_conv;
39976         this_obj_conv.inner = untag_ptr(this_obj);
39977         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39979         Pong_free(this_obj_conv);
39980 }
39981
39982 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
39983         LDKPong this_ptr_conv;
39984         this_ptr_conv.inner = untag_ptr(this_ptr);
39985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39987         this_ptr_conv.is_owned = false;
39988         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
39989         return ret_conv;
39990 }
39991
39992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39993         LDKPong this_ptr_conv;
39994         this_ptr_conv.inner = untag_ptr(this_ptr);
39995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39997         this_ptr_conv.is_owned = false;
39998         Pong_set_byteslen(&this_ptr_conv, val);
39999 }
40000
40001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
40002         LDKPong ret_var = Pong_new(byteslen_arg);
40003         int64_t ret_ref = 0;
40004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40006         return ret_ref;
40007 }
40008
40009 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
40010         LDKPong ret_var = Pong_clone(arg);
40011         int64_t ret_ref = 0;
40012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40014         return ret_ref;
40015 }
40016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40017         LDKPong arg_conv;
40018         arg_conv.inner = untag_ptr(arg);
40019         arg_conv.is_owned = ptr_is_owned(arg);
40020         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40021         arg_conv.is_owned = false;
40022         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
40023         return ret_conv;
40024 }
40025
40026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40027         LDKPong orig_conv;
40028         orig_conv.inner = untag_ptr(orig);
40029         orig_conv.is_owned = ptr_is_owned(orig);
40030         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40031         orig_conv.is_owned = false;
40032         LDKPong ret_var = Pong_clone(&orig_conv);
40033         int64_t ret_ref = 0;
40034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40036         return ret_ref;
40037 }
40038
40039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40040         LDKPong a_conv;
40041         a_conv.inner = untag_ptr(a);
40042         a_conv.is_owned = ptr_is_owned(a);
40043         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40044         a_conv.is_owned = false;
40045         LDKPong b_conv;
40046         b_conv.inner = untag_ptr(b);
40047         b_conv.is_owned = ptr_is_owned(b);
40048         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40049         b_conv.is_owned = false;
40050         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
40051         return ret_conv;
40052 }
40053
40054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40055         LDKOpenChannel this_obj_conv;
40056         this_obj_conv.inner = untag_ptr(this_obj);
40057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40059         OpenChannel_free(this_obj_conv);
40060 }
40061
40062 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
40063         LDKOpenChannel this_ptr_conv;
40064         this_ptr_conv.inner = untag_ptr(this_ptr);
40065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40067         this_ptr_conv.is_owned = false;
40068         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40069         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
40070         return ret_arr;
40071 }
40072
40073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40074         LDKOpenChannel this_ptr_conv;
40075         this_ptr_conv.inner = untag_ptr(this_ptr);
40076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40078         this_ptr_conv.is_owned = false;
40079         LDKThirtyTwoBytes val_ref;
40080         CHECK((*env)->GetArrayLength(env, val) == 32);
40081         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40082         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
40083 }
40084
40085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
40086         LDKOpenChannel this_ptr_conv;
40087         this_ptr_conv.inner = untag_ptr(this_ptr);
40088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40090         this_ptr_conv.is_owned = false;
40091         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40092         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
40093         return ret_arr;
40094 }
40095
40096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40097         LDKOpenChannel this_ptr_conv;
40098         this_ptr_conv.inner = untag_ptr(this_ptr);
40099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40101         this_ptr_conv.is_owned = false;
40102         LDKThirtyTwoBytes val_ref;
40103         CHECK((*env)->GetArrayLength(env, val) == 32);
40104         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40105         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
40106 }
40107
40108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40109         LDKOpenChannel this_ptr_conv;
40110         this_ptr_conv.inner = untag_ptr(this_ptr);
40111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40113         this_ptr_conv.is_owned = false;
40114         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
40115         return ret_conv;
40116 }
40117
40118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40119         LDKOpenChannel this_ptr_conv;
40120         this_ptr_conv.inner = untag_ptr(this_ptr);
40121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40123         this_ptr_conv.is_owned = false;
40124         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
40125 }
40126
40127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40128         LDKOpenChannel this_ptr_conv;
40129         this_ptr_conv.inner = untag_ptr(this_ptr);
40130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40132         this_ptr_conv.is_owned = false;
40133         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
40134         return ret_conv;
40135 }
40136
40137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40138         LDKOpenChannel this_ptr_conv;
40139         this_ptr_conv.inner = untag_ptr(this_ptr);
40140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40142         this_ptr_conv.is_owned = false;
40143         OpenChannel_set_push_msat(&this_ptr_conv, val);
40144 }
40145
40146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40147         LDKOpenChannel this_ptr_conv;
40148         this_ptr_conv.inner = untag_ptr(this_ptr);
40149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40151         this_ptr_conv.is_owned = false;
40152         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
40153         return ret_conv;
40154 }
40155
40156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40157         LDKOpenChannel this_ptr_conv;
40158         this_ptr_conv.inner = untag_ptr(this_ptr);
40159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40161         this_ptr_conv.is_owned = false;
40162         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
40163 }
40164
40165 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) {
40166         LDKOpenChannel this_ptr_conv;
40167         this_ptr_conv.inner = untag_ptr(this_ptr);
40168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40170         this_ptr_conv.is_owned = false;
40171         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
40172         return ret_conv;
40173 }
40174
40175 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) {
40176         LDKOpenChannel this_ptr_conv;
40177         this_ptr_conv.inner = untag_ptr(this_ptr);
40178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40180         this_ptr_conv.is_owned = false;
40181         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
40182 }
40183
40184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40185         LDKOpenChannel this_ptr_conv;
40186         this_ptr_conv.inner = untag_ptr(this_ptr);
40187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40189         this_ptr_conv.is_owned = false;
40190         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
40191         return ret_conv;
40192 }
40193
40194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40195         LDKOpenChannel this_ptr_conv;
40196         this_ptr_conv.inner = untag_ptr(this_ptr);
40197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40199         this_ptr_conv.is_owned = false;
40200         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
40201 }
40202
40203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40204         LDKOpenChannel this_ptr_conv;
40205         this_ptr_conv.inner = untag_ptr(this_ptr);
40206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40208         this_ptr_conv.is_owned = false;
40209         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
40210         return ret_conv;
40211 }
40212
40213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40214         LDKOpenChannel this_ptr_conv;
40215         this_ptr_conv.inner = untag_ptr(this_ptr);
40216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40218         this_ptr_conv.is_owned = false;
40219         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
40220 }
40221
40222 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
40223         LDKOpenChannel this_ptr_conv;
40224         this_ptr_conv.inner = untag_ptr(this_ptr);
40225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40227         this_ptr_conv.is_owned = false;
40228         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
40229         return ret_conv;
40230 }
40231
40232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40233         LDKOpenChannel this_ptr_conv;
40234         this_ptr_conv.inner = untag_ptr(this_ptr);
40235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40237         this_ptr_conv.is_owned = false;
40238         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
40239 }
40240
40241 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
40242         LDKOpenChannel this_ptr_conv;
40243         this_ptr_conv.inner = untag_ptr(this_ptr);
40244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40246         this_ptr_conv.is_owned = false;
40247         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
40248         return ret_conv;
40249 }
40250
40251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40252         LDKOpenChannel this_ptr_conv;
40253         this_ptr_conv.inner = untag_ptr(this_ptr);
40254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40256         this_ptr_conv.is_owned = false;
40257         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
40258 }
40259
40260 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40261         LDKOpenChannel this_ptr_conv;
40262         this_ptr_conv.inner = untag_ptr(this_ptr);
40263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40265         this_ptr_conv.is_owned = false;
40266         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
40267         return ret_conv;
40268 }
40269
40270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40271         LDKOpenChannel this_ptr_conv;
40272         this_ptr_conv.inner = untag_ptr(this_ptr);
40273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40275         this_ptr_conv.is_owned = false;
40276         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
40277 }
40278
40279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40280         LDKOpenChannel this_ptr_conv;
40281         this_ptr_conv.inner = untag_ptr(this_ptr);
40282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40284         this_ptr_conv.is_owned = false;
40285         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40286         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
40287         return ret_arr;
40288 }
40289
40290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40291         LDKOpenChannel this_ptr_conv;
40292         this_ptr_conv.inner = untag_ptr(this_ptr);
40293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40295         this_ptr_conv.is_owned = false;
40296         LDKPublicKey val_ref;
40297         CHECK((*env)->GetArrayLength(env, val) == 33);
40298         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40299         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
40300 }
40301
40302 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40303         LDKOpenChannel this_ptr_conv;
40304         this_ptr_conv.inner = untag_ptr(this_ptr);
40305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40307         this_ptr_conv.is_owned = false;
40308         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40309         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
40310         return ret_arr;
40311 }
40312
40313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40314         LDKOpenChannel this_ptr_conv;
40315         this_ptr_conv.inner = untag_ptr(this_ptr);
40316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40318         this_ptr_conv.is_owned = false;
40319         LDKPublicKey val_ref;
40320         CHECK((*env)->GetArrayLength(env, val) == 33);
40321         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40322         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
40323 }
40324
40325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
40326         LDKOpenChannel this_ptr_conv;
40327         this_ptr_conv.inner = untag_ptr(this_ptr);
40328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40330         this_ptr_conv.is_owned = false;
40331         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40332         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
40333         return ret_arr;
40334 }
40335
40336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40337         LDKOpenChannel this_ptr_conv;
40338         this_ptr_conv.inner = untag_ptr(this_ptr);
40339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40341         this_ptr_conv.is_owned = false;
40342         LDKPublicKey val_ref;
40343         CHECK((*env)->GetArrayLength(env, val) == 33);
40344         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40345         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
40346 }
40347
40348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40349         LDKOpenChannel this_ptr_conv;
40350         this_ptr_conv.inner = untag_ptr(this_ptr);
40351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40353         this_ptr_conv.is_owned = false;
40354         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40355         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
40356         return ret_arr;
40357 }
40358
40359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40360         LDKOpenChannel this_ptr_conv;
40361         this_ptr_conv.inner = untag_ptr(this_ptr);
40362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40364         this_ptr_conv.is_owned = false;
40365         LDKPublicKey val_ref;
40366         CHECK((*env)->GetArrayLength(env, val) == 33);
40367         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40368         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
40369 }
40370
40371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40372         LDKOpenChannel this_ptr_conv;
40373         this_ptr_conv.inner = untag_ptr(this_ptr);
40374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40376         this_ptr_conv.is_owned = false;
40377         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40378         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
40379         return ret_arr;
40380 }
40381
40382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40383         LDKOpenChannel this_ptr_conv;
40384         this_ptr_conv.inner = untag_ptr(this_ptr);
40385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40387         this_ptr_conv.is_owned = false;
40388         LDKPublicKey val_ref;
40389         CHECK((*env)->GetArrayLength(env, val) == 33);
40390         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40391         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
40392 }
40393
40394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
40395         LDKOpenChannel this_ptr_conv;
40396         this_ptr_conv.inner = untag_ptr(this_ptr);
40397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40399         this_ptr_conv.is_owned = false;
40400         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40401         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
40402         return ret_arr;
40403 }
40404
40405 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) {
40406         LDKOpenChannel this_ptr_conv;
40407         this_ptr_conv.inner = untag_ptr(this_ptr);
40408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40410         this_ptr_conv.is_owned = false;
40411         LDKPublicKey val_ref;
40412         CHECK((*env)->GetArrayLength(env, val) == 33);
40413         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40414         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
40415 }
40416
40417 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
40418         LDKOpenChannel this_ptr_conv;
40419         this_ptr_conv.inner = untag_ptr(this_ptr);
40420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40422         this_ptr_conv.is_owned = false;
40423         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
40424         return ret_conv;
40425 }
40426
40427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
40428         LDKOpenChannel this_ptr_conv;
40429         this_ptr_conv.inner = untag_ptr(this_ptr);
40430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40432         this_ptr_conv.is_owned = false;
40433         OpenChannel_set_channel_flags(&this_ptr_conv, val);
40434 }
40435
40436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40437         LDKOpenChannel this_ptr_conv;
40438         this_ptr_conv.inner = untag_ptr(this_ptr);
40439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40441         this_ptr_conv.is_owned = false;
40442         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
40443         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
40444         int64_t ret_ref = tag_ptr(ret_copy, true);
40445         return ret_ref;
40446 }
40447
40448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40449         LDKOpenChannel this_ptr_conv;
40450         this_ptr_conv.inner = untag_ptr(this_ptr);
40451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40453         this_ptr_conv.is_owned = false;
40454         void* val_ptr = untag_ptr(val);
40455         CHECK_ACCESS(val_ptr);
40456         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
40457         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
40458         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
40459 }
40460
40461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
40462         LDKOpenChannel this_ptr_conv;
40463         this_ptr_conv.inner = untag_ptr(this_ptr);
40464         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40466         this_ptr_conv.is_owned = false;
40467         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
40468         int64_t ret_ref = 0;
40469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40471         return ret_ref;
40472 }
40473
40474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40475         LDKOpenChannel this_ptr_conv;
40476         this_ptr_conv.inner = untag_ptr(this_ptr);
40477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40479         this_ptr_conv.is_owned = false;
40480         LDKChannelTypeFeatures val_conv;
40481         val_conv.inner = untag_ptr(val);
40482         val_conv.is_owned = ptr_is_owned(val);
40483         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40484         val_conv = ChannelTypeFeatures_clone(&val_conv);
40485         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
40486 }
40487
40488 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) {
40489         LDKThirtyTwoBytes chain_hash_arg_ref;
40490         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
40491         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
40492         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
40493         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
40494         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
40495         LDKPublicKey funding_pubkey_arg_ref;
40496         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
40497         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
40498         LDKPublicKey revocation_basepoint_arg_ref;
40499         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
40500         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
40501         LDKPublicKey payment_point_arg_ref;
40502         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
40503         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
40504         LDKPublicKey delayed_payment_basepoint_arg_ref;
40505         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
40506         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
40507         LDKPublicKey htlc_basepoint_arg_ref;
40508         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
40509         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
40510         LDKPublicKey first_per_commitment_point_arg_ref;
40511         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
40512         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
40513         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
40514         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
40515         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
40516         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
40517         LDKChannelTypeFeatures channel_type_arg_conv;
40518         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
40519         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
40520         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
40521         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
40522         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);
40523         int64_t ret_ref = 0;
40524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40526         return ret_ref;
40527 }
40528
40529 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
40530         LDKOpenChannel ret_var = OpenChannel_clone(arg);
40531         int64_t ret_ref = 0;
40532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40534         return ret_ref;
40535 }
40536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40537         LDKOpenChannel arg_conv;
40538         arg_conv.inner = untag_ptr(arg);
40539         arg_conv.is_owned = ptr_is_owned(arg);
40540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40541         arg_conv.is_owned = false;
40542         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
40543         return ret_conv;
40544 }
40545
40546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40547         LDKOpenChannel orig_conv;
40548         orig_conv.inner = untag_ptr(orig);
40549         orig_conv.is_owned = ptr_is_owned(orig);
40550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40551         orig_conv.is_owned = false;
40552         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
40553         int64_t ret_ref = 0;
40554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40556         return ret_ref;
40557 }
40558
40559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40560         LDKOpenChannel a_conv;
40561         a_conv.inner = untag_ptr(a);
40562         a_conv.is_owned = ptr_is_owned(a);
40563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40564         a_conv.is_owned = false;
40565         LDKOpenChannel b_conv;
40566         b_conv.inner = untag_ptr(b);
40567         b_conv.is_owned = ptr_is_owned(b);
40568         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40569         b_conv.is_owned = false;
40570         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
40571         return ret_conv;
40572 }
40573
40574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40575         LDKOpenChannelV2 this_obj_conv;
40576         this_obj_conv.inner = untag_ptr(this_obj);
40577         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40579         OpenChannelV2_free(this_obj_conv);
40580 }
40581
40582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
40583         LDKOpenChannelV2 this_ptr_conv;
40584         this_ptr_conv.inner = untag_ptr(this_ptr);
40585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40587         this_ptr_conv.is_owned = false;
40588         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40589         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_chain_hash(&this_ptr_conv));
40590         return ret_arr;
40591 }
40592
40593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40594         LDKOpenChannelV2 this_ptr_conv;
40595         this_ptr_conv.inner = untag_ptr(this_ptr);
40596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40598         this_ptr_conv.is_owned = false;
40599         LDKThirtyTwoBytes val_ref;
40600         CHECK((*env)->GetArrayLength(env, val) == 32);
40601         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40602         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
40603 }
40604
40605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
40606         LDKOpenChannelV2 this_ptr_conv;
40607         this_ptr_conv.inner = untag_ptr(this_ptr);
40608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40610         this_ptr_conv.is_owned = false;
40611         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40612         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv));
40613         return ret_arr;
40614 }
40615
40616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40617         LDKOpenChannelV2 this_ptr_conv;
40618         this_ptr_conv.inner = untag_ptr(this_ptr);
40619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40621         this_ptr_conv.is_owned = false;
40622         LDKThirtyTwoBytes val_ref;
40623         CHECK((*env)->GetArrayLength(env, val) == 32);
40624         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40625         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
40626 }
40627
40628 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) {
40629         LDKOpenChannelV2 this_ptr_conv;
40630         this_ptr_conv.inner = untag_ptr(this_ptr);
40631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40633         this_ptr_conv.is_owned = false;
40634         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
40635         return ret_conv;
40636 }
40637
40638 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) {
40639         LDKOpenChannelV2 this_ptr_conv;
40640         this_ptr_conv.inner = untag_ptr(this_ptr);
40641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40643         this_ptr_conv.is_owned = false;
40644         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
40645 }
40646
40647 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) {
40648         LDKOpenChannelV2 this_ptr_conv;
40649         this_ptr_conv.inner = untag_ptr(this_ptr);
40650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40652         this_ptr_conv.is_owned = false;
40653         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
40654         return ret_conv;
40655 }
40656
40657 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) {
40658         LDKOpenChannelV2 this_ptr_conv;
40659         this_ptr_conv.inner = untag_ptr(this_ptr);
40660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40662         this_ptr_conv.is_owned = false;
40663         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
40664 }
40665
40666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40667         LDKOpenChannelV2 this_ptr_conv;
40668         this_ptr_conv.inner = untag_ptr(this_ptr);
40669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40671         this_ptr_conv.is_owned = false;
40672         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
40673         return ret_conv;
40674 }
40675
40676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40677         LDKOpenChannelV2 this_ptr_conv;
40678         this_ptr_conv.inner = untag_ptr(this_ptr);
40679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40681         this_ptr_conv.is_owned = false;
40682         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
40683 }
40684
40685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
40686         LDKOpenChannelV2 this_ptr_conv;
40687         this_ptr_conv.inner = untag_ptr(this_ptr);
40688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40690         this_ptr_conv.is_owned = false;
40691         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
40692         return ret_conv;
40693 }
40694
40695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40696         LDKOpenChannelV2 this_ptr_conv;
40697         this_ptr_conv.inner = untag_ptr(this_ptr);
40698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40700         this_ptr_conv.is_owned = false;
40701         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
40702 }
40703
40704 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) {
40705         LDKOpenChannelV2 this_ptr_conv;
40706         this_ptr_conv.inner = untag_ptr(this_ptr);
40707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40709         this_ptr_conv.is_owned = false;
40710         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
40711         return ret_conv;
40712 }
40713
40714 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) {
40715         LDKOpenChannelV2 this_ptr_conv;
40716         this_ptr_conv.inner = untag_ptr(this_ptr);
40717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40719         this_ptr_conv.is_owned = false;
40720         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
40721 }
40722
40723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40724         LDKOpenChannelV2 this_ptr_conv;
40725         this_ptr_conv.inner = untag_ptr(this_ptr);
40726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40728         this_ptr_conv.is_owned = false;
40729         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
40730         return ret_conv;
40731 }
40732
40733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40734         LDKOpenChannelV2 this_ptr_conv;
40735         this_ptr_conv.inner = untag_ptr(this_ptr);
40736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40738         this_ptr_conv.is_owned = false;
40739         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
40740 }
40741
40742 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
40743         LDKOpenChannelV2 this_ptr_conv;
40744         this_ptr_conv.inner = untag_ptr(this_ptr);
40745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40747         this_ptr_conv.is_owned = false;
40748         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
40749         return ret_conv;
40750 }
40751
40752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40753         LDKOpenChannelV2 this_ptr_conv;
40754         this_ptr_conv.inner = untag_ptr(this_ptr);
40755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40757         this_ptr_conv.is_owned = false;
40758         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
40759 }
40760
40761 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
40762         LDKOpenChannelV2 this_ptr_conv;
40763         this_ptr_conv.inner = untag_ptr(this_ptr);
40764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40766         this_ptr_conv.is_owned = false;
40767         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
40768         return ret_conv;
40769 }
40770
40771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40772         LDKOpenChannelV2 this_ptr_conv;
40773         this_ptr_conv.inner = untag_ptr(this_ptr);
40774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40776         this_ptr_conv.is_owned = false;
40777         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
40778 }
40779
40780 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
40781         LDKOpenChannelV2 this_ptr_conv;
40782         this_ptr_conv.inner = untag_ptr(this_ptr);
40783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40785         this_ptr_conv.is_owned = false;
40786         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
40787         return ret_conv;
40788 }
40789
40790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40791         LDKOpenChannelV2 this_ptr_conv;
40792         this_ptr_conv.inner = untag_ptr(this_ptr);
40793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40795         this_ptr_conv.is_owned = false;
40796         OpenChannelV2_set_locktime(&this_ptr_conv, val);
40797 }
40798
40799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40800         LDKOpenChannelV2 this_ptr_conv;
40801         this_ptr_conv.inner = untag_ptr(this_ptr);
40802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40804         this_ptr_conv.is_owned = false;
40805         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40806         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
40807         return ret_arr;
40808 }
40809
40810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40811         LDKOpenChannelV2 this_ptr_conv;
40812         this_ptr_conv.inner = untag_ptr(this_ptr);
40813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40815         this_ptr_conv.is_owned = false;
40816         LDKPublicKey val_ref;
40817         CHECK((*env)->GetArrayLength(env, val) == 33);
40818         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40819         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
40820 }
40821
40822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40823         LDKOpenChannelV2 this_ptr_conv;
40824         this_ptr_conv.inner = untag_ptr(this_ptr);
40825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40827         this_ptr_conv.is_owned = false;
40828         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40829         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
40830         return ret_arr;
40831 }
40832
40833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40834         LDKOpenChannelV2 this_ptr_conv;
40835         this_ptr_conv.inner = untag_ptr(this_ptr);
40836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40838         this_ptr_conv.is_owned = false;
40839         LDKPublicKey val_ref;
40840         CHECK((*env)->GetArrayLength(env, val) == 33);
40841         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40842         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
40843 }
40844
40845 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40846         LDKOpenChannelV2 this_ptr_conv;
40847         this_ptr_conv.inner = untag_ptr(this_ptr);
40848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40850         this_ptr_conv.is_owned = false;
40851         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40852         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
40853         return ret_arr;
40854 }
40855
40856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40857         LDKOpenChannelV2 this_ptr_conv;
40858         this_ptr_conv.inner = untag_ptr(this_ptr);
40859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40861         this_ptr_conv.is_owned = false;
40862         LDKPublicKey val_ref;
40863         CHECK((*env)->GetArrayLength(env, val) == 33);
40864         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40865         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
40866 }
40867
40868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40869         LDKOpenChannelV2 this_ptr_conv;
40870         this_ptr_conv.inner = untag_ptr(this_ptr);
40871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40873         this_ptr_conv.is_owned = false;
40874         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40875         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
40876         return ret_arr;
40877 }
40878
40879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40880         LDKOpenChannelV2 this_ptr_conv;
40881         this_ptr_conv.inner = untag_ptr(this_ptr);
40882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40884         this_ptr_conv.is_owned = false;
40885         LDKPublicKey val_ref;
40886         CHECK((*env)->GetArrayLength(env, val) == 33);
40887         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40888         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
40889 }
40890
40891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
40892         LDKOpenChannelV2 this_ptr_conv;
40893         this_ptr_conv.inner = untag_ptr(this_ptr);
40894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40896         this_ptr_conv.is_owned = false;
40897         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40898         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
40899         return ret_arr;
40900 }
40901
40902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40903         LDKOpenChannelV2 this_ptr_conv;
40904         this_ptr_conv.inner = untag_ptr(this_ptr);
40905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40907         this_ptr_conv.is_owned = false;
40908         LDKPublicKey val_ref;
40909         CHECK((*env)->GetArrayLength(env, val) == 33);
40910         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40911         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
40912 }
40913
40914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
40915         LDKOpenChannelV2 this_ptr_conv;
40916         this_ptr_conv.inner = untag_ptr(this_ptr);
40917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40919         this_ptr_conv.is_owned = false;
40920         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40921         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
40922         return ret_arr;
40923 }
40924
40925 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) {
40926         LDKOpenChannelV2 this_ptr_conv;
40927         this_ptr_conv.inner = untag_ptr(this_ptr);
40928         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40930         this_ptr_conv.is_owned = false;
40931         LDKPublicKey val_ref;
40932         CHECK((*env)->GetArrayLength(env, val) == 33);
40933         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40934         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
40935 }
40936
40937 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
40938         LDKOpenChannelV2 this_ptr_conv;
40939         this_ptr_conv.inner = untag_ptr(this_ptr);
40940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40942         this_ptr_conv.is_owned = false;
40943         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40944         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
40945         return ret_arr;
40946 }
40947
40948 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) {
40949         LDKOpenChannelV2 this_ptr_conv;
40950         this_ptr_conv.inner = untag_ptr(this_ptr);
40951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40953         this_ptr_conv.is_owned = false;
40954         LDKPublicKey val_ref;
40955         CHECK((*env)->GetArrayLength(env, val) == 33);
40956         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40957         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
40958 }
40959
40960 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
40961         LDKOpenChannelV2 this_ptr_conv;
40962         this_ptr_conv.inner = untag_ptr(this_ptr);
40963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40965         this_ptr_conv.is_owned = false;
40966         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
40967         return ret_conv;
40968 }
40969
40970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
40971         LDKOpenChannelV2 this_ptr_conv;
40972         this_ptr_conv.inner = untag_ptr(this_ptr);
40973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40975         this_ptr_conv.is_owned = false;
40976         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
40977 }
40978
40979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40980         LDKOpenChannelV2 this_ptr_conv;
40981         this_ptr_conv.inner = untag_ptr(this_ptr);
40982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40984         this_ptr_conv.is_owned = false;
40985         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
40986         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
40987         int64_t ret_ref = tag_ptr(ret_copy, true);
40988         return ret_ref;
40989 }
40990
40991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40992         LDKOpenChannelV2 this_ptr_conv;
40993         this_ptr_conv.inner = untag_ptr(this_ptr);
40994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40996         this_ptr_conv.is_owned = false;
40997         void* val_ptr = untag_ptr(val);
40998         CHECK_ACCESS(val_ptr);
40999         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
41000         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
41001         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
41002 }
41003
41004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
41005         LDKOpenChannelV2 this_ptr_conv;
41006         this_ptr_conv.inner = untag_ptr(this_ptr);
41007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41009         this_ptr_conv.is_owned = false;
41010         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
41011         int64_t ret_ref = 0;
41012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41014         return ret_ref;
41015 }
41016
41017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41018         LDKOpenChannelV2 this_ptr_conv;
41019         this_ptr_conv.inner = untag_ptr(this_ptr);
41020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41022         this_ptr_conv.is_owned = false;
41023         LDKChannelTypeFeatures val_conv;
41024         val_conv.inner = untag_ptr(val);
41025         val_conv.is_owned = ptr_is_owned(val);
41026         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41027         val_conv = ChannelTypeFeatures_clone(&val_conv);
41028         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
41029 }
41030
41031 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
41032         LDKOpenChannelV2 this_ptr_conv;
41033         this_ptr_conv.inner = untag_ptr(this_ptr);
41034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41036         this_ptr_conv.is_owned = false;
41037         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
41038         return ret_conv;
41039 }
41040
41041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
41042         LDKOpenChannelV2 this_ptr_conv;
41043         this_ptr_conv.inner = untag_ptr(this_ptr);
41044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41046         this_ptr_conv.is_owned = false;
41047         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
41048         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
41049 }
41050
41051 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) {
41052         LDKThirtyTwoBytes chain_hash_arg_ref;
41053         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
41054         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
41055         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
41056         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
41057         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
41058         LDKPublicKey funding_pubkey_arg_ref;
41059         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
41060         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
41061         LDKPublicKey revocation_basepoint_arg_ref;
41062         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
41063         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
41064         LDKPublicKey payment_basepoint_arg_ref;
41065         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
41066         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
41067         LDKPublicKey delayed_payment_basepoint_arg_ref;
41068         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
41069         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
41070         LDKPublicKey htlc_basepoint_arg_ref;
41071         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
41072         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
41073         LDKPublicKey first_per_commitment_point_arg_ref;
41074         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
41075         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
41076         LDKPublicKey second_per_commitment_point_arg_ref;
41077         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
41078         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
41079         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
41080         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
41081         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
41082         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
41083         LDKChannelTypeFeatures channel_type_arg_conv;
41084         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
41085         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
41086         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
41087         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
41088         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
41089         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);
41090         int64_t ret_ref = 0;
41091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41093         return ret_ref;
41094 }
41095
41096 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
41097         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
41098         int64_t ret_ref = 0;
41099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41101         return ret_ref;
41102 }
41103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41104         LDKOpenChannelV2 arg_conv;
41105         arg_conv.inner = untag_ptr(arg);
41106         arg_conv.is_owned = ptr_is_owned(arg);
41107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41108         arg_conv.is_owned = false;
41109         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
41110         return ret_conv;
41111 }
41112
41113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41114         LDKOpenChannelV2 orig_conv;
41115         orig_conv.inner = untag_ptr(orig);
41116         orig_conv.is_owned = ptr_is_owned(orig);
41117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41118         orig_conv.is_owned = false;
41119         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
41120         int64_t ret_ref = 0;
41121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41123         return ret_ref;
41124 }
41125
41126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41127         LDKOpenChannelV2 a_conv;
41128         a_conv.inner = untag_ptr(a);
41129         a_conv.is_owned = ptr_is_owned(a);
41130         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41131         a_conv.is_owned = false;
41132         LDKOpenChannelV2 b_conv;
41133         b_conv.inner = untag_ptr(b);
41134         b_conv.is_owned = ptr_is_owned(b);
41135         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41136         b_conv.is_owned = false;
41137         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
41138         return ret_conv;
41139 }
41140
41141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41142         LDKAcceptChannel this_obj_conv;
41143         this_obj_conv.inner = untag_ptr(this_obj);
41144         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41146         AcceptChannel_free(this_obj_conv);
41147 }
41148
41149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41150         LDKAcceptChannel this_ptr_conv;
41151         this_ptr_conv.inner = untag_ptr(this_ptr);
41152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41154         this_ptr_conv.is_owned = false;
41155         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41156         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
41157         return ret_arr;
41158 }
41159
41160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41161         LDKAcceptChannel this_ptr_conv;
41162         this_ptr_conv.inner = untag_ptr(this_ptr);
41163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41165         this_ptr_conv.is_owned = false;
41166         LDKThirtyTwoBytes val_ref;
41167         CHECK((*env)->GetArrayLength(env, val) == 32);
41168         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41169         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
41170 }
41171
41172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
41173         LDKAcceptChannel this_ptr_conv;
41174         this_ptr_conv.inner = untag_ptr(this_ptr);
41175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41177         this_ptr_conv.is_owned = false;
41178         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
41179         return ret_conv;
41180 }
41181
41182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41183         LDKAcceptChannel this_ptr_conv;
41184         this_ptr_conv.inner = untag_ptr(this_ptr);
41185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41187         this_ptr_conv.is_owned = false;
41188         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
41189 }
41190
41191 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) {
41192         LDKAcceptChannel this_ptr_conv;
41193         this_ptr_conv.inner = untag_ptr(this_ptr);
41194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41196         this_ptr_conv.is_owned = false;
41197         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41198         return ret_conv;
41199 }
41200
41201 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) {
41202         LDKAcceptChannel this_ptr_conv;
41203         this_ptr_conv.inner = untag_ptr(this_ptr);
41204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41206         this_ptr_conv.is_owned = false;
41207         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41208 }
41209
41210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
41211         LDKAcceptChannel this_ptr_conv;
41212         this_ptr_conv.inner = untag_ptr(this_ptr);
41213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41215         this_ptr_conv.is_owned = false;
41216         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
41217         return ret_conv;
41218 }
41219
41220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41221         LDKAcceptChannel this_ptr_conv;
41222         this_ptr_conv.inner = untag_ptr(this_ptr);
41223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41225         this_ptr_conv.is_owned = false;
41226         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
41227 }
41228
41229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41230         LDKAcceptChannel this_ptr_conv;
41231         this_ptr_conv.inner = untag_ptr(this_ptr);
41232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41234         this_ptr_conv.is_owned = false;
41235         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
41236         return ret_conv;
41237 }
41238
41239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41240         LDKAcceptChannel this_ptr_conv;
41241         this_ptr_conv.inner = untag_ptr(this_ptr);
41242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41244         this_ptr_conv.is_owned = false;
41245         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
41246 }
41247
41248 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
41249         LDKAcceptChannel this_ptr_conv;
41250         this_ptr_conv.inner = untag_ptr(this_ptr);
41251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41253         this_ptr_conv.is_owned = false;
41254         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
41255         return ret_conv;
41256 }
41257
41258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41259         LDKAcceptChannel this_ptr_conv;
41260         this_ptr_conv.inner = untag_ptr(this_ptr);
41261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41263         this_ptr_conv.is_owned = false;
41264         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
41265 }
41266
41267 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
41268         LDKAcceptChannel this_ptr_conv;
41269         this_ptr_conv.inner = untag_ptr(this_ptr);
41270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41272         this_ptr_conv.is_owned = false;
41273         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
41274         return ret_conv;
41275 }
41276
41277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41278         LDKAcceptChannel this_ptr_conv;
41279         this_ptr_conv.inner = untag_ptr(this_ptr);
41280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41282         this_ptr_conv.is_owned = false;
41283         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
41284 }
41285
41286 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
41287         LDKAcceptChannel this_ptr_conv;
41288         this_ptr_conv.inner = untag_ptr(this_ptr);
41289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41291         this_ptr_conv.is_owned = false;
41292         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
41293         return ret_conv;
41294 }
41295
41296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41297         LDKAcceptChannel this_ptr_conv;
41298         this_ptr_conv.inner = untag_ptr(this_ptr);
41299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41301         this_ptr_conv.is_owned = false;
41302         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
41303 }
41304
41305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41306         LDKAcceptChannel this_ptr_conv;
41307         this_ptr_conv.inner = untag_ptr(this_ptr);
41308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41310         this_ptr_conv.is_owned = false;
41311         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41312         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
41313         return ret_arr;
41314 }
41315
41316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41317         LDKAcceptChannel this_ptr_conv;
41318         this_ptr_conv.inner = untag_ptr(this_ptr);
41319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41321         this_ptr_conv.is_owned = false;
41322         LDKPublicKey val_ref;
41323         CHECK((*env)->GetArrayLength(env, val) == 33);
41324         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41325         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
41326 }
41327
41328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41329         LDKAcceptChannel this_ptr_conv;
41330         this_ptr_conv.inner = untag_ptr(this_ptr);
41331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41333         this_ptr_conv.is_owned = false;
41334         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41335         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
41336         return ret_arr;
41337 }
41338
41339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41340         LDKAcceptChannel this_ptr_conv;
41341         this_ptr_conv.inner = untag_ptr(this_ptr);
41342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41344         this_ptr_conv.is_owned = false;
41345         LDKPublicKey val_ref;
41346         CHECK((*env)->GetArrayLength(env, val) == 33);
41347         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41348         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
41349 }
41350
41351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41352         LDKAcceptChannel this_ptr_conv;
41353         this_ptr_conv.inner = untag_ptr(this_ptr);
41354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41356         this_ptr_conv.is_owned = false;
41357         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41358         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
41359         return ret_arr;
41360 }
41361
41362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41363         LDKAcceptChannel this_ptr_conv;
41364         this_ptr_conv.inner = untag_ptr(this_ptr);
41365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41367         this_ptr_conv.is_owned = false;
41368         LDKPublicKey val_ref;
41369         CHECK((*env)->GetArrayLength(env, val) == 33);
41370         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41371         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
41372 }
41373
41374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41375         LDKAcceptChannel this_ptr_conv;
41376         this_ptr_conv.inner = untag_ptr(this_ptr);
41377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41379         this_ptr_conv.is_owned = false;
41380         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41381         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
41382         return ret_arr;
41383 }
41384
41385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41386         LDKAcceptChannel this_ptr_conv;
41387         this_ptr_conv.inner = untag_ptr(this_ptr);
41388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41390         this_ptr_conv.is_owned = false;
41391         LDKPublicKey val_ref;
41392         CHECK((*env)->GetArrayLength(env, val) == 33);
41393         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41394         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
41395 }
41396
41397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41398         LDKAcceptChannel this_ptr_conv;
41399         this_ptr_conv.inner = untag_ptr(this_ptr);
41400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41402         this_ptr_conv.is_owned = false;
41403         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41404         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
41405         return ret_arr;
41406 }
41407
41408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41409         LDKAcceptChannel this_ptr_conv;
41410         this_ptr_conv.inner = untag_ptr(this_ptr);
41411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41413         this_ptr_conv.is_owned = false;
41414         LDKPublicKey val_ref;
41415         CHECK((*env)->GetArrayLength(env, val) == 33);
41416         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41417         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
41418 }
41419
41420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41421         LDKAcceptChannel this_ptr_conv;
41422         this_ptr_conv.inner = untag_ptr(this_ptr);
41423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41425         this_ptr_conv.is_owned = false;
41426         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41427         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
41428         return ret_arr;
41429 }
41430
41431 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) {
41432         LDKAcceptChannel this_ptr_conv;
41433         this_ptr_conv.inner = untag_ptr(this_ptr);
41434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41436         this_ptr_conv.is_owned = false;
41437         LDKPublicKey val_ref;
41438         CHECK((*env)->GetArrayLength(env, val) == 33);
41439         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41440         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
41441 }
41442
41443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41444         LDKAcceptChannel this_ptr_conv;
41445         this_ptr_conv.inner = untag_ptr(this_ptr);
41446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41448         this_ptr_conv.is_owned = false;
41449         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
41450         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
41451         int64_t ret_ref = tag_ptr(ret_copy, true);
41452         return ret_ref;
41453 }
41454
41455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41456         LDKAcceptChannel this_ptr_conv;
41457         this_ptr_conv.inner = untag_ptr(this_ptr);
41458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41460         this_ptr_conv.is_owned = false;
41461         void* val_ptr = untag_ptr(val);
41462         CHECK_ACCESS(val_ptr);
41463         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
41464         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
41465         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
41466 }
41467
41468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
41469         LDKAcceptChannel this_ptr_conv;
41470         this_ptr_conv.inner = untag_ptr(this_ptr);
41471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41473         this_ptr_conv.is_owned = false;
41474         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
41475         int64_t ret_ref = 0;
41476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41478         return ret_ref;
41479 }
41480
41481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41482         LDKAcceptChannel this_ptr_conv;
41483         this_ptr_conv.inner = untag_ptr(this_ptr);
41484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41486         this_ptr_conv.is_owned = false;
41487         LDKChannelTypeFeatures val_conv;
41488         val_conv.inner = untag_ptr(val);
41489         val_conv.is_owned = ptr_is_owned(val);
41490         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41491         val_conv = ChannelTypeFeatures_clone(&val_conv);
41492         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
41493 }
41494
41495 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) {
41496         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
41497         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
41498         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
41499         LDKPublicKey funding_pubkey_arg_ref;
41500         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
41501         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
41502         LDKPublicKey revocation_basepoint_arg_ref;
41503         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
41504         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
41505         LDKPublicKey payment_point_arg_ref;
41506         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
41507         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
41508         LDKPublicKey delayed_payment_basepoint_arg_ref;
41509         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
41510         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
41511         LDKPublicKey htlc_basepoint_arg_ref;
41512         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
41513         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
41514         LDKPublicKey first_per_commitment_point_arg_ref;
41515         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
41516         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
41517         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
41518         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
41519         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
41520         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
41521         LDKChannelTypeFeatures channel_type_arg_conv;
41522         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
41523         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
41525         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
41526         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);
41527         int64_t ret_ref = 0;
41528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41530         return ret_ref;
41531 }
41532
41533 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
41534         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
41535         int64_t ret_ref = 0;
41536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41538         return ret_ref;
41539 }
41540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41541         LDKAcceptChannel arg_conv;
41542         arg_conv.inner = untag_ptr(arg);
41543         arg_conv.is_owned = ptr_is_owned(arg);
41544         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41545         arg_conv.is_owned = false;
41546         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
41547         return ret_conv;
41548 }
41549
41550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41551         LDKAcceptChannel orig_conv;
41552         orig_conv.inner = untag_ptr(orig);
41553         orig_conv.is_owned = ptr_is_owned(orig);
41554         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41555         orig_conv.is_owned = false;
41556         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
41557         int64_t ret_ref = 0;
41558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41560         return ret_ref;
41561 }
41562
41563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41564         LDKAcceptChannel a_conv;
41565         a_conv.inner = untag_ptr(a);
41566         a_conv.is_owned = ptr_is_owned(a);
41567         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41568         a_conv.is_owned = false;
41569         LDKAcceptChannel b_conv;
41570         b_conv.inner = untag_ptr(b);
41571         b_conv.is_owned = ptr_is_owned(b);
41572         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41573         b_conv.is_owned = false;
41574         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
41575         return ret_conv;
41576 }
41577
41578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41579         LDKAcceptChannelV2 this_obj_conv;
41580         this_obj_conv.inner = untag_ptr(this_obj);
41581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41583         AcceptChannelV2_free(this_obj_conv);
41584 }
41585
41586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41587         LDKAcceptChannelV2 this_ptr_conv;
41588         this_ptr_conv.inner = untag_ptr(this_ptr);
41589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41591         this_ptr_conv.is_owned = false;
41592         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41593         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv));
41594         return ret_arr;
41595 }
41596
41597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41598         LDKAcceptChannelV2 this_ptr_conv;
41599         this_ptr_conv.inner = untag_ptr(this_ptr);
41600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41602         this_ptr_conv.is_owned = false;
41603         LDKThirtyTwoBytes val_ref;
41604         CHECK((*env)->GetArrayLength(env, val) == 32);
41605         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
41606         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
41607 }
41608
41609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
41610         LDKAcceptChannelV2 this_ptr_conv;
41611         this_ptr_conv.inner = untag_ptr(this_ptr);
41612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41614         this_ptr_conv.is_owned = false;
41615         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
41616         return ret_conv;
41617 }
41618
41619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41620         LDKAcceptChannelV2 this_ptr_conv;
41621         this_ptr_conv.inner = untag_ptr(this_ptr);
41622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41624         this_ptr_conv.is_owned = false;
41625         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
41626 }
41627
41628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
41629         LDKAcceptChannelV2 this_ptr_conv;
41630         this_ptr_conv.inner = untag_ptr(this_ptr);
41631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41633         this_ptr_conv.is_owned = false;
41634         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
41635         return ret_conv;
41636 }
41637
41638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41639         LDKAcceptChannelV2 this_ptr_conv;
41640         this_ptr_conv.inner = untag_ptr(this_ptr);
41641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41643         this_ptr_conv.is_owned = false;
41644         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
41645 }
41646
41647 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) {
41648         LDKAcceptChannelV2 this_ptr_conv;
41649         this_ptr_conv.inner = untag_ptr(this_ptr);
41650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41652         this_ptr_conv.is_owned = false;
41653         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
41654         return ret_conv;
41655 }
41656
41657 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) {
41658         LDKAcceptChannelV2 this_ptr_conv;
41659         this_ptr_conv.inner = untag_ptr(this_ptr);
41660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41662         this_ptr_conv.is_owned = false;
41663         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
41664 }
41665
41666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41667         LDKAcceptChannelV2 this_ptr_conv;
41668         this_ptr_conv.inner = untag_ptr(this_ptr);
41669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41671         this_ptr_conv.is_owned = false;
41672         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
41673         return ret_conv;
41674 }
41675
41676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41677         LDKAcceptChannelV2 this_ptr_conv;
41678         this_ptr_conv.inner = untag_ptr(this_ptr);
41679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41681         this_ptr_conv.is_owned = false;
41682         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
41683 }
41684
41685 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
41686         LDKAcceptChannelV2 this_ptr_conv;
41687         this_ptr_conv.inner = untag_ptr(this_ptr);
41688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41690         this_ptr_conv.is_owned = false;
41691         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
41692         return ret_conv;
41693 }
41694
41695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41696         LDKAcceptChannelV2 this_ptr_conv;
41697         this_ptr_conv.inner = untag_ptr(this_ptr);
41698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41700         this_ptr_conv.is_owned = false;
41701         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
41702 }
41703
41704 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
41705         LDKAcceptChannelV2 this_ptr_conv;
41706         this_ptr_conv.inner = untag_ptr(this_ptr);
41707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41709         this_ptr_conv.is_owned = false;
41710         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
41711         return ret_conv;
41712 }
41713
41714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41715         LDKAcceptChannelV2 this_ptr_conv;
41716         this_ptr_conv.inner = untag_ptr(this_ptr);
41717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41719         this_ptr_conv.is_owned = false;
41720         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
41721 }
41722
41723 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
41724         LDKAcceptChannelV2 this_ptr_conv;
41725         this_ptr_conv.inner = untag_ptr(this_ptr);
41726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41728         this_ptr_conv.is_owned = false;
41729         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
41730         return ret_conv;
41731 }
41732
41733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
41734         LDKAcceptChannelV2 this_ptr_conv;
41735         this_ptr_conv.inner = untag_ptr(this_ptr);
41736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41738         this_ptr_conv.is_owned = false;
41739         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
41740 }
41741
41742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41743         LDKAcceptChannelV2 this_ptr_conv;
41744         this_ptr_conv.inner = untag_ptr(this_ptr);
41745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41747         this_ptr_conv.is_owned = false;
41748         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41749         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form);
41750         return ret_arr;
41751 }
41752
41753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41754         LDKAcceptChannelV2 this_ptr_conv;
41755         this_ptr_conv.inner = untag_ptr(this_ptr);
41756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41758         this_ptr_conv.is_owned = false;
41759         LDKPublicKey val_ref;
41760         CHECK((*env)->GetArrayLength(env, val) == 33);
41761         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41762         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
41763 }
41764
41765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41766         LDKAcceptChannelV2 this_ptr_conv;
41767         this_ptr_conv.inner = untag_ptr(this_ptr);
41768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41770         this_ptr_conv.is_owned = false;
41771         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41772         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form);
41773         return ret_arr;
41774 }
41775
41776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41777         LDKAcceptChannelV2 this_ptr_conv;
41778         this_ptr_conv.inner = untag_ptr(this_ptr);
41779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41781         this_ptr_conv.is_owned = false;
41782         LDKPublicKey val_ref;
41783         CHECK((*env)->GetArrayLength(env, val) == 33);
41784         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41785         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
41786 }
41787
41788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41789         LDKAcceptChannelV2 this_ptr_conv;
41790         this_ptr_conv.inner = untag_ptr(this_ptr);
41791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41793         this_ptr_conv.is_owned = false;
41794         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41795         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form);
41796         return ret_arr;
41797 }
41798
41799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41800         LDKAcceptChannelV2 this_ptr_conv;
41801         this_ptr_conv.inner = untag_ptr(this_ptr);
41802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41804         this_ptr_conv.is_owned = false;
41805         LDKPublicKey val_ref;
41806         CHECK((*env)->GetArrayLength(env, val) == 33);
41807         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41808         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
41809 }
41810
41811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41812         LDKAcceptChannelV2 this_ptr_conv;
41813         this_ptr_conv.inner = untag_ptr(this_ptr);
41814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41816         this_ptr_conv.is_owned = false;
41817         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41818         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
41819         return ret_arr;
41820 }
41821
41822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41823         LDKAcceptChannelV2 this_ptr_conv;
41824         this_ptr_conv.inner = untag_ptr(this_ptr);
41825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41827         this_ptr_conv.is_owned = false;
41828         LDKPublicKey val_ref;
41829         CHECK((*env)->GetArrayLength(env, val) == 33);
41830         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41831         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
41832 }
41833
41834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
41835         LDKAcceptChannelV2 this_ptr_conv;
41836         this_ptr_conv.inner = untag_ptr(this_ptr);
41837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41839         this_ptr_conv.is_owned = false;
41840         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41841         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form);
41842         return ret_arr;
41843 }
41844
41845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41846         LDKAcceptChannelV2 this_ptr_conv;
41847         this_ptr_conv.inner = untag_ptr(this_ptr);
41848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41850         this_ptr_conv.is_owned = false;
41851         LDKPublicKey val_ref;
41852         CHECK((*env)->GetArrayLength(env, val) == 33);
41853         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41854         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
41855 }
41856
41857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41858         LDKAcceptChannelV2 this_ptr_conv;
41859         this_ptr_conv.inner = untag_ptr(this_ptr);
41860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41862         this_ptr_conv.is_owned = false;
41863         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41864         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
41865         return ret_arr;
41866 }
41867
41868 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) {
41869         LDKAcceptChannelV2 this_ptr_conv;
41870         this_ptr_conv.inner = untag_ptr(this_ptr);
41871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41873         this_ptr_conv.is_owned = false;
41874         LDKPublicKey val_ref;
41875         CHECK((*env)->GetArrayLength(env, val) == 33);
41876         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41877         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
41878 }
41879
41880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
41881         LDKAcceptChannelV2 this_ptr_conv;
41882         this_ptr_conv.inner = untag_ptr(this_ptr);
41883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41885         this_ptr_conv.is_owned = false;
41886         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41887         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
41888         return ret_arr;
41889 }
41890
41891 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) {
41892         LDKAcceptChannelV2 this_ptr_conv;
41893         this_ptr_conv.inner = untag_ptr(this_ptr);
41894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41896         this_ptr_conv.is_owned = false;
41897         LDKPublicKey val_ref;
41898         CHECK((*env)->GetArrayLength(env, val) == 33);
41899         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41900         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
41901 }
41902
41903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41904         LDKAcceptChannelV2 this_ptr_conv;
41905         this_ptr_conv.inner = untag_ptr(this_ptr);
41906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41908         this_ptr_conv.is_owned = false;
41909         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
41910         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
41911         int64_t ret_ref = tag_ptr(ret_copy, true);
41912         return ret_ref;
41913 }
41914
41915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41916         LDKAcceptChannelV2 this_ptr_conv;
41917         this_ptr_conv.inner = untag_ptr(this_ptr);
41918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41920         this_ptr_conv.is_owned = false;
41921         void* val_ptr = untag_ptr(val);
41922         CHECK_ACCESS(val_ptr);
41923         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
41924         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
41925         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
41926 }
41927
41928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
41929         LDKAcceptChannelV2 this_ptr_conv;
41930         this_ptr_conv.inner = untag_ptr(this_ptr);
41931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41933         this_ptr_conv.is_owned = false;
41934         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
41935         int64_t ret_ref = 0;
41936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41938         return ret_ref;
41939 }
41940
41941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41942         LDKAcceptChannelV2 this_ptr_conv;
41943         this_ptr_conv.inner = untag_ptr(this_ptr);
41944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41946         this_ptr_conv.is_owned = false;
41947         LDKChannelTypeFeatures val_conv;
41948         val_conv.inner = untag_ptr(val);
41949         val_conv.is_owned = ptr_is_owned(val);
41950         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41951         val_conv = ChannelTypeFeatures_clone(&val_conv);
41952         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
41953 }
41954
41955 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
41956         LDKAcceptChannelV2 this_ptr_conv;
41957         this_ptr_conv.inner = untag_ptr(this_ptr);
41958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41960         this_ptr_conv.is_owned = false;
41961         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
41962         return ret_conv;
41963 }
41964
41965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
41966         LDKAcceptChannelV2 this_ptr_conv;
41967         this_ptr_conv.inner = untag_ptr(this_ptr);
41968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41970         this_ptr_conv.is_owned = false;
41971         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
41972         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
41973 }
41974
41975 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) {
41976         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
41977         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
41978         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
41979         LDKPublicKey funding_pubkey_arg_ref;
41980         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
41981         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
41982         LDKPublicKey revocation_basepoint_arg_ref;
41983         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
41984         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
41985         LDKPublicKey payment_basepoint_arg_ref;
41986         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
41987         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
41988         LDKPublicKey delayed_payment_basepoint_arg_ref;
41989         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
41990         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
41991         LDKPublicKey htlc_basepoint_arg_ref;
41992         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
41993         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
41994         LDKPublicKey first_per_commitment_point_arg_ref;
41995         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
41996         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
41997         LDKPublicKey second_per_commitment_point_arg_ref;
41998         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
41999         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
42000         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
42001         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
42002         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
42003         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
42004         LDKChannelTypeFeatures channel_type_arg_conv;
42005         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
42006         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
42007         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
42008         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
42009         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
42010         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);
42011         int64_t ret_ref = 0;
42012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42014         return ret_ref;
42015 }
42016
42017 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
42018         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
42019         int64_t ret_ref = 0;
42020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42022         return ret_ref;
42023 }
42024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42025         LDKAcceptChannelV2 arg_conv;
42026         arg_conv.inner = untag_ptr(arg);
42027         arg_conv.is_owned = ptr_is_owned(arg);
42028         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42029         arg_conv.is_owned = false;
42030         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
42031         return ret_conv;
42032 }
42033
42034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42035         LDKAcceptChannelV2 orig_conv;
42036         orig_conv.inner = untag_ptr(orig);
42037         orig_conv.is_owned = ptr_is_owned(orig);
42038         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42039         orig_conv.is_owned = false;
42040         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
42041         int64_t ret_ref = 0;
42042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42044         return ret_ref;
42045 }
42046
42047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42048         LDKAcceptChannelV2 a_conv;
42049         a_conv.inner = untag_ptr(a);
42050         a_conv.is_owned = ptr_is_owned(a);
42051         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42052         a_conv.is_owned = false;
42053         LDKAcceptChannelV2 b_conv;
42054         b_conv.inner = untag_ptr(b);
42055         b_conv.is_owned = ptr_is_owned(b);
42056         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42057         b_conv.is_owned = false;
42058         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
42059         return ret_conv;
42060 }
42061
42062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42063         LDKFundingCreated this_obj_conv;
42064         this_obj_conv.inner = untag_ptr(this_obj);
42065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42067         FundingCreated_free(this_obj_conv);
42068 }
42069
42070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42071         LDKFundingCreated this_ptr_conv;
42072         this_ptr_conv.inner = untag_ptr(this_ptr);
42073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42075         this_ptr_conv.is_owned = false;
42076         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42077         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
42078         return ret_arr;
42079 }
42080
42081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42082         LDKFundingCreated this_ptr_conv;
42083         this_ptr_conv.inner = untag_ptr(this_ptr);
42084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42086         this_ptr_conv.is_owned = false;
42087         LDKThirtyTwoBytes val_ref;
42088         CHECK((*env)->GetArrayLength(env, val) == 32);
42089         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42090         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
42091 }
42092
42093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
42094         LDKFundingCreated this_ptr_conv;
42095         this_ptr_conv.inner = untag_ptr(this_ptr);
42096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42098         this_ptr_conv.is_owned = false;
42099         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42100         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
42101         return ret_arr;
42102 }
42103
42104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42105         LDKFundingCreated this_ptr_conv;
42106         this_ptr_conv.inner = untag_ptr(this_ptr);
42107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42109         this_ptr_conv.is_owned = false;
42110         LDKThirtyTwoBytes val_ref;
42111         CHECK((*env)->GetArrayLength(env, val) == 32);
42112         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42113         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
42114 }
42115
42116 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
42117         LDKFundingCreated this_ptr_conv;
42118         this_ptr_conv.inner = untag_ptr(this_ptr);
42119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42121         this_ptr_conv.is_owned = false;
42122         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
42123         return ret_conv;
42124 }
42125
42126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42127         LDKFundingCreated this_ptr_conv;
42128         this_ptr_conv.inner = untag_ptr(this_ptr);
42129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42131         this_ptr_conv.is_owned = false;
42132         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
42133 }
42134
42135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
42136         LDKFundingCreated this_ptr_conv;
42137         this_ptr_conv.inner = untag_ptr(this_ptr);
42138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42140         this_ptr_conv.is_owned = false;
42141         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
42142         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
42143         return ret_arr;
42144 }
42145
42146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42147         LDKFundingCreated this_ptr_conv;
42148         this_ptr_conv.inner = untag_ptr(this_ptr);
42149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42151         this_ptr_conv.is_owned = false;
42152         LDKSignature val_ref;
42153         CHECK((*env)->GetArrayLength(env, val) == 64);
42154         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
42155         FundingCreated_set_signature(&this_ptr_conv, val_ref);
42156 }
42157
42158 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) {
42159         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
42160         CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
42161         (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
42162         LDKThirtyTwoBytes funding_txid_arg_ref;
42163         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
42164         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
42165         LDKSignature signature_arg_ref;
42166         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
42167         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
42168         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
42169         int64_t ret_ref = 0;
42170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42172         return ret_ref;
42173 }
42174
42175 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
42176         LDKFundingCreated ret_var = FundingCreated_clone(arg);
42177         int64_t ret_ref = 0;
42178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42180         return ret_ref;
42181 }
42182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42183         LDKFundingCreated arg_conv;
42184         arg_conv.inner = untag_ptr(arg);
42185         arg_conv.is_owned = ptr_is_owned(arg);
42186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42187         arg_conv.is_owned = false;
42188         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
42189         return ret_conv;
42190 }
42191
42192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42193         LDKFundingCreated orig_conv;
42194         orig_conv.inner = untag_ptr(orig);
42195         orig_conv.is_owned = ptr_is_owned(orig);
42196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42197         orig_conv.is_owned = false;
42198         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
42199         int64_t ret_ref = 0;
42200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42202         return ret_ref;
42203 }
42204
42205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42206         LDKFundingCreated a_conv;
42207         a_conv.inner = untag_ptr(a);
42208         a_conv.is_owned = ptr_is_owned(a);
42209         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42210         a_conv.is_owned = false;
42211         LDKFundingCreated b_conv;
42212         b_conv.inner = untag_ptr(b);
42213         b_conv.is_owned = ptr_is_owned(b);
42214         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42215         b_conv.is_owned = false;
42216         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
42217         return ret_conv;
42218 }
42219
42220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42221         LDKFundingSigned this_obj_conv;
42222         this_obj_conv.inner = untag_ptr(this_obj);
42223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42225         FundingSigned_free(this_obj_conv);
42226 }
42227
42228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42229         LDKFundingSigned this_ptr_conv;
42230         this_ptr_conv.inner = untag_ptr(this_ptr);
42231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42233         this_ptr_conv.is_owned = false;
42234         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42235         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
42236         return ret_arr;
42237 }
42238
42239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42240         LDKFundingSigned this_ptr_conv;
42241         this_ptr_conv.inner = untag_ptr(this_ptr);
42242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42244         this_ptr_conv.is_owned = false;
42245         LDKThirtyTwoBytes val_ref;
42246         CHECK((*env)->GetArrayLength(env, val) == 32);
42247         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42248         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
42249 }
42250
42251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
42252         LDKFundingSigned this_ptr_conv;
42253         this_ptr_conv.inner = untag_ptr(this_ptr);
42254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42256         this_ptr_conv.is_owned = false;
42257         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
42258         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
42259         return ret_arr;
42260 }
42261
42262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42263         LDKFundingSigned this_ptr_conv;
42264         this_ptr_conv.inner = untag_ptr(this_ptr);
42265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42267         this_ptr_conv.is_owned = false;
42268         LDKSignature val_ref;
42269         CHECK((*env)->GetArrayLength(env, val) == 64);
42270         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
42271         FundingSigned_set_signature(&this_ptr_conv, val_ref);
42272 }
42273
42274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
42275         LDKThirtyTwoBytes channel_id_arg_ref;
42276         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42277         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42278         LDKSignature signature_arg_ref;
42279         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
42280         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
42281         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
42282         int64_t ret_ref = 0;
42283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42285         return ret_ref;
42286 }
42287
42288 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
42289         LDKFundingSigned ret_var = FundingSigned_clone(arg);
42290         int64_t ret_ref = 0;
42291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42293         return ret_ref;
42294 }
42295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42296         LDKFundingSigned arg_conv;
42297         arg_conv.inner = untag_ptr(arg);
42298         arg_conv.is_owned = ptr_is_owned(arg);
42299         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42300         arg_conv.is_owned = false;
42301         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
42302         return ret_conv;
42303 }
42304
42305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42306         LDKFundingSigned orig_conv;
42307         orig_conv.inner = untag_ptr(orig);
42308         orig_conv.is_owned = ptr_is_owned(orig);
42309         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42310         orig_conv.is_owned = false;
42311         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
42312         int64_t ret_ref = 0;
42313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42315         return ret_ref;
42316 }
42317
42318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42319         LDKFundingSigned a_conv;
42320         a_conv.inner = untag_ptr(a);
42321         a_conv.is_owned = ptr_is_owned(a);
42322         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42323         a_conv.is_owned = false;
42324         LDKFundingSigned b_conv;
42325         b_conv.inner = untag_ptr(b);
42326         b_conv.is_owned = ptr_is_owned(b);
42327         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42328         b_conv.is_owned = false;
42329         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
42330         return ret_conv;
42331 }
42332
42333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42334         LDKChannelReady this_obj_conv;
42335         this_obj_conv.inner = untag_ptr(this_obj);
42336         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42338         ChannelReady_free(this_obj_conv);
42339 }
42340
42341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42342         LDKChannelReady this_ptr_conv;
42343         this_ptr_conv.inner = untag_ptr(this_ptr);
42344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42346         this_ptr_conv.is_owned = false;
42347         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42348         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReady_get_channel_id(&this_ptr_conv));
42349         return ret_arr;
42350 }
42351
42352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42353         LDKChannelReady this_ptr_conv;
42354         this_ptr_conv.inner = untag_ptr(this_ptr);
42355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42357         this_ptr_conv.is_owned = false;
42358         LDKThirtyTwoBytes val_ref;
42359         CHECK((*env)->GetArrayLength(env, val) == 32);
42360         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42361         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
42362 }
42363
42364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
42365         LDKChannelReady this_ptr_conv;
42366         this_ptr_conv.inner = untag_ptr(this_ptr);
42367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42369         this_ptr_conv.is_owned = false;
42370         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42371         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
42372         return ret_arr;
42373 }
42374
42375 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) {
42376         LDKChannelReady this_ptr_conv;
42377         this_ptr_conv.inner = untag_ptr(this_ptr);
42378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42380         this_ptr_conv.is_owned = false;
42381         LDKPublicKey val_ref;
42382         CHECK((*env)->GetArrayLength(env, val) == 33);
42383         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42384         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
42385 }
42386
42387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
42388         LDKChannelReady this_ptr_conv;
42389         this_ptr_conv.inner = untag_ptr(this_ptr);
42390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42392         this_ptr_conv.is_owned = false;
42393         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42394         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
42395         int64_t ret_ref = tag_ptr(ret_copy, true);
42396         return ret_ref;
42397 }
42398
42399 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) {
42400         LDKChannelReady this_ptr_conv;
42401         this_ptr_conv.inner = untag_ptr(this_ptr);
42402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42404         this_ptr_conv.is_owned = false;
42405         void* val_ptr = untag_ptr(val);
42406         CHECK_ACCESS(val_ptr);
42407         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42408         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42409         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
42410 }
42411
42412 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) {
42413         LDKThirtyTwoBytes channel_id_arg_ref;
42414         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42415         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42416         LDKPublicKey next_per_commitment_point_arg_ref;
42417         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
42418         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
42419         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
42420         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
42421         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
42422         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
42423         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
42424         int64_t ret_ref = 0;
42425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42427         return ret_ref;
42428 }
42429
42430 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
42431         LDKChannelReady ret_var = ChannelReady_clone(arg);
42432         int64_t ret_ref = 0;
42433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42435         return ret_ref;
42436 }
42437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42438         LDKChannelReady arg_conv;
42439         arg_conv.inner = untag_ptr(arg);
42440         arg_conv.is_owned = ptr_is_owned(arg);
42441         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42442         arg_conv.is_owned = false;
42443         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
42444         return ret_conv;
42445 }
42446
42447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42448         LDKChannelReady orig_conv;
42449         orig_conv.inner = untag_ptr(orig);
42450         orig_conv.is_owned = ptr_is_owned(orig);
42451         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42452         orig_conv.is_owned = false;
42453         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
42454         int64_t ret_ref = 0;
42455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42457         return ret_ref;
42458 }
42459
42460 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42461         LDKChannelReady a_conv;
42462         a_conv.inner = untag_ptr(a);
42463         a_conv.is_owned = ptr_is_owned(a);
42464         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42465         a_conv.is_owned = false;
42466         LDKChannelReady b_conv;
42467         b_conv.inner = untag_ptr(b);
42468         b_conv.is_owned = ptr_is_owned(b);
42469         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42470         b_conv.is_owned = false;
42471         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
42472         return ret_conv;
42473 }
42474
42475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42476         LDKTxAddInput this_obj_conv;
42477         this_obj_conv.inner = untag_ptr(this_obj);
42478         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42480         TxAddInput_free(this_obj_conv);
42481 }
42482
42483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42484         LDKTxAddInput this_ptr_conv;
42485         this_ptr_conv.inner = untag_ptr(this_ptr);
42486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42488         this_ptr_conv.is_owned = false;
42489         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42490         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddInput_get_channel_id(&this_ptr_conv));
42491         return ret_arr;
42492 }
42493
42494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42495         LDKTxAddInput this_ptr_conv;
42496         this_ptr_conv.inner = untag_ptr(this_ptr);
42497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42499         this_ptr_conv.is_owned = false;
42500         LDKThirtyTwoBytes val_ref;
42501         CHECK((*env)->GetArrayLength(env, val) == 32);
42502         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42503         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
42504 }
42505
42506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42507         LDKTxAddInput this_ptr_conv;
42508         this_ptr_conv.inner = untag_ptr(this_ptr);
42509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42511         this_ptr_conv.is_owned = false;
42512         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
42513         return ret_conv;
42514 }
42515
42516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42517         LDKTxAddInput this_ptr_conv;
42518         this_ptr_conv.inner = untag_ptr(this_ptr);
42519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42521         this_ptr_conv.is_owned = false;
42522         TxAddInput_set_serial_id(&this_ptr_conv, val);
42523 }
42524
42525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
42526         LDKTxAddInput this_ptr_conv;
42527         this_ptr_conv.inner = untag_ptr(this_ptr);
42528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42530         this_ptr_conv.is_owned = false;
42531         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
42532         int64_t ret_ref = 0;
42533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42535         return ret_ref;
42536 }
42537
42538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42539         LDKTxAddInput this_ptr_conv;
42540         this_ptr_conv.inner = untag_ptr(this_ptr);
42541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42543         this_ptr_conv.is_owned = false;
42544         LDKTransactionU16LenLimited val_conv;
42545         val_conv.inner = untag_ptr(val);
42546         val_conv.is_owned = ptr_is_owned(val);
42547         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42548         val_conv = TransactionU16LenLimited_clone(&val_conv);
42549         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
42550 }
42551
42552 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
42553         LDKTxAddInput this_ptr_conv;
42554         this_ptr_conv.inner = untag_ptr(this_ptr);
42555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42557         this_ptr_conv.is_owned = false;
42558         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
42559         return ret_conv;
42560 }
42561
42562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42563         LDKTxAddInput this_ptr_conv;
42564         this_ptr_conv.inner = untag_ptr(this_ptr);
42565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42567         this_ptr_conv.is_owned = false;
42568         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
42569 }
42570
42571 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
42572         LDKTxAddInput this_ptr_conv;
42573         this_ptr_conv.inner = untag_ptr(this_ptr);
42574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42576         this_ptr_conv.is_owned = false;
42577         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
42578         return ret_conv;
42579 }
42580
42581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42582         LDKTxAddInput this_ptr_conv;
42583         this_ptr_conv.inner = untag_ptr(this_ptr);
42584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42586         this_ptr_conv.is_owned = false;
42587         TxAddInput_set_sequence(&this_ptr_conv, val);
42588 }
42589
42590 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) {
42591         LDKThirtyTwoBytes channel_id_arg_ref;
42592         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42593         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42594         LDKTransactionU16LenLimited prevtx_arg_conv;
42595         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
42596         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
42597         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
42598         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
42599         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
42600         int64_t ret_ref = 0;
42601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42603         return ret_ref;
42604 }
42605
42606 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
42607         LDKTxAddInput ret_var = TxAddInput_clone(arg);
42608         int64_t ret_ref = 0;
42609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42611         return ret_ref;
42612 }
42613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42614         LDKTxAddInput arg_conv;
42615         arg_conv.inner = untag_ptr(arg);
42616         arg_conv.is_owned = ptr_is_owned(arg);
42617         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42618         arg_conv.is_owned = false;
42619         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
42620         return ret_conv;
42621 }
42622
42623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42624         LDKTxAddInput orig_conv;
42625         orig_conv.inner = untag_ptr(orig);
42626         orig_conv.is_owned = ptr_is_owned(orig);
42627         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42628         orig_conv.is_owned = false;
42629         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
42630         int64_t ret_ref = 0;
42631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42633         return ret_ref;
42634 }
42635
42636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42637         LDKTxAddInput a_conv;
42638         a_conv.inner = untag_ptr(a);
42639         a_conv.is_owned = ptr_is_owned(a);
42640         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42641         a_conv.is_owned = false;
42642         LDKTxAddInput b_conv;
42643         b_conv.inner = untag_ptr(b);
42644         b_conv.is_owned = ptr_is_owned(b);
42645         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42646         b_conv.is_owned = false;
42647         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
42648         return ret_conv;
42649 }
42650
42651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42652         LDKTxAddOutput this_obj_conv;
42653         this_obj_conv.inner = untag_ptr(this_obj);
42654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42656         TxAddOutput_free(this_obj_conv);
42657 }
42658
42659 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42660         LDKTxAddOutput this_ptr_conv;
42661         this_ptr_conv.inner = untag_ptr(this_ptr);
42662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42664         this_ptr_conv.is_owned = false;
42665         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42666         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAddOutput_get_channel_id(&this_ptr_conv));
42667         return ret_arr;
42668 }
42669
42670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42671         LDKTxAddOutput this_ptr_conv;
42672         this_ptr_conv.inner = untag_ptr(this_ptr);
42673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42675         this_ptr_conv.is_owned = false;
42676         LDKThirtyTwoBytes val_ref;
42677         CHECK((*env)->GetArrayLength(env, val) == 32);
42678         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42679         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
42680 }
42681
42682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42683         LDKTxAddOutput this_ptr_conv;
42684         this_ptr_conv.inner = untag_ptr(this_ptr);
42685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42687         this_ptr_conv.is_owned = false;
42688         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
42689         return ret_conv;
42690 }
42691
42692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42693         LDKTxAddOutput this_ptr_conv;
42694         this_ptr_conv.inner = untag_ptr(this_ptr);
42695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42697         this_ptr_conv.is_owned = false;
42698         TxAddOutput_set_serial_id(&this_ptr_conv, val);
42699 }
42700
42701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
42702         LDKTxAddOutput this_ptr_conv;
42703         this_ptr_conv.inner = untag_ptr(this_ptr);
42704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42706         this_ptr_conv.is_owned = false;
42707         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
42708         return ret_conv;
42709 }
42710
42711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42712         LDKTxAddOutput this_ptr_conv;
42713         this_ptr_conv.inner = untag_ptr(this_ptr);
42714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42716         this_ptr_conv.is_owned = false;
42717         TxAddOutput_set_sats(&this_ptr_conv, val);
42718 }
42719
42720 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
42721         LDKTxAddOutput this_ptr_conv;
42722         this_ptr_conv.inner = untag_ptr(this_ptr);
42723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42725         this_ptr_conv.is_owned = false;
42726         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
42727         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42728         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42729         return ret_arr;
42730 }
42731
42732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42733         LDKTxAddOutput this_ptr_conv;
42734         this_ptr_conv.inner = untag_ptr(this_ptr);
42735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42737         this_ptr_conv.is_owned = false;
42738         LDKCVec_u8Z val_ref;
42739         val_ref.datalen = (*env)->GetArrayLength(env, val);
42740         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
42741         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
42742         TxAddOutput_set_script(&this_ptr_conv, val_ref);
42743 }
42744
42745 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) {
42746         LDKThirtyTwoBytes channel_id_arg_ref;
42747         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42748         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42749         LDKCVec_u8Z script_arg_ref;
42750         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
42751         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
42752         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
42753         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
42754         int64_t ret_ref = 0;
42755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42757         return ret_ref;
42758 }
42759
42760 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
42761         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
42762         int64_t ret_ref = 0;
42763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42765         return ret_ref;
42766 }
42767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42768         LDKTxAddOutput arg_conv;
42769         arg_conv.inner = untag_ptr(arg);
42770         arg_conv.is_owned = ptr_is_owned(arg);
42771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42772         arg_conv.is_owned = false;
42773         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
42774         return ret_conv;
42775 }
42776
42777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42778         LDKTxAddOutput orig_conv;
42779         orig_conv.inner = untag_ptr(orig);
42780         orig_conv.is_owned = ptr_is_owned(orig);
42781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42782         orig_conv.is_owned = false;
42783         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
42784         int64_t ret_ref = 0;
42785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42787         return ret_ref;
42788 }
42789
42790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42791         LDKTxAddOutput a_conv;
42792         a_conv.inner = untag_ptr(a);
42793         a_conv.is_owned = ptr_is_owned(a);
42794         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42795         a_conv.is_owned = false;
42796         LDKTxAddOutput b_conv;
42797         b_conv.inner = untag_ptr(b);
42798         b_conv.is_owned = ptr_is_owned(b);
42799         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42800         b_conv.is_owned = false;
42801         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
42802         return ret_conv;
42803 }
42804
42805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42806         LDKTxRemoveInput this_obj_conv;
42807         this_obj_conv.inner = untag_ptr(this_obj);
42808         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42810         TxRemoveInput_free(this_obj_conv);
42811 }
42812
42813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42814         LDKTxRemoveInput this_ptr_conv;
42815         this_ptr_conv.inner = untag_ptr(this_ptr);
42816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42818         this_ptr_conv.is_owned = false;
42819         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42820         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveInput_get_channel_id(&this_ptr_conv));
42821         return ret_arr;
42822 }
42823
42824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42825         LDKTxRemoveInput this_ptr_conv;
42826         this_ptr_conv.inner = untag_ptr(this_ptr);
42827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42829         this_ptr_conv.is_owned = false;
42830         LDKThirtyTwoBytes val_ref;
42831         CHECK((*env)->GetArrayLength(env, val) == 32);
42832         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42833         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
42834 }
42835
42836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42837         LDKTxRemoveInput this_ptr_conv;
42838         this_ptr_conv.inner = untag_ptr(this_ptr);
42839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42841         this_ptr_conv.is_owned = false;
42842         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
42843         return ret_conv;
42844 }
42845
42846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42847         LDKTxRemoveInput this_ptr_conv;
42848         this_ptr_conv.inner = untag_ptr(this_ptr);
42849         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42851         this_ptr_conv.is_owned = false;
42852         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
42853 }
42854
42855 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) {
42856         LDKThirtyTwoBytes channel_id_arg_ref;
42857         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42858         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42859         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
42860         int64_t ret_ref = 0;
42861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42863         return ret_ref;
42864 }
42865
42866 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
42867         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
42868         int64_t ret_ref = 0;
42869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42871         return ret_ref;
42872 }
42873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42874         LDKTxRemoveInput arg_conv;
42875         arg_conv.inner = untag_ptr(arg);
42876         arg_conv.is_owned = ptr_is_owned(arg);
42877         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42878         arg_conv.is_owned = false;
42879         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
42880         return ret_conv;
42881 }
42882
42883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42884         LDKTxRemoveInput orig_conv;
42885         orig_conv.inner = untag_ptr(orig);
42886         orig_conv.is_owned = ptr_is_owned(orig);
42887         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42888         orig_conv.is_owned = false;
42889         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
42890         int64_t ret_ref = 0;
42891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42893         return ret_ref;
42894 }
42895
42896 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42897         LDKTxRemoveInput a_conv;
42898         a_conv.inner = untag_ptr(a);
42899         a_conv.is_owned = ptr_is_owned(a);
42900         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42901         a_conv.is_owned = false;
42902         LDKTxRemoveInput b_conv;
42903         b_conv.inner = untag_ptr(b);
42904         b_conv.is_owned = ptr_is_owned(b);
42905         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42906         b_conv.is_owned = false;
42907         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
42908         return ret_conv;
42909 }
42910
42911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42912         LDKTxRemoveOutput this_obj_conv;
42913         this_obj_conv.inner = untag_ptr(this_obj);
42914         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42916         TxRemoveOutput_free(this_obj_conv);
42917 }
42918
42919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42920         LDKTxRemoveOutput this_ptr_conv;
42921         this_ptr_conv.inner = untag_ptr(this_ptr);
42922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42924         this_ptr_conv.is_owned = false;
42925         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
42926         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxRemoveOutput_get_channel_id(&this_ptr_conv));
42927         return ret_arr;
42928 }
42929
42930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42931         LDKTxRemoveOutput this_ptr_conv;
42932         this_ptr_conv.inner = untag_ptr(this_ptr);
42933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42935         this_ptr_conv.is_owned = false;
42936         LDKThirtyTwoBytes val_ref;
42937         CHECK((*env)->GetArrayLength(env, val) == 32);
42938         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
42939         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
42940 }
42941
42942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42943         LDKTxRemoveOutput this_ptr_conv;
42944         this_ptr_conv.inner = untag_ptr(this_ptr);
42945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42947         this_ptr_conv.is_owned = false;
42948         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
42949         return ret_conv;
42950 }
42951
42952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42953         LDKTxRemoveOutput this_ptr_conv;
42954         this_ptr_conv.inner = untag_ptr(this_ptr);
42955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42957         this_ptr_conv.is_owned = false;
42958         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
42959 }
42960
42961 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) {
42962         LDKThirtyTwoBytes channel_id_arg_ref;
42963         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
42964         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
42965         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
42966         int64_t ret_ref = 0;
42967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42969         return ret_ref;
42970 }
42971
42972 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
42973         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
42974         int64_t ret_ref = 0;
42975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42977         return ret_ref;
42978 }
42979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42980         LDKTxRemoveOutput arg_conv;
42981         arg_conv.inner = untag_ptr(arg);
42982         arg_conv.is_owned = ptr_is_owned(arg);
42983         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42984         arg_conv.is_owned = false;
42985         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
42986         return ret_conv;
42987 }
42988
42989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42990         LDKTxRemoveOutput orig_conv;
42991         orig_conv.inner = untag_ptr(orig);
42992         orig_conv.is_owned = ptr_is_owned(orig);
42993         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42994         orig_conv.is_owned = false;
42995         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
42996         int64_t ret_ref = 0;
42997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42999         return ret_ref;
43000 }
43001
43002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43003         LDKTxRemoveOutput a_conv;
43004         a_conv.inner = untag_ptr(a);
43005         a_conv.is_owned = ptr_is_owned(a);
43006         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43007         a_conv.is_owned = false;
43008         LDKTxRemoveOutput b_conv;
43009         b_conv.inner = untag_ptr(b);
43010         b_conv.is_owned = ptr_is_owned(b);
43011         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43012         b_conv.is_owned = false;
43013         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
43014         return ret_conv;
43015 }
43016
43017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43018         LDKTxComplete this_obj_conv;
43019         this_obj_conv.inner = untag_ptr(this_obj);
43020         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43022         TxComplete_free(this_obj_conv);
43023 }
43024
43025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43026         LDKTxComplete this_ptr_conv;
43027         this_ptr_conv.inner = untag_ptr(this_ptr);
43028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43030         this_ptr_conv.is_owned = false;
43031         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43032         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxComplete_get_channel_id(&this_ptr_conv));
43033         return ret_arr;
43034 }
43035
43036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43037         LDKTxComplete this_ptr_conv;
43038         this_ptr_conv.inner = untag_ptr(this_ptr);
43039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43041         this_ptr_conv.is_owned = false;
43042         LDKThirtyTwoBytes val_ref;
43043         CHECK((*env)->GetArrayLength(env, val) == 32);
43044         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43045         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
43046 }
43047
43048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg) {
43049         LDKThirtyTwoBytes channel_id_arg_ref;
43050         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43051         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43052         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
43053         int64_t ret_ref = 0;
43054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43056         return ret_ref;
43057 }
43058
43059 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
43060         LDKTxComplete ret_var = TxComplete_clone(arg);
43061         int64_t ret_ref = 0;
43062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43064         return ret_ref;
43065 }
43066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43067         LDKTxComplete arg_conv;
43068         arg_conv.inner = untag_ptr(arg);
43069         arg_conv.is_owned = ptr_is_owned(arg);
43070         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43071         arg_conv.is_owned = false;
43072         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
43073         return ret_conv;
43074 }
43075
43076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43077         LDKTxComplete orig_conv;
43078         orig_conv.inner = untag_ptr(orig);
43079         orig_conv.is_owned = ptr_is_owned(orig);
43080         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43081         orig_conv.is_owned = false;
43082         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
43083         int64_t ret_ref = 0;
43084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43086         return ret_ref;
43087 }
43088
43089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43090         LDKTxComplete a_conv;
43091         a_conv.inner = untag_ptr(a);
43092         a_conv.is_owned = ptr_is_owned(a);
43093         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43094         a_conv.is_owned = false;
43095         LDKTxComplete b_conv;
43096         b_conv.inner = untag_ptr(b);
43097         b_conv.is_owned = ptr_is_owned(b);
43098         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43099         b_conv.is_owned = false;
43100         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
43101         return ret_conv;
43102 }
43103
43104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43105         LDKTxSignatures this_obj_conv;
43106         this_obj_conv.inner = untag_ptr(this_obj);
43107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43109         TxSignatures_free(this_obj_conv);
43110 }
43111
43112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43113         LDKTxSignatures this_ptr_conv;
43114         this_ptr_conv.inner = untag_ptr(this_ptr);
43115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43117         this_ptr_conv.is_owned = false;
43118         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43119         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_channel_id(&this_ptr_conv));
43120         return ret_arr;
43121 }
43122
43123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43124         LDKTxSignatures this_ptr_conv;
43125         this_ptr_conv.inner = untag_ptr(this_ptr);
43126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43128         this_ptr_conv.is_owned = false;
43129         LDKThirtyTwoBytes val_ref;
43130         CHECK((*env)->GetArrayLength(env, val) == 32);
43131         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43132         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
43133 }
43134
43135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
43136         LDKTxSignatures this_ptr_conv;
43137         this_ptr_conv.inner = untag_ptr(this_ptr);
43138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43140         this_ptr_conv.is_owned = false;
43141         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43142         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
43143         return ret_arr;
43144 }
43145
43146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43147         LDKTxSignatures this_ptr_conv;
43148         this_ptr_conv.inner = untag_ptr(this_ptr);
43149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43151         this_ptr_conv.is_owned = false;
43152         LDKThirtyTwoBytes val_ref;
43153         CHECK((*env)->GetArrayLength(env, val) == 32);
43154         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43155         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
43156 }
43157
43158 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
43159         LDKTxSignatures this_ptr_conv;
43160         this_ptr_conv.inner = untag_ptr(this_ptr);
43161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43163         this_ptr_conv.is_owned = false;
43164         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
43165         jobjectArray ret_arr = NULL;
43166         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
43167         ;
43168         for (size_t i = 0; i < ret_var.datalen; i++) {
43169                 LDKWitness ret_conv_8_var = ret_var.data[i];
43170                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
43171                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
43172                 Witness_free(ret_conv_8_var);
43173                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
43174         }
43175         
43176         FREE(ret_var.data);
43177         return ret_arr;
43178 }
43179
43180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
43181         LDKTxSignatures this_ptr_conv;
43182         this_ptr_conv.inner = untag_ptr(this_ptr);
43183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43185         this_ptr_conv.is_owned = false;
43186         LDKCVec_WitnessZ val_constr;
43187         val_constr.datalen = (*env)->GetArrayLength(env, val);
43188         if (val_constr.datalen > 0)
43189                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
43190         else
43191                 val_constr.data = NULL;
43192         for (size_t i = 0; i < val_constr.datalen; i++) {
43193                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
43194                 LDKWitness val_conv_8_ref;
43195                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
43196                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
43197                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
43198                 val_conv_8_ref.data_is_owned = true;
43199                 val_constr.data[i] = val_conv_8_ref;
43200         }
43201         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
43202 }
43203
43204 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) {
43205         LDKThirtyTwoBytes channel_id_arg_ref;
43206         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43207         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43208         LDKThirtyTwoBytes tx_hash_arg_ref;
43209         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
43210         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
43211         LDKCVec_WitnessZ witnesses_arg_constr;
43212         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
43213         if (witnesses_arg_constr.datalen > 0)
43214                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
43215         else
43216                 witnesses_arg_constr.data = NULL;
43217         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
43218                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
43219                 LDKWitness witnesses_arg_conv_8_ref;
43220                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
43221                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
43222                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
43223                 witnesses_arg_conv_8_ref.data_is_owned = true;
43224                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
43225         }
43226         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
43227         int64_t ret_ref = 0;
43228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43230         return ret_ref;
43231 }
43232
43233 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
43234         LDKTxSignatures ret_var = TxSignatures_clone(arg);
43235         int64_t ret_ref = 0;
43236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43238         return ret_ref;
43239 }
43240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43241         LDKTxSignatures arg_conv;
43242         arg_conv.inner = untag_ptr(arg);
43243         arg_conv.is_owned = ptr_is_owned(arg);
43244         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43245         arg_conv.is_owned = false;
43246         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
43247         return ret_conv;
43248 }
43249
43250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43251         LDKTxSignatures orig_conv;
43252         orig_conv.inner = untag_ptr(orig);
43253         orig_conv.is_owned = ptr_is_owned(orig);
43254         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43255         orig_conv.is_owned = false;
43256         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
43257         int64_t ret_ref = 0;
43258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43260         return ret_ref;
43261 }
43262
43263 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43264         LDKTxSignatures a_conv;
43265         a_conv.inner = untag_ptr(a);
43266         a_conv.is_owned = ptr_is_owned(a);
43267         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43268         a_conv.is_owned = false;
43269         LDKTxSignatures b_conv;
43270         b_conv.inner = untag_ptr(b);
43271         b_conv.is_owned = ptr_is_owned(b);
43272         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43273         b_conv.is_owned = false;
43274         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
43275         return ret_conv;
43276 }
43277
43278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43279         LDKTxInitRbf this_obj_conv;
43280         this_obj_conv.inner = untag_ptr(this_obj);
43281         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43283         TxInitRbf_free(this_obj_conv);
43284 }
43285
43286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43287         LDKTxInitRbf this_ptr_conv;
43288         this_ptr_conv.inner = untag_ptr(this_ptr);
43289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43291         this_ptr_conv.is_owned = false;
43292         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43293         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxInitRbf_get_channel_id(&this_ptr_conv));
43294         return ret_arr;
43295 }
43296
43297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43298         LDKTxInitRbf this_ptr_conv;
43299         this_ptr_conv.inner = untag_ptr(this_ptr);
43300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43302         this_ptr_conv.is_owned = false;
43303         LDKThirtyTwoBytes val_ref;
43304         CHECK((*env)->GetArrayLength(env, val) == 32);
43305         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43306         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
43307 }
43308
43309 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
43310         LDKTxInitRbf this_ptr_conv;
43311         this_ptr_conv.inner = untag_ptr(this_ptr);
43312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43314         this_ptr_conv.is_owned = false;
43315         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
43316         return ret_conv;
43317 }
43318
43319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43320         LDKTxInitRbf this_ptr_conv;
43321         this_ptr_conv.inner = untag_ptr(this_ptr);
43322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43324         this_ptr_conv.is_owned = false;
43325         TxInitRbf_set_locktime(&this_ptr_conv, val);
43326 }
43327
43328 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
43329         LDKTxInitRbf this_ptr_conv;
43330         this_ptr_conv.inner = untag_ptr(this_ptr);
43331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43333         this_ptr_conv.is_owned = false;
43334         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
43335         return ret_conv;
43336 }
43337
43338 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) {
43339         LDKTxInitRbf this_ptr_conv;
43340         this_ptr_conv.inner = untag_ptr(this_ptr);
43341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43343         this_ptr_conv.is_owned = false;
43344         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
43345 }
43346
43347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
43348         LDKTxInitRbf this_ptr_conv;
43349         this_ptr_conv.inner = untag_ptr(this_ptr);
43350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43352         this_ptr_conv.is_owned = false;
43353         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
43354         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
43355         int64_t ret_ref = tag_ptr(ret_copy, true);
43356         return ret_ref;
43357 }
43358
43359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43360         LDKTxInitRbf this_ptr_conv;
43361         this_ptr_conv.inner = untag_ptr(this_ptr);
43362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43364         this_ptr_conv.is_owned = false;
43365         void* val_ptr = untag_ptr(val);
43366         CHECK_ACCESS(val_ptr);
43367         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
43368         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
43369         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
43370 }
43371
43372 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) {
43373         LDKThirtyTwoBytes channel_id_arg_ref;
43374         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43375         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43376         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
43377         CHECK_ACCESS(funding_output_contribution_arg_ptr);
43378         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
43379         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
43380         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
43381         int64_t ret_ref = 0;
43382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43384         return ret_ref;
43385 }
43386
43387 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
43388         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
43389         int64_t ret_ref = 0;
43390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43392         return ret_ref;
43393 }
43394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43395         LDKTxInitRbf arg_conv;
43396         arg_conv.inner = untag_ptr(arg);
43397         arg_conv.is_owned = ptr_is_owned(arg);
43398         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43399         arg_conv.is_owned = false;
43400         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
43401         return ret_conv;
43402 }
43403
43404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43405         LDKTxInitRbf orig_conv;
43406         orig_conv.inner = untag_ptr(orig);
43407         orig_conv.is_owned = ptr_is_owned(orig);
43408         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43409         orig_conv.is_owned = false;
43410         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
43411         int64_t ret_ref = 0;
43412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43414         return ret_ref;
43415 }
43416
43417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43418         LDKTxInitRbf a_conv;
43419         a_conv.inner = untag_ptr(a);
43420         a_conv.is_owned = ptr_is_owned(a);
43421         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43422         a_conv.is_owned = false;
43423         LDKTxInitRbf b_conv;
43424         b_conv.inner = untag_ptr(b);
43425         b_conv.is_owned = ptr_is_owned(b);
43426         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43427         b_conv.is_owned = false;
43428         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
43429         return ret_conv;
43430 }
43431
43432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43433         LDKTxAckRbf this_obj_conv;
43434         this_obj_conv.inner = untag_ptr(this_obj);
43435         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43437         TxAckRbf_free(this_obj_conv);
43438 }
43439
43440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43441         LDKTxAckRbf this_ptr_conv;
43442         this_ptr_conv.inner = untag_ptr(this_ptr);
43443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43445         this_ptr_conv.is_owned = false;
43446         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43447         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAckRbf_get_channel_id(&this_ptr_conv));
43448         return ret_arr;
43449 }
43450
43451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43452         LDKTxAckRbf this_ptr_conv;
43453         this_ptr_conv.inner = untag_ptr(this_ptr);
43454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43456         this_ptr_conv.is_owned = false;
43457         LDKThirtyTwoBytes val_ref;
43458         CHECK((*env)->GetArrayLength(env, val) == 32);
43459         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43460         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
43461 }
43462
43463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
43464         LDKTxAckRbf this_ptr_conv;
43465         this_ptr_conv.inner = untag_ptr(this_ptr);
43466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43468         this_ptr_conv.is_owned = false;
43469         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
43470         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
43471         int64_t ret_ref = tag_ptr(ret_copy, true);
43472         return ret_ref;
43473 }
43474
43475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43476         LDKTxAckRbf this_ptr_conv;
43477         this_ptr_conv.inner = untag_ptr(this_ptr);
43478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43480         this_ptr_conv.is_owned = false;
43481         void* val_ptr = untag_ptr(val);
43482         CHECK_ACCESS(val_ptr);
43483         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
43484         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
43485         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
43486 }
43487
43488 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) {
43489         LDKThirtyTwoBytes channel_id_arg_ref;
43490         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43491         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43492         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
43493         CHECK_ACCESS(funding_output_contribution_arg_ptr);
43494         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
43495         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
43496         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
43497         int64_t ret_ref = 0;
43498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43500         return ret_ref;
43501 }
43502
43503 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
43504         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
43505         int64_t ret_ref = 0;
43506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43508         return ret_ref;
43509 }
43510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43511         LDKTxAckRbf arg_conv;
43512         arg_conv.inner = untag_ptr(arg);
43513         arg_conv.is_owned = ptr_is_owned(arg);
43514         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43515         arg_conv.is_owned = false;
43516         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
43517         return ret_conv;
43518 }
43519
43520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43521         LDKTxAckRbf orig_conv;
43522         orig_conv.inner = untag_ptr(orig);
43523         orig_conv.is_owned = ptr_is_owned(orig);
43524         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43525         orig_conv.is_owned = false;
43526         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
43527         int64_t ret_ref = 0;
43528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43530         return ret_ref;
43531 }
43532
43533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43534         LDKTxAckRbf a_conv;
43535         a_conv.inner = untag_ptr(a);
43536         a_conv.is_owned = ptr_is_owned(a);
43537         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43538         a_conv.is_owned = false;
43539         LDKTxAckRbf b_conv;
43540         b_conv.inner = untag_ptr(b);
43541         b_conv.is_owned = ptr_is_owned(b);
43542         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43543         b_conv.is_owned = false;
43544         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
43545         return ret_conv;
43546 }
43547
43548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43549         LDKTxAbort this_obj_conv;
43550         this_obj_conv.inner = untag_ptr(this_obj);
43551         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43553         TxAbort_free(this_obj_conv);
43554 }
43555
43556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43557         LDKTxAbort this_ptr_conv;
43558         this_ptr_conv.inner = untag_ptr(this_ptr);
43559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43561         this_ptr_conv.is_owned = false;
43562         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43563         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxAbort_get_channel_id(&this_ptr_conv));
43564         return ret_arr;
43565 }
43566
43567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43568         LDKTxAbort this_ptr_conv;
43569         this_ptr_conv.inner = untag_ptr(this_ptr);
43570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43572         this_ptr_conv.is_owned = false;
43573         LDKThirtyTwoBytes val_ref;
43574         CHECK((*env)->GetArrayLength(env, val) == 32);
43575         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43576         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
43577 }
43578
43579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
43580         LDKTxAbort this_ptr_conv;
43581         this_ptr_conv.inner = untag_ptr(this_ptr);
43582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43584         this_ptr_conv.is_owned = false;
43585         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
43586         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43587         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43588         CVec_u8Z_free(ret_var);
43589         return ret_arr;
43590 }
43591
43592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43593         LDKTxAbort this_ptr_conv;
43594         this_ptr_conv.inner = untag_ptr(this_ptr);
43595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43597         this_ptr_conv.is_owned = false;
43598         LDKCVec_u8Z val_ref;
43599         val_ref.datalen = (*env)->GetArrayLength(env, val);
43600         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43601         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
43602         TxAbort_set_data(&this_ptr_conv, val_ref);
43603 }
43604
43605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
43606         LDKThirtyTwoBytes channel_id_arg_ref;
43607         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43608         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43609         LDKCVec_u8Z data_arg_ref;
43610         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
43611         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43612         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
43613         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
43614         int64_t ret_ref = 0;
43615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43617         return ret_ref;
43618 }
43619
43620 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
43621         LDKTxAbort ret_var = TxAbort_clone(arg);
43622         int64_t ret_ref = 0;
43623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43625         return ret_ref;
43626 }
43627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43628         LDKTxAbort arg_conv;
43629         arg_conv.inner = untag_ptr(arg);
43630         arg_conv.is_owned = ptr_is_owned(arg);
43631         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43632         arg_conv.is_owned = false;
43633         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
43634         return ret_conv;
43635 }
43636
43637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43638         LDKTxAbort orig_conv;
43639         orig_conv.inner = untag_ptr(orig);
43640         orig_conv.is_owned = ptr_is_owned(orig);
43641         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43642         orig_conv.is_owned = false;
43643         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
43644         int64_t ret_ref = 0;
43645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43647         return ret_ref;
43648 }
43649
43650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43651         LDKTxAbort a_conv;
43652         a_conv.inner = untag_ptr(a);
43653         a_conv.is_owned = ptr_is_owned(a);
43654         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43655         a_conv.is_owned = false;
43656         LDKTxAbort b_conv;
43657         b_conv.inner = untag_ptr(b);
43658         b_conv.is_owned = ptr_is_owned(b);
43659         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43660         b_conv.is_owned = false;
43661         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
43662         return ret_conv;
43663 }
43664
43665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43666         LDKShutdown this_obj_conv;
43667         this_obj_conv.inner = untag_ptr(this_obj);
43668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43670         Shutdown_free(this_obj_conv);
43671 }
43672
43673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43674         LDKShutdown this_ptr_conv;
43675         this_ptr_conv.inner = untag_ptr(this_ptr);
43676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43678         this_ptr_conv.is_owned = false;
43679         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43680         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
43681         return ret_arr;
43682 }
43683
43684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43685         LDKShutdown this_ptr_conv;
43686         this_ptr_conv.inner = untag_ptr(this_ptr);
43687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43689         this_ptr_conv.is_owned = false;
43690         LDKThirtyTwoBytes val_ref;
43691         CHECK((*env)->GetArrayLength(env, val) == 32);
43692         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43693         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
43694 }
43695
43696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43697         LDKShutdown this_ptr_conv;
43698         this_ptr_conv.inner = untag_ptr(this_ptr);
43699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43701         this_ptr_conv.is_owned = false;
43702         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
43703         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43704         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43705         return ret_arr;
43706 }
43707
43708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43709         LDKShutdown this_ptr_conv;
43710         this_ptr_conv.inner = untag_ptr(this_ptr);
43711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43713         this_ptr_conv.is_owned = false;
43714         LDKCVec_u8Z val_ref;
43715         val_ref.datalen = (*env)->GetArrayLength(env, val);
43716         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
43717         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
43718         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
43719 }
43720
43721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
43722         LDKThirtyTwoBytes channel_id_arg_ref;
43723         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43724         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43725         LDKCVec_u8Z scriptpubkey_arg_ref;
43726         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
43727         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
43728         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
43729         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
43730         int64_t ret_ref = 0;
43731         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43732         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43733         return ret_ref;
43734 }
43735
43736 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
43737         LDKShutdown ret_var = Shutdown_clone(arg);
43738         int64_t ret_ref = 0;
43739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43741         return ret_ref;
43742 }
43743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43744         LDKShutdown arg_conv;
43745         arg_conv.inner = untag_ptr(arg);
43746         arg_conv.is_owned = ptr_is_owned(arg);
43747         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43748         arg_conv.is_owned = false;
43749         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
43750         return ret_conv;
43751 }
43752
43753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43754         LDKShutdown orig_conv;
43755         orig_conv.inner = untag_ptr(orig);
43756         orig_conv.is_owned = ptr_is_owned(orig);
43757         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43758         orig_conv.is_owned = false;
43759         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
43760         int64_t ret_ref = 0;
43761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43763         return ret_ref;
43764 }
43765
43766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43767         LDKShutdown a_conv;
43768         a_conv.inner = untag_ptr(a);
43769         a_conv.is_owned = ptr_is_owned(a);
43770         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43771         a_conv.is_owned = false;
43772         LDKShutdown b_conv;
43773         b_conv.inner = untag_ptr(b);
43774         b_conv.is_owned = ptr_is_owned(b);
43775         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43776         b_conv.is_owned = false;
43777         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
43778         return ret_conv;
43779 }
43780
43781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43782         LDKClosingSignedFeeRange this_obj_conv;
43783         this_obj_conv.inner = untag_ptr(this_obj);
43784         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43786         ClosingSignedFeeRange_free(this_obj_conv);
43787 }
43788
43789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43790         LDKClosingSignedFeeRange this_ptr_conv;
43791         this_ptr_conv.inner = untag_ptr(this_ptr);
43792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43794         this_ptr_conv.is_owned = false;
43795         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
43796         return ret_conv;
43797 }
43798
43799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43800         LDKClosingSignedFeeRange this_ptr_conv;
43801         this_ptr_conv.inner = untag_ptr(this_ptr);
43802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43804         this_ptr_conv.is_owned = false;
43805         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
43806 }
43807
43808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43809         LDKClosingSignedFeeRange this_ptr_conv;
43810         this_ptr_conv.inner = untag_ptr(this_ptr);
43811         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43813         this_ptr_conv.is_owned = false;
43814         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
43815         return ret_conv;
43816 }
43817
43818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43819         LDKClosingSignedFeeRange this_ptr_conv;
43820         this_ptr_conv.inner = untag_ptr(this_ptr);
43821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43823         this_ptr_conv.is_owned = false;
43824         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
43825 }
43826
43827 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) {
43828         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
43829         int64_t ret_ref = 0;
43830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43832         return ret_ref;
43833 }
43834
43835 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
43836         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
43837         int64_t ret_ref = 0;
43838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43840         return ret_ref;
43841 }
43842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43843         LDKClosingSignedFeeRange arg_conv;
43844         arg_conv.inner = untag_ptr(arg);
43845         arg_conv.is_owned = ptr_is_owned(arg);
43846         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43847         arg_conv.is_owned = false;
43848         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
43849         return ret_conv;
43850 }
43851
43852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43853         LDKClosingSignedFeeRange orig_conv;
43854         orig_conv.inner = untag_ptr(orig);
43855         orig_conv.is_owned = ptr_is_owned(orig);
43856         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43857         orig_conv.is_owned = false;
43858         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
43859         int64_t ret_ref = 0;
43860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43862         return ret_ref;
43863 }
43864
43865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43866         LDKClosingSignedFeeRange a_conv;
43867         a_conv.inner = untag_ptr(a);
43868         a_conv.is_owned = ptr_is_owned(a);
43869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43870         a_conv.is_owned = false;
43871         LDKClosingSignedFeeRange b_conv;
43872         b_conv.inner = untag_ptr(b);
43873         b_conv.is_owned = ptr_is_owned(b);
43874         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43875         b_conv.is_owned = false;
43876         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
43877         return ret_conv;
43878 }
43879
43880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43881         LDKClosingSigned this_obj_conv;
43882         this_obj_conv.inner = untag_ptr(this_obj);
43883         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43885         ClosingSigned_free(this_obj_conv);
43886 }
43887
43888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
43889         LDKClosingSigned this_ptr_conv;
43890         this_ptr_conv.inner = untag_ptr(this_ptr);
43891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43893         this_ptr_conv.is_owned = false;
43894         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43895         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
43896         return ret_arr;
43897 }
43898
43899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43900         LDKClosingSigned this_ptr_conv;
43901         this_ptr_conv.inner = untag_ptr(this_ptr);
43902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43904         this_ptr_conv.is_owned = false;
43905         LDKThirtyTwoBytes val_ref;
43906         CHECK((*env)->GetArrayLength(env, val) == 32);
43907         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43908         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
43909 }
43910
43911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
43912         LDKClosingSigned this_ptr_conv;
43913         this_ptr_conv.inner = untag_ptr(this_ptr);
43914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43916         this_ptr_conv.is_owned = false;
43917         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
43918         return ret_conv;
43919 }
43920
43921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43922         LDKClosingSigned this_ptr_conv;
43923         this_ptr_conv.inner = untag_ptr(this_ptr);
43924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43926         this_ptr_conv.is_owned = false;
43927         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
43928 }
43929
43930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
43931         LDKClosingSigned this_ptr_conv;
43932         this_ptr_conv.inner = untag_ptr(this_ptr);
43933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43935         this_ptr_conv.is_owned = false;
43936         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
43937         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
43938         return ret_arr;
43939 }
43940
43941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43942         LDKClosingSigned this_ptr_conv;
43943         this_ptr_conv.inner = untag_ptr(this_ptr);
43944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43946         this_ptr_conv.is_owned = false;
43947         LDKSignature val_ref;
43948         CHECK((*env)->GetArrayLength(env, val) == 64);
43949         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
43950         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
43951 }
43952
43953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
43954         LDKClosingSigned this_ptr_conv;
43955         this_ptr_conv.inner = untag_ptr(this_ptr);
43956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43958         this_ptr_conv.is_owned = false;
43959         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
43960         int64_t ret_ref = 0;
43961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43963         return ret_ref;
43964 }
43965
43966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43967         LDKClosingSigned this_ptr_conv;
43968         this_ptr_conv.inner = untag_ptr(this_ptr);
43969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43971         this_ptr_conv.is_owned = false;
43972         LDKClosingSignedFeeRange val_conv;
43973         val_conv.inner = untag_ptr(val);
43974         val_conv.is_owned = ptr_is_owned(val);
43975         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43976         val_conv = ClosingSignedFeeRange_clone(&val_conv);
43977         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
43978 }
43979
43980 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) {
43981         LDKThirtyTwoBytes channel_id_arg_ref;
43982         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
43983         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
43984         LDKSignature signature_arg_ref;
43985         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
43986         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
43987         LDKClosingSignedFeeRange fee_range_arg_conv;
43988         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
43989         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
43990         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
43991         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
43992         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
43993         int64_t ret_ref = 0;
43994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43996         return ret_ref;
43997 }
43998
43999 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
44000         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
44001         int64_t ret_ref = 0;
44002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44004         return ret_ref;
44005 }
44006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44007         LDKClosingSigned arg_conv;
44008         arg_conv.inner = untag_ptr(arg);
44009         arg_conv.is_owned = ptr_is_owned(arg);
44010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44011         arg_conv.is_owned = false;
44012         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
44013         return ret_conv;
44014 }
44015
44016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44017         LDKClosingSigned orig_conv;
44018         orig_conv.inner = untag_ptr(orig);
44019         orig_conv.is_owned = ptr_is_owned(orig);
44020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44021         orig_conv.is_owned = false;
44022         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
44023         int64_t ret_ref = 0;
44024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44026         return ret_ref;
44027 }
44028
44029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44030         LDKClosingSigned a_conv;
44031         a_conv.inner = untag_ptr(a);
44032         a_conv.is_owned = ptr_is_owned(a);
44033         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44034         a_conv.is_owned = false;
44035         LDKClosingSigned b_conv;
44036         b_conv.inner = untag_ptr(b);
44037         b_conv.is_owned = ptr_is_owned(b);
44038         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44039         b_conv.is_owned = false;
44040         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
44041         return ret_conv;
44042 }
44043
44044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44045         LDKUpdateAddHTLC this_obj_conv;
44046         this_obj_conv.inner = untag_ptr(this_obj);
44047         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44049         UpdateAddHTLC_free(this_obj_conv);
44050 }
44051
44052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44053         LDKUpdateAddHTLC this_ptr_conv;
44054         this_ptr_conv.inner = untag_ptr(this_ptr);
44055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44057         this_ptr_conv.is_owned = false;
44058         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44059         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
44060         return ret_arr;
44061 }
44062
44063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44064         LDKUpdateAddHTLC this_ptr_conv;
44065         this_ptr_conv.inner = untag_ptr(this_ptr);
44066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44068         this_ptr_conv.is_owned = false;
44069         LDKThirtyTwoBytes val_ref;
44070         CHECK((*env)->GetArrayLength(env, val) == 32);
44071         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44072         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
44073 }
44074
44075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44076         LDKUpdateAddHTLC this_ptr_conv;
44077         this_ptr_conv.inner = untag_ptr(this_ptr);
44078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44080         this_ptr_conv.is_owned = false;
44081         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
44082         return ret_conv;
44083 }
44084
44085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44086         LDKUpdateAddHTLC this_ptr_conv;
44087         this_ptr_conv.inner = untag_ptr(this_ptr);
44088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44090         this_ptr_conv.is_owned = false;
44091         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
44092 }
44093
44094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44095         LDKUpdateAddHTLC this_ptr_conv;
44096         this_ptr_conv.inner = untag_ptr(this_ptr);
44097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44099         this_ptr_conv.is_owned = false;
44100         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
44101         return ret_conv;
44102 }
44103
44104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44105         LDKUpdateAddHTLC this_ptr_conv;
44106         this_ptr_conv.inner = untag_ptr(this_ptr);
44107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44109         this_ptr_conv.is_owned = false;
44110         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
44111 }
44112
44113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
44114         LDKUpdateAddHTLC this_ptr_conv;
44115         this_ptr_conv.inner = untag_ptr(this_ptr);
44116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44118         this_ptr_conv.is_owned = false;
44119         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44120         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
44121         return ret_arr;
44122 }
44123
44124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44125         LDKUpdateAddHTLC this_ptr_conv;
44126         this_ptr_conv.inner = untag_ptr(this_ptr);
44127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44129         this_ptr_conv.is_owned = false;
44130         LDKThirtyTwoBytes val_ref;
44131         CHECK((*env)->GetArrayLength(env, val) == 32);
44132         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44133         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
44134 }
44135
44136 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
44137         LDKUpdateAddHTLC this_ptr_conv;
44138         this_ptr_conv.inner = untag_ptr(this_ptr);
44139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44141         this_ptr_conv.is_owned = false;
44142         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
44143         return ret_conv;
44144 }
44145
44146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44147         LDKUpdateAddHTLC this_ptr_conv;
44148         this_ptr_conv.inner = untag_ptr(this_ptr);
44149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44151         this_ptr_conv.is_owned = false;
44152         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
44153 }
44154
44155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
44156         LDKUpdateAddHTLC this_ptr_conv;
44157         this_ptr_conv.inner = untag_ptr(this_ptr);
44158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44160         this_ptr_conv.is_owned = false;
44161         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44162         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
44163         int64_t ret_ref = tag_ptr(ret_copy, true);
44164         return ret_ref;
44165 }
44166
44167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44168         LDKUpdateAddHTLC this_ptr_conv;
44169         this_ptr_conv.inner = untag_ptr(this_ptr);
44170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44172         this_ptr_conv.is_owned = false;
44173         void* val_ptr = untag_ptr(val);
44174         CHECK_ACCESS(val_ptr);
44175         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44176         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44177         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
44178 }
44179
44180 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
44181         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
44182         int64_t ret_ref = 0;
44183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44185         return ret_ref;
44186 }
44187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44188         LDKUpdateAddHTLC arg_conv;
44189         arg_conv.inner = untag_ptr(arg);
44190         arg_conv.is_owned = ptr_is_owned(arg);
44191         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44192         arg_conv.is_owned = false;
44193         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
44194         return ret_conv;
44195 }
44196
44197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44198         LDKUpdateAddHTLC orig_conv;
44199         orig_conv.inner = untag_ptr(orig);
44200         orig_conv.is_owned = ptr_is_owned(orig);
44201         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44202         orig_conv.is_owned = false;
44203         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
44204         int64_t ret_ref = 0;
44205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44207         return ret_ref;
44208 }
44209
44210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44211         LDKUpdateAddHTLC a_conv;
44212         a_conv.inner = untag_ptr(a);
44213         a_conv.is_owned = ptr_is_owned(a);
44214         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44215         a_conv.is_owned = false;
44216         LDKUpdateAddHTLC b_conv;
44217         b_conv.inner = untag_ptr(b);
44218         b_conv.is_owned = ptr_is_owned(b);
44219         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44220         b_conv.is_owned = false;
44221         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
44222         return ret_conv;
44223 }
44224
44225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44226         LDKOnionMessage this_obj_conv;
44227         this_obj_conv.inner = untag_ptr(this_obj);
44228         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44230         OnionMessage_free(this_obj_conv);
44231 }
44232
44233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44234         LDKOnionMessage this_ptr_conv;
44235         this_ptr_conv.inner = untag_ptr(this_ptr);
44236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44238         this_ptr_conv.is_owned = false;
44239         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44240         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
44241         return ret_arr;
44242 }
44243
44244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44245         LDKOnionMessage this_ptr_conv;
44246         this_ptr_conv.inner = untag_ptr(this_ptr);
44247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44249         this_ptr_conv.is_owned = false;
44250         LDKPublicKey val_ref;
44251         CHECK((*env)->GetArrayLength(env, val) == 33);
44252         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44253         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
44254 }
44255
44256 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
44257         LDKOnionMessage ret_var = OnionMessage_clone(arg);
44258         int64_t ret_ref = 0;
44259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44261         return ret_ref;
44262 }
44263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44264         LDKOnionMessage arg_conv;
44265         arg_conv.inner = untag_ptr(arg);
44266         arg_conv.is_owned = ptr_is_owned(arg);
44267         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44268         arg_conv.is_owned = false;
44269         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
44270         return ret_conv;
44271 }
44272
44273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44274         LDKOnionMessage orig_conv;
44275         orig_conv.inner = untag_ptr(orig);
44276         orig_conv.is_owned = ptr_is_owned(orig);
44277         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44278         orig_conv.is_owned = false;
44279         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
44280         int64_t ret_ref = 0;
44281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44283         return ret_ref;
44284 }
44285
44286 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44287         LDKOnionMessage a_conv;
44288         a_conv.inner = untag_ptr(a);
44289         a_conv.is_owned = ptr_is_owned(a);
44290         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44291         a_conv.is_owned = false;
44292         LDKOnionMessage b_conv;
44293         b_conv.inner = untag_ptr(b);
44294         b_conv.is_owned = ptr_is_owned(b);
44295         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44296         b_conv.is_owned = false;
44297         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
44298         return ret_conv;
44299 }
44300
44301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44302         LDKUpdateFulfillHTLC this_obj_conv;
44303         this_obj_conv.inner = untag_ptr(this_obj);
44304         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44306         UpdateFulfillHTLC_free(this_obj_conv);
44307 }
44308
44309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44310         LDKUpdateFulfillHTLC this_ptr_conv;
44311         this_ptr_conv.inner = untag_ptr(this_ptr);
44312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44314         this_ptr_conv.is_owned = false;
44315         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44316         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
44317         return ret_arr;
44318 }
44319
44320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44321         LDKUpdateFulfillHTLC this_ptr_conv;
44322         this_ptr_conv.inner = untag_ptr(this_ptr);
44323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44325         this_ptr_conv.is_owned = false;
44326         LDKThirtyTwoBytes val_ref;
44327         CHECK((*env)->GetArrayLength(env, val) == 32);
44328         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44329         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
44330 }
44331
44332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44333         LDKUpdateFulfillHTLC this_ptr_conv;
44334         this_ptr_conv.inner = untag_ptr(this_ptr);
44335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44337         this_ptr_conv.is_owned = false;
44338         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
44339         return ret_conv;
44340 }
44341
44342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44343         LDKUpdateFulfillHTLC this_ptr_conv;
44344         this_ptr_conv.inner = untag_ptr(this_ptr);
44345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44347         this_ptr_conv.is_owned = false;
44348         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
44349 }
44350
44351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
44352         LDKUpdateFulfillHTLC this_ptr_conv;
44353         this_ptr_conv.inner = untag_ptr(this_ptr);
44354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44356         this_ptr_conv.is_owned = false;
44357         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44358         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
44359         return ret_arr;
44360 }
44361
44362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44363         LDKUpdateFulfillHTLC this_ptr_conv;
44364         this_ptr_conv.inner = untag_ptr(this_ptr);
44365         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44367         this_ptr_conv.is_owned = false;
44368         LDKThirtyTwoBytes val_ref;
44369         CHECK((*env)->GetArrayLength(env, val) == 32);
44370         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44371         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
44372 }
44373
44374 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) {
44375         LDKThirtyTwoBytes channel_id_arg_ref;
44376         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44377         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44378         LDKThirtyTwoBytes payment_preimage_arg_ref;
44379         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
44380         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
44381         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
44382         int64_t ret_ref = 0;
44383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44385         return ret_ref;
44386 }
44387
44388 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
44389         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
44390         int64_t ret_ref = 0;
44391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44393         return ret_ref;
44394 }
44395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44396         LDKUpdateFulfillHTLC arg_conv;
44397         arg_conv.inner = untag_ptr(arg);
44398         arg_conv.is_owned = ptr_is_owned(arg);
44399         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44400         arg_conv.is_owned = false;
44401         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
44402         return ret_conv;
44403 }
44404
44405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44406         LDKUpdateFulfillHTLC orig_conv;
44407         orig_conv.inner = untag_ptr(orig);
44408         orig_conv.is_owned = ptr_is_owned(orig);
44409         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44410         orig_conv.is_owned = false;
44411         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
44412         int64_t ret_ref = 0;
44413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44415         return ret_ref;
44416 }
44417
44418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44419         LDKUpdateFulfillHTLC a_conv;
44420         a_conv.inner = untag_ptr(a);
44421         a_conv.is_owned = ptr_is_owned(a);
44422         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44423         a_conv.is_owned = false;
44424         LDKUpdateFulfillHTLC b_conv;
44425         b_conv.inner = untag_ptr(b);
44426         b_conv.is_owned = ptr_is_owned(b);
44427         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44428         b_conv.is_owned = false;
44429         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
44430         return ret_conv;
44431 }
44432
44433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44434         LDKUpdateFailHTLC this_obj_conv;
44435         this_obj_conv.inner = untag_ptr(this_obj);
44436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44438         UpdateFailHTLC_free(this_obj_conv);
44439 }
44440
44441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44442         LDKUpdateFailHTLC this_ptr_conv;
44443         this_ptr_conv.inner = untag_ptr(this_ptr);
44444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44446         this_ptr_conv.is_owned = false;
44447         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44448         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
44449         return ret_arr;
44450 }
44451
44452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44453         LDKUpdateFailHTLC this_ptr_conv;
44454         this_ptr_conv.inner = untag_ptr(this_ptr);
44455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44457         this_ptr_conv.is_owned = false;
44458         LDKThirtyTwoBytes val_ref;
44459         CHECK((*env)->GetArrayLength(env, val) == 32);
44460         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44461         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
44462 }
44463
44464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44465         LDKUpdateFailHTLC this_ptr_conv;
44466         this_ptr_conv.inner = untag_ptr(this_ptr);
44467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44469         this_ptr_conv.is_owned = false;
44470         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
44471         return ret_conv;
44472 }
44473
44474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44475         LDKUpdateFailHTLC this_ptr_conv;
44476         this_ptr_conv.inner = untag_ptr(this_ptr);
44477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44479         this_ptr_conv.is_owned = false;
44480         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
44481 }
44482
44483 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
44484         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
44485         int64_t ret_ref = 0;
44486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44488         return ret_ref;
44489 }
44490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44491         LDKUpdateFailHTLC arg_conv;
44492         arg_conv.inner = untag_ptr(arg);
44493         arg_conv.is_owned = ptr_is_owned(arg);
44494         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44495         arg_conv.is_owned = false;
44496         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
44497         return ret_conv;
44498 }
44499
44500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44501         LDKUpdateFailHTLC orig_conv;
44502         orig_conv.inner = untag_ptr(orig);
44503         orig_conv.is_owned = ptr_is_owned(orig);
44504         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44505         orig_conv.is_owned = false;
44506         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
44507         int64_t ret_ref = 0;
44508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44510         return ret_ref;
44511 }
44512
44513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44514         LDKUpdateFailHTLC a_conv;
44515         a_conv.inner = untag_ptr(a);
44516         a_conv.is_owned = ptr_is_owned(a);
44517         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44518         a_conv.is_owned = false;
44519         LDKUpdateFailHTLC b_conv;
44520         b_conv.inner = untag_ptr(b);
44521         b_conv.is_owned = ptr_is_owned(b);
44522         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44523         b_conv.is_owned = false;
44524         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
44525         return ret_conv;
44526 }
44527
44528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44529         LDKUpdateFailMalformedHTLC this_obj_conv;
44530         this_obj_conv.inner = untag_ptr(this_obj);
44531         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44533         UpdateFailMalformedHTLC_free(this_obj_conv);
44534 }
44535
44536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44537         LDKUpdateFailMalformedHTLC this_ptr_conv;
44538         this_ptr_conv.inner = untag_ptr(this_ptr);
44539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44541         this_ptr_conv.is_owned = false;
44542         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44543         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
44544         return ret_arr;
44545 }
44546
44547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44548         LDKUpdateFailMalformedHTLC this_ptr_conv;
44549         this_ptr_conv.inner = untag_ptr(this_ptr);
44550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44552         this_ptr_conv.is_owned = false;
44553         LDKThirtyTwoBytes val_ref;
44554         CHECK((*env)->GetArrayLength(env, val) == 32);
44555         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44556         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
44557 }
44558
44559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44560         LDKUpdateFailMalformedHTLC this_ptr_conv;
44561         this_ptr_conv.inner = untag_ptr(this_ptr);
44562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44564         this_ptr_conv.is_owned = false;
44565         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
44566         return ret_conv;
44567 }
44568
44569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44570         LDKUpdateFailMalformedHTLC this_ptr_conv;
44571         this_ptr_conv.inner = untag_ptr(this_ptr);
44572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44574         this_ptr_conv.is_owned = false;
44575         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
44576 }
44577
44578 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
44579         LDKUpdateFailMalformedHTLC this_ptr_conv;
44580         this_ptr_conv.inner = untag_ptr(this_ptr);
44581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44583         this_ptr_conv.is_owned = false;
44584         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
44585         return ret_conv;
44586 }
44587
44588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
44589         LDKUpdateFailMalformedHTLC this_ptr_conv;
44590         this_ptr_conv.inner = untag_ptr(this_ptr);
44591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44593         this_ptr_conv.is_owned = false;
44594         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
44595 }
44596
44597 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
44598         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
44599         int64_t ret_ref = 0;
44600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44602         return ret_ref;
44603 }
44604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44605         LDKUpdateFailMalformedHTLC arg_conv;
44606         arg_conv.inner = untag_ptr(arg);
44607         arg_conv.is_owned = ptr_is_owned(arg);
44608         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44609         arg_conv.is_owned = false;
44610         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
44611         return ret_conv;
44612 }
44613
44614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44615         LDKUpdateFailMalformedHTLC orig_conv;
44616         orig_conv.inner = untag_ptr(orig);
44617         orig_conv.is_owned = ptr_is_owned(orig);
44618         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44619         orig_conv.is_owned = false;
44620         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
44621         int64_t ret_ref = 0;
44622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44624         return ret_ref;
44625 }
44626
44627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44628         LDKUpdateFailMalformedHTLC a_conv;
44629         a_conv.inner = untag_ptr(a);
44630         a_conv.is_owned = ptr_is_owned(a);
44631         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44632         a_conv.is_owned = false;
44633         LDKUpdateFailMalformedHTLC b_conv;
44634         b_conv.inner = untag_ptr(b);
44635         b_conv.is_owned = ptr_is_owned(b);
44636         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44637         b_conv.is_owned = false;
44638         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
44639         return ret_conv;
44640 }
44641
44642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44643         LDKCommitmentSigned this_obj_conv;
44644         this_obj_conv.inner = untag_ptr(this_obj);
44645         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44647         CommitmentSigned_free(this_obj_conv);
44648 }
44649
44650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44651         LDKCommitmentSigned this_ptr_conv;
44652         this_ptr_conv.inner = untag_ptr(this_ptr);
44653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44655         this_ptr_conv.is_owned = false;
44656         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44657         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
44658         return ret_arr;
44659 }
44660
44661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44662         LDKCommitmentSigned this_ptr_conv;
44663         this_ptr_conv.inner = untag_ptr(this_ptr);
44664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44666         this_ptr_conv.is_owned = false;
44667         LDKThirtyTwoBytes val_ref;
44668         CHECK((*env)->GetArrayLength(env, val) == 32);
44669         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44670         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
44671 }
44672
44673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
44674         LDKCommitmentSigned this_ptr_conv;
44675         this_ptr_conv.inner = untag_ptr(this_ptr);
44676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44678         this_ptr_conv.is_owned = false;
44679         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
44680         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
44681         return ret_arr;
44682 }
44683
44684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44685         LDKCommitmentSigned this_ptr_conv;
44686         this_ptr_conv.inner = untag_ptr(this_ptr);
44687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44689         this_ptr_conv.is_owned = false;
44690         LDKSignature val_ref;
44691         CHECK((*env)->GetArrayLength(env, val) == 64);
44692         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
44693         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
44694 }
44695
44696 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
44697         LDKCommitmentSigned this_ptr_conv;
44698         this_ptr_conv.inner = untag_ptr(this_ptr);
44699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44701         this_ptr_conv.is_owned = false;
44702         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
44703         jobjectArray ret_arr = NULL;
44704         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
44705         ;
44706         for (size_t i = 0; i < ret_var.datalen; i++) {
44707                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
44708                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
44709                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
44710         }
44711         
44712         FREE(ret_var.data);
44713         return ret_arr;
44714 }
44715
44716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
44717         LDKCommitmentSigned this_ptr_conv;
44718         this_ptr_conv.inner = untag_ptr(this_ptr);
44719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44721         this_ptr_conv.is_owned = false;
44722         LDKCVec_SignatureZ val_constr;
44723         val_constr.datalen = (*env)->GetArrayLength(env, val);
44724         if (val_constr.datalen > 0)
44725                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
44726         else
44727                 val_constr.data = NULL;
44728         for (size_t i = 0; i < val_constr.datalen; i++) {
44729                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
44730                 LDKSignature val_conv_8_ref;
44731                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
44732                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
44733                 val_constr.data[i] = val_conv_8_ref;
44734         }
44735         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
44736 }
44737
44738 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) {
44739         LDKThirtyTwoBytes channel_id_arg_ref;
44740         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44741         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44742         LDKSignature signature_arg_ref;
44743         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
44744         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
44745         LDKCVec_SignatureZ htlc_signatures_arg_constr;
44746         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
44747         if (htlc_signatures_arg_constr.datalen > 0)
44748                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
44749         else
44750                 htlc_signatures_arg_constr.data = NULL;
44751         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
44752                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
44753                 LDKSignature htlc_signatures_arg_conv_8_ref;
44754                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
44755                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
44756                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
44757         }
44758         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
44759         int64_t ret_ref = 0;
44760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44762         return ret_ref;
44763 }
44764
44765 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
44766         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
44767         int64_t ret_ref = 0;
44768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44770         return ret_ref;
44771 }
44772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44773         LDKCommitmentSigned arg_conv;
44774         arg_conv.inner = untag_ptr(arg);
44775         arg_conv.is_owned = ptr_is_owned(arg);
44776         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44777         arg_conv.is_owned = false;
44778         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
44779         return ret_conv;
44780 }
44781
44782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44783         LDKCommitmentSigned orig_conv;
44784         orig_conv.inner = untag_ptr(orig);
44785         orig_conv.is_owned = ptr_is_owned(orig);
44786         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44787         orig_conv.is_owned = false;
44788         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
44789         int64_t ret_ref = 0;
44790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44792         return ret_ref;
44793 }
44794
44795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44796         LDKCommitmentSigned a_conv;
44797         a_conv.inner = untag_ptr(a);
44798         a_conv.is_owned = ptr_is_owned(a);
44799         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44800         a_conv.is_owned = false;
44801         LDKCommitmentSigned b_conv;
44802         b_conv.inner = untag_ptr(b);
44803         b_conv.is_owned = ptr_is_owned(b);
44804         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44805         b_conv.is_owned = false;
44806         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
44807         return ret_conv;
44808 }
44809
44810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44811         LDKRevokeAndACK this_obj_conv;
44812         this_obj_conv.inner = untag_ptr(this_obj);
44813         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44815         RevokeAndACK_free(this_obj_conv);
44816 }
44817
44818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44819         LDKRevokeAndACK this_ptr_conv;
44820         this_ptr_conv.inner = untag_ptr(this_ptr);
44821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44823         this_ptr_conv.is_owned = false;
44824         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44825         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
44826         return ret_arr;
44827 }
44828
44829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44830         LDKRevokeAndACK this_ptr_conv;
44831         this_ptr_conv.inner = untag_ptr(this_ptr);
44832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44834         this_ptr_conv.is_owned = false;
44835         LDKThirtyTwoBytes val_ref;
44836         CHECK((*env)->GetArrayLength(env, val) == 32);
44837         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44838         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
44839 }
44840
44841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
44842         LDKRevokeAndACK this_ptr_conv;
44843         this_ptr_conv.inner = untag_ptr(this_ptr);
44844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44846         this_ptr_conv.is_owned = false;
44847         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44848         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
44849         return ret_arr;
44850 }
44851
44852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44853         LDKRevokeAndACK this_ptr_conv;
44854         this_ptr_conv.inner = untag_ptr(this_ptr);
44855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44857         this_ptr_conv.is_owned = false;
44858         LDKThirtyTwoBytes val_ref;
44859         CHECK((*env)->GetArrayLength(env, val) == 32);
44860         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44861         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
44862 }
44863
44864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
44865         LDKRevokeAndACK this_ptr_conv;
44866         this_ptr_conv.inner = untag_ptr(this_ptr);
44867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44869         this_ptr_conv.is_owned = false;
44870         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44871         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
44872         return ret_arr;
44873 }
44874
44875 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) {
44876         LDKRevokeAndACK this_ptr_conv;
44877         this_ptr_conv.inner = untag_ptr(this_ptr);
44878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44880         this_ptr_conv.is_owned = false;
44881         LDKPublicKey val_ref;
44882         CHECK((*env)->GetArrayLength(env, val) == 33);
44883         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44884         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
44885 }
44886
44887 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) {
44888         LDKThirtyTwoBytes channel_id_arg_ref;
44889         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
44890         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
44891         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
44892         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
44893         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
44894         LDKPublicKey next_per_commitment_point_arg_ref;
44895         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
44896         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
44897         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
44898         int64_t ret_ref = 0;
44899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44901         return ret_ref;
44902 }
44903
44904 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
44905         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
44906         int64_t ret_ref = 0;
44907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44909         return ret_ref;
44910 }
44911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44912         LDKRevokeAndACK arg_conv;
44913         arg_conv.inner = untag_ptr(arg);
44914         arg_conv.is_owned = ptr_is_owned(arg);
44915         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44916         arg_conv.is_owned = false;
44917         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
44918         return ret_conv;
44919 }
44920
44921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44922         LDKRevokeAndACK orig_conv;
44923         orig_conv.inner = untag_ptr(orig);
44924         orig_conv.is_owned = ptr_is_owned(orig);
44925         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44926         orig_conv.is_owned = false;
44927         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
44928         int64_t ret_ref = 0;
44929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44931         return ret_ref;
44932 }
44933
44934 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44935         LDKRevokeAndACK a_conv;
44936         a_conv.inner = untag_ptr(a);
44937         a_conv.is_owned = ptr_is_owned(a);
44938         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44939         a_conv.is_owned = false;
44940         LDKRevokeAndACK b_conv;
44941         b_conv.inner = untag_ptr(b);
44942         b_conv.is_owned = ptr_is_owned(b);
44943         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44944         b_conv.is_owned = false;
44945         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
44946         return ret_conv;
44947 }
44948
44949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44950         LDKUpdateFee this_obj_conv;
44951         this_obj_conv.inner = untag_ptr(this_obj);
44952         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44954         UpdateFee_free(this_obj_conv);
44955 }
44956
44957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44958         LDKUpdateFee this_ptr_conv;
44959         this_ptr_conv.inner = untag_ptr(this_ptr);
44960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44962         this_ptr_conv.is_owned = false;
44963         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44964         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
44965         return ret_arr;
44966 }
44967
44968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44969         LDKUpdateFee this_ptr_conv;
44970         this_ptr_conv.inner = untag_ptr(this_ptr);
44971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44973         this_ptr_conv.is_owned = false;
44974         LDKThirtyTwoBytes val_ref;
44975         CHECK((*env)->GetArrayLength(env, val) == 32);
44976         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
44977         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
44978 }
44979
44980 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
44981         LDKUpdateFee this_ptr_conv;
44982         this_ptr_conv.inner = untag_ptr(this_ptr);
44983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44985         this_ptr_conv.is_owned = false;
44986         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
44987         return ret_conv;
44988 }
44989
44990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
44991         LDKUpdateFee this_ptr_conv;
44992         this_ptr_conv.inner = untag_ptr(this_ptr);
44993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44995         this_ptr_conv.is_owned = false;
44996         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
44997 }
44998
44999 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) {
45000         LDKThirtyTwoBytes channel_id_arg_ref;
45001         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45002         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45003         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
45004         int64_t ret_ref = 0;
45005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45007         return ret_ref;
45008 }
45009
45010 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
45011         LDKUpdateFee ret_var = UpdateFee_clone(arg);
45012         int64_t ret_ref = 0;
45013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45015         return ret_ref;
45016 }
45017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45018         LDKUpdateFee arg_conv;
45019         arg_conv.inner = untag_ptr(arg);
45020         arg_conv.is_owned = ptr_is_owned(arg);
45021         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45022         arg_conv.is_owned = false;
45023         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
45024         return ret_conv;
45025 }
45026
45027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45028         LDKUpdateFee orig_conv;
45029         orig_conv.inner = untag_ptr(orig);
45030         orig_conv.is_owned = ptr_is_owned(orig);
45031         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45032         orig_conv.is_owned = false;
45033         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
45034         int64_t ret_ref = 0;
45035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45037         return ret_ref;
45038 }
45039
45040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45041         LDKUpdateFee a_conv;
45042         a_conv.inner = untag_ptr(a);
45043         a_conv.is_owned = ptr_is_owned(a);
45044         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45045         a_conv.is_owned = false;
45046         LDKUpdateFee b_conv;
45047         b_conv.inner = untag_ptr(b);
45048         b_conv.is_owned = ptr_is_owned(b);
45049         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45050         b_conv.is_owned = false;
45051         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
45052         return ret_conv;
45053 }
45054
45055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45056         LDKChannelReestablish this_obj_conv;
45057         this_obj_conv.inner = untag_ptr(this_obj);
45058         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45060         ChannelReestablish_free(this_obj_conv);
45061 }
45062
45063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45064         LDKChannelReestablish this_ptr_conv;
45065         this_ptr_conv.inner = untag_ptr(this_ptr);
45066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45068         this_ptr_conv.is_owned = false;
45069         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45070         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
45071         return ret_arr;
45072 }
45073
45074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45075         LDKChannelReestablish this_ptr_conv;
45076         this_ptr_conv.inner = untag_ptr(this_ptr);
45077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45079         this_ptr_conv.is_owned = false;
45080         LDKThirtyTwoBytes val_ref;
45081         CHECK((*env)->GetArrayLength(env, val) == 32);
45082         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45083         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
45084 }
45085
45086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
45087         LDKChannelReestablish this_ptr_conv;
45088         this_ptr_conv.inner = untag_ptr(this_ptr);
45089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45091         this_ptr_conv.is_owned = false;
45092         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
45093         return ret_conv;
45094 }
45095
45096 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) {
45097         LDKChannelReestablish this_ptr_conv;
45098         this_ptr_conv.inner = untag_ptr(this_ptr);
45099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45101         this_ptr_conv.is_owned = false;
45102         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
45103 }
45104
45105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
45106         LDKChannelReestablish this_ptr_conv;
45107         this_ptr_conv.inner = untag_ptr(this_ptr);
45108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45110         this_ptr_conv.is_owned = false;
45111         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
45112         return ret_conv;
45113 }
45114
45115 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) {
45116         LDKChannelReestablish this_ptr_conv;
45117         this_ptr_conv.inner = untag_ptr(this_ptr);
45118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45120         this_ptr_conv.is_owned = false;
45121         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
45122 }
45123
45124 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
45125         LDKChannelReestablish this_ptr_conv;
45126         this_ptr_conv.inner = untag_ptr(this_ptr);
45127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45129         this_ptr_conv.is_owned = false;
45130         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45131         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
45132         return ret_arr;
45133 }
45134
45135 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) {
45136         LDKChannelReestablish this_ptr_conv;
45137         this_ptr_conv.inner = untag_ptr(this_ptr);
45138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45140         this_ptr_conv.is_owned = false;
45141         LDKThirtyTwoBytes val_ref;
45142         CHECK((*env)->GetArrayLength(env, val) == 32);
45143         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45144         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
45145 }
45146
45147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
45148         LDKChannelReestablish this_ptr_conv;
45149         this_ptr_conv.inner = untag_ptr(this_ptr);
45150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45152         this_ptr_conv.is_owned = false;
45153         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45154         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
45155         return ret_arr;
45156 }
45157
45158 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) {
45159         LDKChannelReestablish this_ptr_conv;
45160         this_ptr_conv.inner = untag_ptr(this_ptr);
45161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45163         this_ptr_conv.is_owned = false;
45164         LDKPublicKey val_ref;
45165         CHECK((*env)->GetArrayLength(env, val) == 33);
45166         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
45167         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
45168 }
45169
45170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
45171         LDKChannelReestablish this_ptr_conv;
45172         this_ptr_conv.inner = untag_ptr(this_ptr);
45173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45175         this_ptr_conv.is_owned = false;
45176         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
45177         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
45178         int64_t ret_ref = tag_ptr(ret_copy, true);
45179         return ret_ref;
45180 }
45181
45182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45183         LDKChannelReestablish this_ptr_conv;
45184         this_ptr_conv.inner = untag_ptr(this_ptr);
45185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45187         this_ptr_conv.is_owned = false;
45188         void* val_ptr = untag_ptr(val);
45189         CHECK_ACCESS(val_ptr);
45190         LDKCOption_TxidZ val_conv = *(LDKCOption_TxidZ*)(val_ptr);
45191         val_conv = COption_TxidZ_clone((LDKCOption_TxidZ*)untag_ptr(val));
45192         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
45193 }
45194
45195 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) {
45196         LDKThirtyTwoBytes channel_id_arg_ref;
45197         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45198         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45199         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
45200         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
45201         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
45202         LDKPublicKey my_current_per_commitment_point_arg_ref;
45203         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
45204         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
45205         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
45206         CHECK_ACCESS(next_funding_txid_arg_ptr);
45207         LDKCOption_TxidZ next_funding_txid_arg_conv = *(LDKCOption_TxidZ*)(next_funding_txid_arg_ptr);
45208         next_funding_txid_arg_conv = COption_TxidZ_clone((LDKCOption_TxidZ*)untag_ptr(next_funding_txid_arg));
45209         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);
45210         int64_t ret_ref = 0;
45211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45213         return ret_ref;
45214 }
45215
45216 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
45217         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
45218         int64_t ret_ref = 0;
45219         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45220         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45221         return ret_ref;
45222 }
45223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45224         LDKChannelReestablish arg_conv;
45225         arg_conv.inner = untag_ptr(arg);
45226         arg_conv.is_owned = ptr_is_owned(arg);
45227         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45228         arg_conv.is_owned = false;
45229         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
45230         return ret_conv;
45231 }
45232
45233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45234         LDKChannelReestablish orig_conv;
45235         orig_conv.inner = untag_ptr(orig);
45236         orig_conv.is_owned = ptr_is_owned(orig);
45237         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45238         orig_conv.is_owned = false;
45239         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
45240         int64_t ret_ref = 0;
45241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45243         return ret_ref;
45244 }
45245
45246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45247         LDKChannelReestablish a_conv;
45248         a_conv.inner = untag_ptr(a);
45249         a_conv.is_owned = ptr_is_owned(a);
45250         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45251         a_conv.is_owned = false;
45252         LDKChannelReestablish b_conv;
45253         b_conv.inner = untag_ptr(b);
45254         b_conv.is_owned = ptr_is_owned(b);
45255         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45256         b_conv.is_owned = false;
45257         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
45258         return ret_conv;
45259 }
45260
45261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45262         LDKAnnouncementSignatures this_obj_conv;
45263         this_obj_conv.inner = untag_ptr(this_obj);
45264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45266         AnnouncementSignatures_free(this_obj_conv);
45267 }
45268
45269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45270         LDKAnnouncementSignatures this_ptr_conv;
45271         this_ptr_conv.inner = untag_ptr(this_ptr);
45272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45274         this_ptr_conv.is_owned = false;
45275         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45276         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
45277         return ret_arr;
45278 }
45279
45280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45281         LDKAnnouncementSignatures this_ptr_conv;
45282         this_ptr_conv.inner = untag_ptr(this_ptr);
45283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45285         this_ptr_conv.is_owned = false;
45286         LDKThirtyTwoBytes val_ref;
45287         CHECK((*env)->GetArrayLength(env, val) == 32);
45288         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45289         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
45290 }
45291
45292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45293         LDKAnnouncementSignatures this_ptr_conv;
45294         this_ptr_conv.inner = untag_ptr(this_ptr);
45295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45297         this_ptr_conv.is_owned = false;
45298         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
45299         return ret_conv;
45300 }
45301
45302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45303         LDKAnnouncementSignatures this_ptr_conv;
45304         this_ptr_conv.inner = untag_ptr(this_ptr);
45305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45307         this_ptr_conv.is_owned = false;
45308         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
45309 }
45310
45311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
45312         LDKAnnouncementSignatures this_ptr_conv;
45313         this_ptr_conv.inner = untag_ptr(this_ptr);
45314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45316         this_ptr_conv.is_owned = false;
45317         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
45318         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
45319         return ret_arr;
45320 }
45321
45322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45323         LDKAnnouncementSignatures this_ptr_conv;
45324         this_ptr_conv.inner = untag_ptr(this_ptr);
45325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45327         this_ptr_conv.is_owned = false;
45328         LDKSignature val_ref;
45329         CHECK((*env)->GetArrayLength(env, val) == 64);
45330         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
45331         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
45332 }
45333
45334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
45335         LDKAnnouncementSignatures this_ptr_conv;
45336         this_ptr_conv.inner = untag_ptr(this_ptr);
45337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45339         this_ptr_conv.is_owned = false;
45340         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
45341         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
45342         return ret_arr;
45343 }
45344
45345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45346         LDKAnnouncementSignatures this_ptr_conv;
45347         this_ptr_conv.inner = untag_ptr(this_ptr);
45348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45350         this_ptr_conv.is_owned = false;
45351         LDKSignature val_ref;
45352         CHECK((*env)->GetArrayLength(env, val) == 64);
45353         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
45354         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
45355 }
45356
45357 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) {
45358         LDKThirtyTwoBytes channel_id_arg_ref;
45359         CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
45360         (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
45361         LDKSignature node_signature_arg_ref;
45362         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
45363         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
45364         LDKSignature bitcoin_signature_arg_ref;
45365         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
45366         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
45367         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
45368         int64_t ret_ref = 0;
45369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45371         return ret_ref;
45372 }
45373
45374 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
45375         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
45376         int64_t ret_ref = 0;
45377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45379         return ret_ref;
45380 }
45381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45382         LDKAnnouncementSignatures arg_conv;
45383         arg_conv.inner = untag_ptr(arg);
45384         arg_conv.is_owned = ptr_is_owned(arg);
45385         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45386         arg_conv.is_owned = false;
45387         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
45388         return ret_conv;
45389 }
45390
45391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45392         LDKAnnouncementSignatures orig_conv;
45393         orig_conv.inner = untag_ptr(orig);
45394         orig_conv.is_owned = ptr_is_owned(orig);
45395         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45396         orig_conv.is_owned = false;
45397         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
45398         int64_t ret_ref = 0;
45399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45401         return ret_ref;
45402 }
45403
45404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45405         LDKAnnouncementSignatures a_conv;
45406         a_conv.inner = untag_ptr(a);
45407         a_conv.is_owned = ptr_is_owned(a);
45408         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45409         a_conv.is_owned = false;
45410         LDKAnnouncementSignatures b_conv;
45411         b_conv.inner = untag_ptr(b);
45412         b_conv.is_owned = ptr_is_owned(b);
45413         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45414         b_conv.is_owned = false;
45415         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
45416         return ret_conv;
45417 }
45418
45419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45420         if (!ptr_is_owned(this_ptr)) return;
45421         void* this_ptr_ptr = untag_ptr(this_ptr);
45422         CHECK_ACCESS(this_ptr_ptr);
45423         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
45424         FREE(untag_ptr(this_ptr));
45425         NetAddress_free(this_ptr_conv);
45426 }
45427
45428 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
45429         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45430         *ret_copy = NetAddress_clone(arg);
45431         int64_t ret_ref = tag_ptr(ret_copy, true);
45432         return ret_ref;
45433 }
45434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45435         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
45436         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
45437         return ret_conv;
45438 }
45439
45440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45441         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
45442         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45443         *ret_copy = NetAddress_clone(orig_conv);
45444         int64_t ret_ref = tag_ptr(ret_copy, true);
45445         return ret_ref;
45446 }
45447
45448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
45449         LDKFourBytes addr_ref;
45450         CHECK((*env)->GetArrayLength(env, addr) == 4);
45451         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
45452         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45453         *ret_copy = NetAddress_ipv4(addr_ref, port);
45454         int64_t ret_ref = tag_ptr(ret_copy, true);
45455         return ret_ref;
45456 }
45457
45458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
45459         LDKSixteenBytes addr_ref;
45460         CHECK((*env)->GetArrayLength(env, addr) == 16);
45461         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
45462         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45463         *ret_copy = NetAddress_ipv6(addr_ref, port);
45464         int64_t ret_ref = tag_ptr(ret_copy, true);
45465         return ret_ref;
45466 }
45467
45468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
45469         LDKTwelveBytes a_ref;
45470         CHECK((*env)->GetArrayLength(env, a) == 12);
45471         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
45472         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45473         *ret_copy = NetAddress_onion_v2(a_ref);
45474         int64_t ret_ref = tag_ptr(ret_copy, true);
45475         return ret_ref;
45476 }
45477
45478 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) {
45479         LDKThirtyTwoBytes ed25519_pubkey_ref;
45480         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
45481         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
45482         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45483         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
45484         int64_t ret_ref = tag_ptr(ret_copy, true);
45485         return ret_ref;
45486 }
45487
45488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
45489         LDKHostname hostname_conv;
45490         hostname_conv.inner = untag_ptr(hostname);
45491         hostname_conv.is_owned = ptr_is_owned(hostname);
45492         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
45493         hostname_conv = Hostname_clone(&hostname_conv);
45494         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45495         *ret_copy = NetAddress_hostname(hostname_conv, port);
45496         int64_t ret_ref = tag_ptr(ret_copy, true);
45497         return ret_ref;
45498 }
45499
45500 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45501         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
45502         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
45503         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
45504         return ret_conv;
45505 }
45506
45507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
45508         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
45509         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
45510         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45511         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45512         CVec_u8Z_free(ret_var);
45513         return ret_arr;
45514 }
45515
45516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45517         LDKu8slice ser_ref;
45518         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45519         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45520         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
45521         *ret_conv = NetAddress_read(ser_ref);
45522         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45523         return tag_ptr(ret_conv, true);
45524 }
45525
45526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45527         if (!ptr_is_owned(this_ptr)) return;
45528         void* this_ptr_ptr = untag_ptr(this_ptr);
45529         CHECK_ACCESS(this_ptr_ptr);
45530         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
45531         FREE(untag_ptr(this_ptr));
45532         UnsignedGossipMessage_free(this_ptr_conv);
45533 }
45534
45535 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
45536         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45537         *ret_copy = UnsignedGossipMessage_clone(arg);
45538         int64_t ret_ref = tag_ptr(ret_copy, true);
45539         return ret_ref;
45540 }
45541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45542         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
45543         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
45544         return ret_conv;
45545 }
45546
45547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45548         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
45549         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45550         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
45551         int64_t ret_ref = tag_ptr(ret_copy, true);
45552         return ret_ref;
45553 }
45554
45555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
45556         LDKUnsignedChannelAnnouncement a_conv;
45557         a_conv.inner = untag_ptr(a);
45558         a_conv.is_owned = ptr_is_owned(a);
45559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45560         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
45561         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45562         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
45563         int64_t ret_ref = tag_ptr(ret_copy, true);
45564         return ret_ref;
45565 }
45566
45567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
45568         LDKUnsignedChannelUpdate a_conv;
45569         a_conv.inner = untag_ptr(a);
45570         a_conv.is_owned = ptr_is_owned(a);
45571         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45572         a_conv = UnsignedChannelUpdate_clone(&a_conv);
45573         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45574         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
45575         int64_t ret_ref = tag_ptr(ret_copy, true);
45576         return ret_ref;
45577 }
45578
45579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
45580         LDKUnsignedNodeAnnouncement a_conv;
45581         a_conv.inner = untag_ptr(a);
45582         a_conv.is_owned = ptr_is_owned(a);
45583         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45584         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
45585         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
45586         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
45587         int64_t ret_ref = tag_ptr(ret_copy, true);
45588         return ret_ref;
45589 }
45590
45591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
45592         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
45593         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
45594         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45595         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45596         CVec_u8Z_free(ret_var);
45597         return ret_arr;
45598 }
45599
45600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45601         LDKUnsignedNodeAnnouncement this_obj_conv;
45602         this_obj_conv.inner = untag_ptr(this_obj);
45603         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45605         UnsignedNodeAnnouncement_free(this_obj_conv);
45606 }
45607
45608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
45609         LDKUnsignedNodeAnnouncement this_ptr_conv;
45610         this_ptr_conv.inner = untag_ptr(this_ptr);
45611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45613         this_ptr_conv.is_owned = false;
45614         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
45615         int64_t ret_ref = 0;
45616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45618         return ret_ref;
45619 }
45620
45621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45622         LDKUnsignedNodeAnnouncement this_ptr_conv;
45623         this_ptr_conv.inner = untag_ptr(this_ptr);
45624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45626         this_ptr_conv.is_owned = false;
45627         LDKNodeFeatures val_conv;
45628         val_conv.inner = untag_ptr(val);
45629         val_conv.is_owned = ptr_is_owned(val);
45630         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45631         val_conv = NodeFeatures_clone(&val_conv);
45632         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
45633 }
45634
45635 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
45636         LDKUnsignedNodeAnnouncement this_ptr_conv;
45637         this_ptr_conv.inner = untag_ptr(this_ptr);
45638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45640         this_ptr_conv.is_owned = false;
45641         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
45642         return ret_conv;
45643 }
45644
45645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
45646         LDKUnsignedNodeAnnouncement this_ptr_conv;
45647         this_ptr_conv.inner = untag_ptr(this_ptr);
45648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45650         this_ptr_conv.is_owned = false;
45651         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
45652 }
45653
45654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
45655         LDKUnsignedNodeAnnouncement this_ptr_conv;
45656         this_ptr_conv.inner = untag_ptr(this_ptr);
45657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45659         this_ptr_conv.is_owned = false;
45660         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
45661         int64_t ret_ref = 0;
45662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45664         return ret_ref;
45665 }
45666
45667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45668         LDKUnsignedNodeAnnouncement this_ptr_conv;
45669         this_ptr_conv.inner = untag_ptr(this_ptr);
45670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45672         this_ptr_conv.is_owned = false;
45673         LDKNodeId val_conv;
45674         val_conv.inner = untag_ptr(val);
45675         val_conv.is_owned = ptr_is_owned(val);
45676         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45677         val_conv = NodeId_clone(&val_conv);
45678         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
45679 }
45680
45681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
45682         LDKUnsignedNodeAnnouncement this_ptr_conv;
45683         this_ptr_conv.inner = untag_ptr(this_ptr);
45684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45686         this_ptr_conv.is_owned = false;
45687         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
45688         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
45689         return ret_arr;
45690 }
45691
45692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45693         LDKUnsignedNodeAnnouncement this_ptr_conv;
45694         this_ptr_conv.inner = untag_ptr(this_ptr);
45695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45697         this_ptr_conv.is_owned = false;
45698         LDKThreeBytes val_ref;
45699         CHECK((*env)->GetArrayLength(env, val) == 3);
45700         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
45701         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
45702 }
45703
45704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
45705         LDKUnsignedNodeAnnouncement this_ptr_conv;
45706         this_ptr_conv.inner = untag_ptr(this_ptr);
45707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45709         this_ptr_conv.is_owned = false;
45710         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
45711         int64_t ret_ref = 0;
45712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45714         return ret_ref;
45715 }
45716
45717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45718         LDKUnsignedNodeAnnouncement this_ptr_conv;
45719         this_ptr_conv.inner = untag_ptr(this_ptr);
45720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45722         this_ptr_conv.is_owned = false;
45723         LDKNodeAlias val_conv;
45724         val_conv.inner = untag_ptr(val);
45725         val_conv.is_owned = ptr_is_owned(val);
45726         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45727         val_conv = NodeAlias_clone(&val_conv);
45728         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
45729 }
45730
45731 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
45732         LDKUnsignedNodeAnnouncement this_ptr_conv;
45733         this_ptr_conv.inner = untag_ptr(this_ptr);
45734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45736         this_ptr_conv.is_owned = false;
45737         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
45738         int64_tArray ret_arr = NULL;
45739         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45740         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45741         for (size_t m = 0; m < ret_var.datalen; m++) {
45742                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
45743                 *ret_conv_12_copy = ret_var.data[m];
45744                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
45745                 ret_arr_ptr[m] = ret_conv_12_ref;
45746         }
45747         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45748         FREE(ret_var.data);
45749         return ret_arr;
45750 }
45751
45752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
45753         LDKUnsignedNodeAnnouncement this_ptr_conv;
45754         this_ptr_conv.inner = untag_ptr(this_ptr);
45755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45757         this_ptr_conv.is_owned = false;
45758         LDKCVec_NetAddressZ val_constr;
45759         val_constr.datalen = (*env)->GetArrayLength(env, val);
45760         if (val_constr.datalen > 0)
45761                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
45762         else
45763                 val_constr.data = NULL;
45764         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
45765         for (size_t m = 0; m < val_constr.datalen; m++) {
45766                 int64_t val_conv_12 = val_vals[m];
45767                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
45768                 CHECK_ACCESS(val_conv_12_ptr);
45769                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
45770                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
45771                 val_constr.data[m] = val_conv_12_conv;
45772         }
45773         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
45774         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
45775 }
45776
45777 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
45778         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
45779         int64_t ret_ref = 0;
45780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45782         return ret_ref;
45783 }
45784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45785         LDKUnsignedNodeAnnouncement arg_conv;
45786         arg_conv.inner = untag_ptr(arg);
45787         arg_conv.is_owned = ptr_is_owned(arg);
45788         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45789         arg_conv.is_owned = false;
45790         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
45791         return ret_conv;
45792 }
45793
45794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45795         LDKUnsignedNodeAnnouncement orig_conv;
45796         orig_conv.inner = untag_ptr(orig);
45797         orig_conv.is_owned = ptr_is_owned(orig);
45798         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45799         orig_conv.is_owned = false;
45800         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
45801         int64_t ret_ref = 0;
45802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45804         return ret_ref;
45805 }
45806
45807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45808         LDKUnsignedNodeAnnouncement a_conv;
45809         a_conv.inner = untag_ptr(a);
45810         a_conv.is_owned = ptr_is_owned(a);
45811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45812         a_conv.is_owned = false;
45813         LDKUnsignedNodeAnnouncement b_conv;
45814         b_conv.inner = untag_ptr(b);
45815         b_conv.is_owned = ptr_is_owned(b);
45816         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45817         b_conv.is_owned = false;
45818         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
45819         return ret_conv;
45820 }
45821
45822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45823         LDKNodeAnnouncement this_obj_conv;
45824         this_obj_conv.inner = untag_ptr(this_obj);
45825         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45827         NodeAnnouncement_free(this_obj_conv);
45828 }
45829
45830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
45831         LDKNodeAnnouncement this_ptr_conv;
45832         this_ptr_conv.inner = untag_ptr(this_ptr);
45833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45835         this_ptr_conv.is_owned = false;
45836         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
45837         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
45838         return ret_arr;
45839 }
45840
45841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45842         LDKNodeAnnouncement this_ptr_conv;
45843         this_ptr_conv.inner = untag_ptr(this_ptr);
45844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45846         this_ptr_conv.is_owned = false;
45847         LDKSignature val_ref;
45848         CHECK((*env)->GetArrayLength(env, val) == 64);
45849         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
45850         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
45851 }
45852
45853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
45854         LDKNodeAnnouncement this_ptr_conv;
45855         this_ptr_conv.inner = untag_ptr(this_ptr);
45856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45858         this_ptr_conv.is_owned = false;
45859         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
45860         int64_t ret_ref = 0;
45861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45863         return ret_ref;
45864 }
45865
45866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45867         LDKNodeAnnouncement this_ptr_conv;
45868         this_ptr_conv.inner = untag_ptr(this_ptr);
45869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45871         this_ptr_conv.is_owned = false;
45872         LDKUnsignedNodeAnnouncement val_conv;
45873         val_conv.inner = untag_ptr(val);
45874         val_conv.is_owned = ptr_is_owned(val);
45875         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45876         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
45877         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
45878 }
45879
45880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
45881         LDKSignature signature_arg_ref;
45882         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
45883         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
45884         LDKUnsignedNodeAnnouncement contents_arg_conv;
45885         contents_arg_conv.inner = untag_ptr(contents_arg);
45886         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
45887         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
45888         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
45889         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
45890         int64_t ret_ref = 0;
45891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45893         return ret_ref;
45894 }
45895
45896 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
45897         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
45898         int64_t ret_ref = 0;
45899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45901         return ret_ref;
45902 }
45903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45904         LDKNodeAnnouncement arg_conv;
45905         arg_conv.inner = untag_ptr(arg);
45906         arg_conv.is_owned = ptr_is_owned(arg);
45907         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45908         arg_conv.is_owned = false;
45909         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
45910         return ret_conv;
45911 }
45912
45913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45914         LDKNodeAnnouncement orig_conv;
45915         orig_conv.inner = untag_ptr(orig);
45916         orig_conv.is_owned = ptr_is_owned(orig);
45917         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45918         orig_conv.is_owned = false;
45919         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
45920         int64_t ret_ref = 0;
45921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45923         return ret_ref;
45924 }
45925
45926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45927         LDKNodeAnnouncement a_conv;
45928         a_conv.inner = untag_ptr(a);
45929         a_conv.is_owned = ptr_is_owned(a);
45930         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45931         a_conv.is_owned = false;
45932         LDKNodeAnnouncement b_conv;
45933         b_conv.inner = untag_ptr(b);
45934         b_conv.is_owned = ptr_is_owned(b);
45935         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45936         b_conv.is_owned = false;
45937         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
45938         return ret_conv;
45939 }
45940
45941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45942         LDKUnsignedChannelAnnouncement this_obj_conv;
45943         this_obj_conv.inner = untag_ptr(this_obj);
45944         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45946         UnsignedChannelAnnouncement_free(this_obj_conv);
45947 }
45948
45949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
45950         LDKUnsignedChannelAnnouncement this_ptr_conv;
45951         this_ptr_conv.inner = untag_ptr(this_ptr);
45952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45954         this_ptr_conv.is_owned = false;
45955         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
45956         int64_t ret_ref = 0;
45957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45959         return ret_ref;
45960 }
45961
45962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45963         LDKUnsignedChannelAnnouncement this_ptr_conv;
45964         this_ptr_conv.inner = untag_ptr(this_ptr);
45965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45967         this_ptr_conv.is_owned = false;
45968         LDKChannelFeatures val_conv;
45969         val_conv.inner = untag_ptr(val);
45970         val_conv.is_owned = ptr_is_owned(val);
45971         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45972         val_conv = ChannelFeatures_clone(&val_conv);
45973         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
45974 }
45975
45976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
45977         LDKUnsignedChannelAnnouncement this_ptr_conv;
45978         this_ptr_conv.inner = untag_ptr(this_ptr);
45979         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45981         this_ptr_conv.is_owned = false;
45982         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45983         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
45984         return ret_arr;
45985 }
45986
45987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45988         LDKUnsignedChannelAnnouncement this_ptr_conv;
45989         this_ptr_conv.inner = untag_ptr(this_ptr);
45990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45992         this_ptr_conv.is_owned = false;
45993         LDKThirtyTwoBytes val_ref;
45994         CHECK((*env)->GetArrayLength(env, val) == 32);
45995         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45996         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
45997 }
45998
45999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46000         LDKUnsignedChannelAnnouncement this_ptr_conv;
46001         this_ptr_conv.inner = untag_ptr(this_ptr);
46002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46004         this_ptr_conv.is_owned = false;
46005         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
46006         return ret_conv;
46007 }
46008
46009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46010         LDKUnsignedChannelAnnouncement this_ptr_conv;
46011         this_ptr_conv.inner = untag_ptr(this_ptr);
46012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46014         this_ptr_conv.is_owned = false;
46015         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
46016 }
46017
46018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
46019         LDKUnsignedChannelAnnouncement this_ptr_conv;
46020         this_ptr_conv.inner = untag_ptr(this_ptr);
46021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46023         this_ptr_conv.is_owned = false;
46024         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
46025         int64_t ret_ref = 0;
46026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46028         return ret_ref;
46029 }
46030
46031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46032         LDKUnsignedChannelAnnouncement this_ptr_conv;
46033         this_ptr_conv.inner = untag_ptr(this_ptr);
46034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46036         this_ptr_conv.is_owned = false;
46037         LDKNodeId val_conv;
46038         val_conv.inner = untag_ptr(val);
46039         val_conv.is_owned = ptr_is_owned(val);
46040         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46041         val_conv = NodeId_clone(&val_conv);
46042         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
46043 }
46044
46045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
46046         LDKUnsignedChannelAnnouncement this_ptr_conv;
46047         this_ptr_conv.inner = untag_ptr(this_ptr);
46048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46050         this_ptr_conv.is_owned = false;
46051         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
46052         int64_t ret_ref = 0;
46053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46055         return ret_ref;
46056 }
46057
46058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46059         LDKUnsignedChannelAnnouncement this_ptr_conv;
46060         this_ptr_conv.inner = untag_ptr(this_ptr);
46061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46063         this_ptr_conv.is_owned = false;
46064         LDKNodeId val_conv;
46065         val_conv.inner = untag_ptr(val);
46066         val_conv.is_owned = ptr_is_owned(val);
46067         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46068         val_conv = NodeId_clone(&val_conv);
46069         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
46070 }
46071
46072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
46073         LDKUnsignedChannelAnnouncement this_ptr_conv;
46074         this_ptr_conv.inner = untag_ptr(this_ptr);
46075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46077         this_ptr_conv.is_owned = false;
46078         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
46079         int64_t ret_ref = 0;
46080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46082         return ret_ref;
46083 }
46084
46085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46086         LDKUnsignedChannelAnnouncement this_ptr_conv;
46087         this_ptr_conv.inner = untag_ptr(this_ptr);
46088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46090         this_ptr_conv.is_owned = false;
46091         LDKNodeId val_conv;
46092         val_conv.inner = untag_ptr(val);
46093         val_conv.is_owned = ptr_is_owned(val);
46094         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46095         val_conv = NodeId_clone(&val_conv);
46096         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
46097 }
46098
46099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
46100         LDKUnsignedChannelAnnouncement this_ptr_conv;
46101         this_ptr_conv.inner = untag_ptr(this_ptr);
46102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46104         this_ptr_conv.is_owned = false;
46105         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
46106         int64_t ret_ref = 0;
46107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46109         return ret_ref;
46110 }
46111
46112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46113         LDKUnsignedChannelAnnouncement this_ptr_conv;
46114         this_ptr_conv.inner = untag_ptr(this_ptr);
46115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46117         this_ptr_conv.is_owned = false;
46118         LDKNodeId val_conv;
46119         val_conv.inner = untag_ptr(val);
46120         val_conv.is_owned = ptr_is_owned(val);
46121         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46122         val_conv = NodeId_clone(&val_conv);
46123         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
46124 }
46125
46126 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
46127         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
46128         int64_t ret_ref = 0;
46129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46131         return ret_ref;
46132 }
46133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46134         LDKUnsignedChannelAnnouncement arg_conv;
46135         arg_conv.inner = untag_ptr(arg);
46136         arg_conv.is_owned = ptr_is_owned(arg);
46137         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46138         arg_conv.is_owned = false;
46139         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
46140         return ret_conv;
46141 }
46142
46143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46144         LDKUnsignedChannelAnnouncement orig_conv;
46145         orig_conv.inner = untag_ptr(orig);
46146         orig_conv.is_owned = ptr_is_owned(orig);
46147         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46148         orig_conv.is_owned = false;
46149         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
46150         int64_t ret_ref = 0;
46151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46153         return ret_ref;
46154 }
46155
46156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46157         LDKUnsignedChannelAnnouncement a_conv;
46158         a_conv.inner = untag_ptr(a);
46159         a_conv.is_owned = ptr_is_owned(a);
46160         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46161         a_conv.is_owned = false;
46162         LDKUnsignedChannelAnnouncement b_conv;
46163         b_conv.inner = untag_ptr(b);
46164         b_conv.is_owned = ptr_is_owned(b);
46165         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46166         b_conv.is_owned = false;
46167         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
46168         return ret_conv;
46169 }
46170
46171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46172         LDKChannelAnnouncement this_obj_conv;
46173         this_obj_conv.inner = untag_ptr(this_obj);
46174         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46176         ChannelAnnouncement_free(this_obj_conv);
46177 }
46178
46179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
46180         LDKChannelAnnouncement this_ptr_conv;
46181         this_ptr_conv.inner = untag_ptr(this_ptr);
46182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46184         this_ptr_conv.is_owned = false;
46185         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46186         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
46187         return ret_arr;
46188 }
46189
46190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46191         LDKChannelAnnouncement this_ptr_conv;
46192         this_ptr_conv.inner = untag_ptr(this_ptr);
46193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46195         this_ptr_conv.is_owned = false;
46196         LDKSignature val_ref;
46197         CHECK((*env)->GetArrayLength(env, val) == 64);
46198         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46199         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
46200 }
46201
46202 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
46203         LDKChannelAnnouncement this_ptr_conv;
46204         this_ptr_conv.inner = untag_ptr(this_ptr);
46205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46207         this_ptr_conv.is_owned = false;
46208         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46209         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
46210         return ret_arr;
46211 }
46212
46213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46214         LDKChannelAnnouncement this_ptr_conv;
46215         this_ptr_conv.inner = untag_ptr(this_ptr);
46216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46218         this_ptr_conv.is_owned = false;
46219         LDKSignature val_ref;
46220         CHECK((*env)->GetArrayLength(env, val) == 64);
46221         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46222         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
46223 }
46224
46225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
46226         LDKChannelAnnouncement this_ptr_conv;
46227         this_ptr_conv.inner = untag_ptr(this_ptr);
46228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46230         this_ptr_conv.is_owned = false;
46231         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46232         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
46233         return ret_arr;
46234 }
46235
46236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46237         LDKChannelAnnouncement this_ptr_conv;
46238         this_ptr_conv.inner = untag_ptr(this_ptr);
46239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46241         this_ptr_conv.is_owned = false;
46242         LDKSignature val_ref;
46243         CHECK((*env)->GetArrayLength(env, val) == 64);
46244         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46245         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
46246 }
46247
46248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
46249         LDKChannelAnnouncement this_ptr_conv;
46250         this_ptr_conv.inner = untag_ptr(this_ptr);
46251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46253         this_ptr_conv.is_owned = false;
46254         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46255         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
46256         return ret_arr;
46257 }
46258
46259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46260         LDKChannelAnnouncement this_ptr_conv;
46261         this_ptr_conv.inner = untag_ptr(this_ptr);
46262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46264         this_ptr_conv.is_owned = false;
46265         LDKSignature val_ref;
46266         CHECK((*env)->GetArrayLength(env, val) == 64);
46267         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46268         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
46269 }
46270
46271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
46272         LDKChannelAnnouncement this_ptr_conv;
46273         this_ptr_conv.inner = untag_ptr(this_ptr);
46274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46276         this_ptr_conv.is_owned = false;
46277         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
46278         int64_t ret_ref = 0;
46279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46281         return ret_ref;
46282 }
46283
46284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46285         LDKChannelAnnouncement this_ptr_conv;
46286         this_ptr_conv.inner = untag_ptr(this_ptr);
46287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46289         this_ptr_conv.is_owned = false;
46290         LDKUnsignedChannelAnnouncement val_conv;
46291         val_conv.inner = untag_ptr(val);
46292         val_conv.is_owned = ptr_is_owned(val);
46293         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46294         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
46295         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
46296 }
46297
46298 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) {
46299         LDKSignature node_signature_1_arg_ref;
46300         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
46301         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
46302         LDKSignature node_signature_2_arg_ref;
46303         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
46304         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
46305         LDKSignature bitcoin_signature_1_arg_ref;
46306         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
46307         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
46308         LDKSignature bitcoin_signature_2_arg_ref;
46309         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
46310         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
46311         LDKUnsignedChannelAnnouncement contents_arg_conv;
46312         contents_arg_conv.inner = untag_ptr(contents_arg);
46313         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
46314         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
46315         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
46316         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);
46317         int64_t ret_ref = 0;
46318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46320         return ret_ref;
46321 }
46322
46323 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
46324         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
46325         int64_t ret_ref = 0;
46326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46328         return ret_ref;
46329 }
46330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46331         LDKChannelAnnouncement arg_conv;
46332         arg_conv.inner = untag_ptr(arg);
46333         arg_conv.is_owned = ptr_is_owned(arg);
46334         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46335         arg_conv.is_owned = false;
46336         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
46337         return ret_conv;
46338 }
46339
46340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46341         LDKChannelAnnouncement orig_conv;
46342         orig_conv.inner = untag_ptr(orig);
46343         orig_conv.is_owned = ptr_is_owned(orig);
46344         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46345         orig_conv.is_owned = false;
46346         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
46347         int64_t ret_ref = 0;
46348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46350         return ret_ref;
46351 }
46352
46353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46354         LDKChannelAnnouncement a_conv;
46355         a_conv.inner = untag_ptr(a);
46356         a_conv.is_owned = ptr_is_owned(a);
46357         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46358         a_conv.is_owned = false;
46359         LDKChannelAnnouncement b_conv;
46360         b_conv.inner = untag_ptr(b);
46361         b_conv.is_owned = ptr_is_owned(b);
46362         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46363         b_conv.is_owned = false;
46364         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
46365         return ret_conv;
46366 }
46367
46368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46369         LDKUnsignedChannelUpdate this_obj_conv;
46370         this_obj_conv.inner = untag_ptr(this_obj);
46371         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46373         UnsignedChannelUpdate_free(this_obj_conv);
46374 }
46375
46376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46377         LDKUnsignedChannelUpdate this_ptr_conv;
46378         this_ptr_conv.inner = untag_ptr(this_ptr);
46379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46381         this_ptr_conv.is_owned = false;
46382         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46383         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
46384         return ret_arr;
46385 }
46386
46387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46388         LDKUnsignedChannelUpdate this_ptr_conv;
46389         this_ptr_conv.inner = untag_ptr(this_ptr);
46390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46392         this_ptr_conv.is_owned = false;
46393         LDKThirtyTwoBytes val_ref;
46394         CHECK((*env)->GetArrayLength(env, val) == 32);
46395         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46396         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
46397 }
46398
46399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46400         LDKUnsignedChannelUpdate this_ptr_conv;
46401         this_ptr_conv.inner = untag_ptr(this_ptr);
46402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46404         this_ptr_conv.is_owned = false;
46405         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
46406         return ret_conv;
46407 }
46408
46409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46410         LDKUnsignedChannelUpdate this_ptr_conv;
46411         this_ptr_conv.inner = untag_ptr(this_ptr);
46412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46414         this_ptr_conv.is_owned = false;
46415         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
46416 }
46417
46418 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
46419         LDKUnsignedChannelUpdate this_ptr_conv;
46420         this_ptr_conv.inner = untag_ptr(this_ptr);
46421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46423         this_ptr_conv.is_owned = false;
46424         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
46425         return ret_conv;
46426 }
46427
46428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46429         LDKUnsignedChannelUpdate this_ptr_conv;
46430         this_ptr_conv.inner = untag_ptr(this_ptr);
46431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46433         this_ptr_conv.is_owned = false;
46434         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
46435 }
46436
46437 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
46438         LDKUnsignedChannelUpdate this_ptr_conv;
46439         this_ptr_conv.inner = untag_ptr(this_ptr);
46440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46442         this_ptr_conv.is_owned = false;
46443         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
46444         return ret_conv;
46445 }
46446
46447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
46448         LDKUnsignedChannelUpdate this_ptr_conv;
46449         this_ptr_conv.inner = untag_ptr(this_ptr);
46450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46452         this_ptr_conv.is_owned = false;
46453         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
46454 }
46455
46456 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
46457         LDKUnsignedChannelUpdate this_ptr_conv;
46458         this_ptr_conv.inner = untag_ptr(this_ptr);
46459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46461         this_ptr_conv.is_owned = false;
46462         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
46463         return ret_conv;
46464 }
46465
46466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46467         LDKUnsignedChannelUpdate this_ptr_conv;
46468         this_ptr_conv.inner = untag_ptr(this_ptr);
46469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46471         this_ptr_conv.is_owned = false;
46472         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
46473 }
46474
46475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46476         LDKUnsignedChannelUpdate this_ptr_conv;
46477         this_ptr_conv.inner = untag_ptr(this_ptr);
46478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46480         this_ptr_conv.is_owned = false;
46481         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
46482         return ret_conv;
46483 }
46484
46485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46486         LDKUnsignedChannelUpdate this_ptr_conv;
46487         this_ptr_conv.inner = untag_ptr(this_ptr);
46488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46490         this_ptr_conv.is_owned = false;
46491         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
46492 }
46493
46494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46495         LDKUnsignedChannelUpdate this_ptr_conv;
46496         this_ptr_conv.inner = untag_ptr(this_ptr);
46497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46499         this_ptr_conv.is_owned = false;
46500         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
46501         return ret_conv;
46502 }
46503
46504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46505         LDKUnsignedChannelUpdate this_ptr_conv;
46506         this_ptr_conv.inner = untag_ptr(this_ptr);
46507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46509         this_ptr_conv.is_owned = false;
46510         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
46511 }
46512
46513 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46514         LDKUnsignedChannelUpdate this_ptr_conv;
46515         this_ptr_conv.inner = untag_ptr(this_ptr);
46516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46518         this_ptr_conv.is_owned = false;
46519         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
46520         return ret_conv;
46521 }
46522
46523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46524         LDKUnsignedChannelUpdate this_ptr_conv;
46525         this_ptr_conv.inner = untag_ptr(this_ptr);
46526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46528         this_ptr_conv.is_owned = false;
46529         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
46530 }
46531
46532 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
46533         LDKUnsignedChannelUpdate this_ptr_conv;
46534         this_ptr_conv.inner = untag_ptr(this_ptr);
46535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46537         this_ptr_conv.is_owned = false;
46538         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
46539         return ret_conv;
46540 }
46541
46542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46543         LDKUnsignedChannelUpdate this_ptr_conv;
46544         this_ptr_conv.inner = untag_ptr(this_ptr);
46545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46547         this_ptr_conv.is_owned = false;
46548         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
46549 }
46550
46551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
46552         LDKUnsignedChannelUpdate this_ptr_conv;
46553         this_ptr_conv.inner = untag_ptr(this_ptr);
46554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46556         this_ptr_conv.is_owned = false;
46557         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
46558         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
46559         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
46560         CVec_u8Z_free(ret_var);
46561         return ret_arr;
46562 }
46563
46564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46565         LDKUnsignedChannelUpdate this_ptr_conv;
46566         this_ptr_conv.inner = untag_ptr(this_ptr);
46567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46569         this_ptr_conv.is_owned = false;
46570         LDKCVec_u8Z val_ref;
46571         val_ref.datalen = (*env)->GetArrayLength(env, val);
46572         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
46573         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
46574         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
46575 }
46576
46577 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) {
46578         LDKThirtyTwoBytes chain_hash_arg_ref;
46579         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
46580         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
46581         LDKCVec_u8Z excess_data_arg_ref;
46582         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
46583         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
46584         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
46585         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);
46586         int64_t ret_ref = 0;
46587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46589         return ret_ref;
46590 }
46591
46592 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
46593         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
46594         int64_t ret_ref = 0;
46595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46597         return ret_ref;
46598 }
46599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46600         LDKUnsignedChannelUpdate arg_conv;
46601         arg_conv.inner = untag_ptr(arg);
46602         arg_conv.is_owned = ptr_is_owned(arg);
46603         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46604         arg_conv.is_owned = false;
46605         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
46606         return ret_conv;
46607 }
46608
46609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46610         LDKUnsignedChannelUpdate orig_conv;
46611         orig_conv.inner = untag_ptr(orig);
46612         orig_conv.is_owned = ptr_is_owned(orig);
46613         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46614         orig_conv.is_owned = false;
46615         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
46616         int64_t ret_ref = 0;
46617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46619         return ret_ref;
46620 }
46621
46622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46623         LDKUnsignedChannelUpdate a_conv;
46624         a_conv.inner = untag_ptr(a);
46625         a_conv.is_owned = ptr_is_owned(a);
46626         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46627         a_conv.is_owned = false;
46628         LDKUnsignedChannelUpdate b_conv;
46629         b_conv.inner = untag_ptr(b);
46630         b_conv.is_owned = ptr_is_owned(b);
46631         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46632         b_conv.is_owned = false;
46633         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
46634         return ret_conv;
46635 }
46636
46637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46638         LDKChannelUpdate this_obj_conv;
46639         this_obj_conv.inner = untag_ptr(this_obj);
46640         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46642         ChannelUpdate_free(this_obj_conv);
46643 }
46644
46645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
46646         LDKChannelUpdate this_ptr_conv;
46647         this_ptr_conv.inner = untag_ptr(this_ptr);
46648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46650         this_ptr_conv.is_owned = false;
46651         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
46652         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
46653         return ret_arr;
46654 }
46655
46656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46657         LDKChannelUpdate this_ptr_conv;
46658         this_ptr_conv.inner = untag_ptr(this_ptr);
46659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46661         this_ptr_conv.is_owned = false;
46662         LDKSignature val_ref;
46663         CHECK((*env)->GetArrayLength(env, val) == 64);
46664         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
46665         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
46666 }
46667
46668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
46669         LDKChannelUpdate this_ptr_conv;
46670         this_ptr_conv.inner = untag_ptr(this_ptr);
46671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46673         this_ptr_conv.is_owned = false;
46674         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
46675         int64_t ret_ref = 0;
46676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46678         return ret_ref;
46679 }
46680
46681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46682         LDKChannelUpdate this_ptr_conv;
46683         this_ptr_conv.inner = untag_ptr(this_ptr);
46684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46686         this_ptr_conv.is_owned = false;
46687         LDKUnsignedChannelUpdate val_conv;
46688         val_conv.inner = untag_ptr(val);
46689         val_conv.is_owned = ptr_is_owned(val);
46690         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46691         val_conv = UnsignedChannelUpdate_clone(&val_conv);
46692         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
46693 }
46694
46695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
46696         LDKSignature signature_arg_ref;
46697         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
46698         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
46699         LDKUnsignedChannelUpdate contents_arg_conv;
46700         contents_arg_conv.inner = untag_ptr(contents_arg);
46701         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
46702         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
46703         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
46704         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
46705         int64_t ret_ref = 0;
46706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46708         return ret_ref;
46709 }
46710
46711 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
46712         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
46713         int64_t ret_ref = 0;
46714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46716         return ret_ref;
46717 }
46718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46719         LDKChannelUpdate arg_conv;
46720         arg_conv.inner = untag_ptr(arg);
46721         arg_conv.is_owned = ptr_is_owned(arg);
46722         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46723         arg_conv.is_owned = false;
46724         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
46725         return ret_conv;
46726 }
46727
46728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46729         LDKChannelUpdate orig_conv;
46730         orig_conv.inner = untag_ptr(orig);
46731         orig_conv.is_owned = ptr_is_owned(orig);
46732         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46733         orig_conv.is_owned = false;
46734         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
46735         int64_t ret_ref = 0;
46736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46738         return ret_ref;
46739 }
46740
46741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46742         LDKChannelUpdate a_conv;
46743         a_conv.inner = untag_ptr(a);
46744         a_conv.is_owned = ptr_is_owned(a);
46745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46746         a_conv.is_owned = false;
46747         LDKChannelUpdate b_conv;
46748         b_conv.inner = untag_ptr(b);
46749         b_conv.is_owned = ptr_is_owned(b);
46750         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46751         b_conv.is_owned = false;
46752         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
46753         return ret_conv;
46754 }
46755
46756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46757         LDKQueryChannelRange this_obj_conv;
46758         this_obj_conv.inner = untag_ptr(this_obj);
46759         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46761         QueryChannelRange_free(this_obj_conv);
46762 }
46763
46764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46765         LDKQueryChannelRange this_ptr_conv;
46766         this_ptr_conv.inner = untag_ptr(this_ptr);
46767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46769         this_ptr_conv.is_owned = false;
46770         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46771         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
46772         return ret_arr;
46773 }
46774
46775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46776         LDKQueryChannelRange this_ptr_conv;
46777         this_ptr_conv.inner = untag_ptr(this_ptr);
46778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46780         this_ptr_conv.is_owned = false;
46781         LDKThirtyTwoBytes val_ref;
46782         CHECK((*env)->GetArrayLength(env, val) == 32);
46783         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46784         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
46785 }
46786
46787 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
46788         LDKQueryChannelRange this_ptr_conv;
46789         this_ptr_conv.inner = untag_ptr(this_ptr);
46790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46792         this_ptr_conv.is_owned = false;
46793         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
46794         return ret_conv;
46795 }
46796
46797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46798         LDKQueryChannelRange this_ptr_conv;
46799         this_ptr_conv.inner = untag_ptr(this_ptr);
46800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46802         this_ptr_conv.is_owned = false;
46803         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
46804 }
46805
46806 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
46807         LDKQueryChannelRange this_ptr_conv;
46808         this_ptr_conv.inner = untag_ptr(this_ptr);
46809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46811         this_ptr_conv.is_owned = false;
46812         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
46813         return ret_conv;
46814 }
46815
46816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46817         LDKQueryChannelRange this_ptr_conv;
46818         this_ptr_conv.inner = untag_ptr(this_ptr);
46819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46821         this_ptr_conv.is_owned = false;
46822         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
46823 }
46824
46825 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) {
46826         LDKThirtyTwoBytes chain_hash_arg_ref;
46827         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
46828         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
46829         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
46830         int64_t ret_ref = 0;
46831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46833         return ret_ref;
46834 }
46835
46836 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
46837         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
46838         int64_t ret_ref = 0;
46839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46841         return ret_ref;
46842 }
46843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46844         LDKQueryChannelRange arg_conv;
46845         arg_conv.inner = untag_ptr(arg);
46846         arg_conv.is_owned = ptr_is_owned(arg);
46847         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46848         arg_conv.is_owned = false;
46849         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
46850         return ret_conv;
46851 }
46852
46853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46854         LDKQueryChannelRange orig_conv;
46855         orig_conv.inner = untag_ptr(orig);
46856         orig_conv.is_owned = ptr_is_owned(orig);
46857         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46858         orig_conv.is_owned = false;
46859         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
46860         int64_t ret_ref = 0;
46861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46863         return ret_ref;
46864 }
46865
46866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46867         LDKQueryChannelRange a_conv;
46868         a_conv.inner = untag_ptr(a);
46869         a_conv.is_owned = ptr_is_owned(a);
46870         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46871         a_conv.is_owned = false;
46872         LDKQueryChannelRange b_conv;
46873         b_conv.inner = untag_ptr(b);
46874         b_conv.is_owned = ptr_is_owned(b);
46875         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46876         b_conv.is_owned = false;
46877         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
46878         return ret_conv;
46879 }
46880
46881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46882         LDKReplyChannelRange this_obj_conv;
46883         this_obj_conv.inner = untag_ptr(this_obj);
46884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46886         ReplyChannelRange_free(this_obj_conv);
46887 }
46888
46889 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46890         LDKReplyChannelRange this_ptr_conv;
46891         this_ptr_conv.inner = untag_ptr(this_ptr);
46892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46894         this_ptr_conv.is_owned = false;
46895         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46896         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
46897         return ret_arr;
46898 }
46899
46900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46901         LDKReplyChannelRange this_ptr_conv;
46902         this_ptr_conv.inner = untag_ptr(this_ptr);
46903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46905         this_ptr_conv.is_owned = false;
46906         LDKThirtyTwoBytes val_ref;
46907         CHECK((*env)->GetArrayLength(env, val) == 32);
46908         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46909         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
46910 }
46911
46912 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
46913         LDKReplyChannelRange this_ptr_conv;
46914         this_ptr_conv.inner = untag_ptr(this_ptr);
46915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46917         this_ptr_conv.is_owned = false;
46918         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
46919         return ret_conv;
46920 }
46921
46922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46923         LDKReplyChannelRange this_ptr_conv;
46924         this_ptr_conv.inner = untag_ptr(this_ptr);
46925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46927         this_ptr_conv.is_owned = false;
46928         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
46929 }
46930
46931 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
46932         LDKReplyChannelRange this_ptr_conv;
46933         this_ptr_conv.inner = untag_ptr(this_ptr);
46934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46936         this_ptr_conv.is_owned = false;
46937         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
46938         return ret_conv;
46939 }
46940
46941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46942         LDKReplyChannelRange this_ptr_conv;
46943         this_ptr_conv.inner = untag_ptr(this_ptr);
46944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46946         this_ptr_conv.is_owned = false;
46947         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
46948 }
46949
46950 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
46951         LDKReplyChannelRange this_ptr_conv;
46952         this_ptr_conv.inner = untag_ptr(this_ptr);
46953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46955         this_ptr_conv.is_owned = false;
46956         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
46957         return ret_conv;
46958 }
46959
46960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
46961         LDKReplyChannelRange this_ptr_conv;
46962         this_ptr_conv.inner = untag_ptr(this_ptr);
46963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46965         this_ptr_conv.is_owned = false;
46966         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
46967 }
46968
46969 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
46970         LDKReplyChannelRange this_ptr_conv;
46971         this_ptr_conv.inner = untag_ptr(this_ptr);
46972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46974         this_ptr_conv.is_owned = false;
46975         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
46976         int64_tArray ret_arr = NULL;
46977         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
46978         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
46979         for (size_t g = 0; g < ret_var.datalen; g++) {
46980                 int64_t ret_conv_6_conv = ret_var.data[g];
46981                 ret_arr_ptr[g] = ret_conv_6_conv;
46982         }
46983         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
46984         FREE(ret_var.data);
46985         return ret_arr;
46986 }
46987
46988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
46989         LDKReplyChannelRange this_ptr_conv;
46990         this_ptr_conv.inner = untag_ptr(this_ptr);
46991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46993         this_ptr_conv.is_owned = false;
46994         LDKCVec_u64Z val_constr;
46995         val_constr.datalen = (*env)->GetArrayLength(env, val);
46996         if (val_constr.datalen > 0)
46997                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
46998         else
46999                 val_constr.data = NULL;
47000         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47001         for (size_t g = 0; g < val_constr.datalen; g++) {
47002                 int64_t val_conv_6 = val_vals[g];
47003                 val_constr.data[g] = val_conv_6;
47004         }
47005         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47006         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
47007 }
47008
47009 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) {
47010         LDKThirtyTwoBytes chain_hash_arg_ref;
47011         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47012         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47013         LDKCVec_u64Z short_channel_ids_arg_constr;
47014         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
47015         if (short_channel_ids_arg_constr.datalen > 0)
47016                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47017         else
47018                 short_channel_ids_arg_constr.data = NULL;
47019         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
47020         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
47021                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
47022                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
47023         }
47024         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
47025         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
47026         int64_t ret_ref = 0;
47027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47029         return ret_ref;
47030 }
47031
47032 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
47033         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
47034         int64_t ret_ref = 0;
47035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47037         return ret_ref;
47038 }
47039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47040         LDKReplyChannelRange arg_conv;
47041         arg_conv.inner = untag_ptr(arg);
47042         arg_conv.is_owned = ptr_is_owned(arg);
47043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47044         arg_conv.is_owned = false;
47045         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
47046         return ret_conv;
47047 }
47048
47049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47050         LDKReplyChannelRange orig_conv;
47051         orig_conv.inner = untag_ptr(orig);
47052         orig_conv.is_owned = ptr_is_owned(orig);
47053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47054         orig_conv.is_owned = false;
47055         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
47056         int64_t ret_ref = 0;
47057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47059         return ret_ref;
47060 }
47061
47062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47063         LDKReplyChannelRange a_conv;
47064         a_conv.inner = untag_ptr(a);
47065         a_conv.is_owned = ptr_is_owned(a);
47066         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47067         a_conv.is_owned = false;
47068         LDKReplyChannelRange b_conv;
47069         b_conv.inner = untag_ptr(b);
47070         b_conv.is_owned = ptr_is_owned(b);
47071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47072         b_conv.is_owned = false;
47073         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
47074         return ret_conv;
47075 }
47076
47077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47078         LDKQueryShortChannelIds this_obj_conv;
47079         this_obj_conv.inner = untag_ptr(this_obj);
47080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47082         QueryShortChannelIds_free(this_obj_conv);
47083 }
47084
47085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
47086         LDKQueryShortChannelIds this_ptr_conv;
47087         this_ptr_conv.inner = untag_ptr(this_ptr);
47088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47090         this_ptr_conv.is_owned = false;
47091         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47092         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
47093         return ret_arr;
47094 }
47095
47096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47097         LDKQueryShortChannelIds this_ptr_conv;
47098         this_ptr_conv.inner = untag_ptr(this_ptr);
47099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47101         this_ptr_conv.is_owned = false;
47102         LDKThirtyTwoBytes val_ref;
47103         CHECK((*env)->GetArrayLength(env, val) == 32);
47104         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47105         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
47106 }
47107
47108 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
47109         LDKQueryShortChannelIds this_ptr_conv;
47110         this_ptr_conv.inner = untag_ptr(this_ptr);
47111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47113         this_ptr_conv.is_owned = false;
47114         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
47115         int64_tArray ret_arr = NULL;
47116         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47117         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47118         for (size_t g = 0; g < ret_var.datalen; g++) {
47119                 int64_t ret_conv_6_conv = ret_var.data[g];
47120                 ret_arr_ptr[g] = ret_conv_6_conv;
47121         }
47122         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47123         FREE(ret_var.data);
47124         return ret_arr;
47125 }
47126
47127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47128         LDKQueryShortChannelIds this_ptr_conv;
47129         this_ptr_conv.inner = untag_ptr(this_ptr);
47130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47132         this_ptr_conv.is_owned = false;
47133         LDKCVec_u64Z val_constr;
47134         val_constr.datalen = (*env)->GetArrayLength(env, val);
47135         if (val_constr.datalen > 0)
47136                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47137         else
47138                 val_constr.data = NULL;
47139         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47140         for (size_t g = 0; g < val_constr.datalen; g++) {
47141                 int64_t val_conv_6 = val_vals[g];
47142                 val_constr.data[g] = val_conv_6;
47143         }
47144         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47145         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
47146 }
47147
47148 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) {
47149         LDKThirtyTwoBytes chain_hash_arg_ref;
47150         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47151         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47152         LDKCVec_u64Z short_channel_ids_arg_constr;
47153         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
47154         if (short_channel_ids_arg_constr.datalen > 0)
47155                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
47156         else
47157                 short_channel_ids_arg_constr.data = NULL;
47158         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
47159         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
47160                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
47161                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
47162         }
47163         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
47164         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
47165         int64_t ret_ref = 0;
47166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47168         return ret_ref;
47169 }
47170
47171 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
47172         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
47173         int64_t ret_ref = 0;
47174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47176         return ret_ref;
47177 }
47178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47179         LDKQueryShortChannelIds arg_conv;
47180         arg_conv.inner = untag_ptr(arg);
47181         arg_conv.is_owned = ptr_is_owned(arg);
47182         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47183         arg_conv.is_owned = false;
47184         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
47185         return ret_conv;
47186 }
47187
47188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47189         LDKQueryShortChannelIds orig_conv;
47190         orig_conv.inner = untag_ptr(orig);
47191         orig_conv.is_owned = ptr_is_owned(orig);
47192         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47193         orig_conv.is_owned = false;
47194         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
47195         int64_t ret_ref = 0;
47196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47198         return ret_ref;
47199 }
47200
47201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47202         LDKQueryShortChannelIds a_conv;
47203         a_conv.inner = untag_ptr(a);
47204         a_conv.is_owned = ptr_is_owned(a);
47205         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47206         a_conv.is_owned = false;
47207         LDKQueryShortChannelIds b_conv;
47208         b_conv.inner = untag_ptr(b);
47209         b_conv.is_owned = ptr_is_owned(b);
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47211         b_conv.is_owned = false;
47212         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
47213         return ret_conv;
47214 }
47215
47216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47217         LDKReplyShortChannelIdsEnd this_obj_conv;
47218         this_obj_conv.inner = untag_ptr(this_obj);
47219         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47221         ReplyShortChannelIdsEnd_free(this_obj_conv);
47222 }
47223
47224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
47225         LDKReplyShortChannelIdsEnd this_ptr_conv;
47226         this_ptr_conv.inner = untag_ptr(this_ptr);
47227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47229         this_ptr_conv.is_owned = false;
47230         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47231         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
47232         return ret_arr;
47233 }
47234
47235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47236         LDKReplyShortChannelIdsEnd this_ptr_conv;
47237         this_ptr_conv.inner = untag_ptr(this_ptr);
47238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47240         this_ptr_conv.is_owned = false;
47241         LDKThirtyTwoBytes val_ref;
47242         CHECK((*env)->GetArrayLength(env, val) == 32);
47243         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47244         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
47245 }
47246
47247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
47248         LDKReplyShortChannelIdsEnd this_ptr_conv;
47249         this_ptr_conv.inner = untag_ptr(this_ptr);
47250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47252         this_ptr_conv.is_owned = false;
47253         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
47254         return ret_conv;
47255 }
47256
47257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47258         LDKReplyShortChannelIdsEnd this_ptr_conv;
47259         this_ptr_conv.inner = untag_ptr(this_ptr);
47260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47262         this_ptr_conv.is_owned = false;
47263         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
47264 }
47265
47266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
47267         LDKThirtyTwoBytes chain_hash_arg_ref;
47268         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47269         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47270         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
47271         int64_t ret_ref = 0;
47272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47274         return ret_ref;
47275 }
47276
47277 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
47278         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
47279         int64_t ret_ref = 0;
47280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47282         return ret_ref;
47283 }
47284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47285         LDKReplyShortChannelIdsEnd arg_conv;
47286         arg_conv.inner = untag_ptr(arg);
47287         arg_conv.is_owned = ptr_is_owned(arg);
47288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47289         arg_conv.is_owned = false;
47290         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
47291         return ret_conv;
47292 }
47293
47294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47295         LDKReplyShortChannelIdsEnd orig_conv;
47296         orig_conv.inner = untag_ptr(orig);
47297         orig_conv.is_owned = ptr_is_owned(orig);
47298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47299         orig_conv.is_owned = false;
47300         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
47301         int64_t ret_ref = 0;
47302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47304         return ret_ref;
47305 }
47306
47307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47308         LDKReplyShortChannelIdsEnd a_conv;
47309         a_conv.inner = untag_ptr(a);
47310         a_conv.is_owned = ptr_is_owned(a);
47311         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47312         a_conv.is_owned = false;
47313         LDKReplyShortChannelIdsEnd b_conv;
47314         b_conv.inner = untag_ptr(b);
47315         b_conv.is_owned = ptr_is_owned(b);
47316         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47317         b_conv.is_owned = false;
47318         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
47319         return ret_conv;
47320 }
47321
47322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47323         LDKGossipTimestampFilter this_obj_conv;
47324         this_obj_conv.inner = untag_ptr(this_obj);
47325         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47327         GossipTimestampFilter_free(this_obj_conv);
47328 }
47329
47330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
47331         LDKGossipTimestampFilter this_ptr_conv;
47332         this_ptr_conv.inner = untag_ptr(this_ptr);
47333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47335         this_ptr_conv.is_owned = false;
47336         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
47337         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
47338         return ret_arr;
47339 }
47340
47341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47342         LDKGossipTimestampFilter this_ptr_conv;
47343         this_ptr_conv.inner = untag_ptr(this_ptr);
47344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47346         this_ptr_conv.is_owned = false;
47347         LDKThirtyTwoBytes val_ref;
47348         CHECK((*env)->GetArrayLength(env, val) == 32);
47349         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
47350         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
47351 }
47352
47353 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
47354         LDKGossipTimestampFilter this_ptr_conv;
47355         this_ptr_conv.inner = untag_ptr(this_ptr);
47356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47358         this_ptr_conv.is_owned = false;
47359         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
47360         return ret_conv;
47361 }
47362
47363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47364         LDKGossipTimestampFilter this_ptr_conv;
47365         this_ptr_conv.inner = untag_ptr(this_ptr);
47366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47368         this_ptr_conv.is_owned = false;
47369         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
47370 }
47371
47372 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
47373         LDKGossipTimestampFilter this_ptr_conv;
47374         this_ptr_conv.inner = untag_ptr(this_ptr);
47375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47377         this_ptr_conv.is_owned = false;
47378         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
47379         return ret_conv;
47380 }
47381
47382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
47383         LDKGossipTimestampFilter this_ptr_conv;
47384         this_ptr_conv.inner = untag_ptr(this_ptr);
47385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47387         this_ptr_conv.is_owned = false;
47388         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
47389 }
47390
47391 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) {
47392         LDKThirtyTwoBytes chain_hash_arg_ref;
47393         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
47394         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
47395         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
47396         int64_t ret_ref = 0;
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47399         return ret_ref;
47400 }
47401
47402 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
47403         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
47404         int64_t ret_ref = 0;
47405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47407         return ret_ref;
47408 }
47409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47410         LDKGossipTimestampFilter arg_conv;
47411         arg_conv.inner = untag_ptr(arg);
47412         arg_conv.is_owned = ptr_is_owned(arg);
47413         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47414         arg_conv.is_owned = false;
47415         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
47416         return ret_conv;
47417 }
47418
47419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47420         LDKGossipTimestampFilter orig_conv;
47421         orig_conv.inner = untag_ptr(orig);
47422         orig_conv.is_owned = ptr_is_owned(orig);
47423         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47424         orig_conv.is_owned = false;
47425         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
47426         int64_t ret_ref = 0;
47427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47429         return ret_ref;
47430 }
47431
47432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47433         LDKGossipTimestampFilter a_conv;
47434         a_conv.inner = untag_ptr(a);
47435         a_conv.is_owned = ptr_is_owned(a);
47436         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47437         a_conv.is_owned = false;
47438         LDKGossipTimestampFilter b_conv;
47439         b_conv.inner = untag_ptr(b);
47440         b_conv.is_owned = ptr_is_owned(b);
47441         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47442         b_conv.is_owned = false;
47443         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
47444         return ret_conv;
47445 }
47446
47447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47448         if (!ptr_is_owned(this_ptr)) return;
47449         void* this_ptr_ptr = untag_ptr(this_ptr);
47450         CHECK_ACCESS(this_ptr_ptr);
47451         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
47452         FREE(untag_ptr(this_ptr));
47453         ErrorAction_free(this_ptr_conv);
47454 }
47455
47456 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
47457         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47458         *ret_copy = ErrorAction_clone(arg);
47459         int64_t ret_ref = tag_ptr(ret_copy, true);
47460         return ret_ref;
47461 }
47462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47463         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
47464         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
47465         return ret_conv;
47466 }
47467
47468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47469         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
47470         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47471         *ret_copy = ErrorAction_clone(orig_conv);
47472         int64_t ret_ref = tag_ptr(ret_copy, true);
47473         return ret_ref;
47474 }
47475
47476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
47477         LDKErrorMessage msg_conv;
47478         msg_conv.inner = untag_ptr(msg);
47479         msg_conv.is_owned = ptr_is_owned(msg);
47480         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
47481         msg_conv = ErrorMessage_clone(&msg_conv);
47482         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47483         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
47484         int64_t ret_ref = tag_ptr(ret_copy, true);
47485         return ret_ref;
47486 }
47487
47488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
47489         LDKWarningMessage msg_conv;
47490         msg_conv.inner = untag_ptr(msg);
47491         msg_conv.is_owned = ptr_is_owned(msg);
47492         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
47493         msg_conv = WarningMessage_clone(&msg_conv);
47494         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47495         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
47496         int64_t ret_ref = tag_ptr(ret_copy, true);
47497         return ret_ref;
47498 }
47499
47500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
47501         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47502         *ret_copy = ErrorAction_ignore_error();
47503         int64_t ret_ref = tag_ptr(ret_copy, true);
47504         return ret_ref;
47505 }
47506
47507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
47508         LDKLevel a_conv = LDKLevel_from_java(env, a);
47509         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47510         *ret_copy = ErrorAction_ignore_and_log(a_conv);
47511         int64_t ret_ref = tag_ptr(ret_copy, true);
47512         return ret_ref;
47513 }
47514
47515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
47516         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47517         *ret_copy = ErrorAction_ignore_duplicate_gossip();
47518         int64_t ret_ref = tag_ptr(ret_copy, true);
47519         return ret_ref;
47520 }
47521
47522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
47523         LDKErrorMessage msg_conv;
47524         msg_conv.inner = untag_ptr(msg);
47525         msg_conv.is_owned = ptr_is_owned(msg);
47526         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
47527         msg_conv = ErrorMessage_clone(&msg_conv);
47528         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47529         *ret_copy = ErrorAction_send_error_message(msg_conv);
47530         int64_t ret_ref = tag_ptr(ret_copy, true);
47531         return ret_ref;
47532 }
47533
47534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
47535         LDKWarningMessage msg_conv;
47536         msg_conv.inner = untag_ptr(msg);
47537         msg_conv.is_owned = ptr_is_owned(msg);
47538         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
47539         msg_conv = WarningMessage_clone(&msg_conv);
47540         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
47541         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47542         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
47543         int64_t ret_ref = tag_ptr(ret_copy, true);
47544         return ret_ref;
47545 }
47546
47547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47548         LDKLightningError this_obj_conv;
47549         this_obj_conv.inner = untag_ptr(this_obj);
47550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47552         LightningError_free(this_obj_conv);
47553 }
47554
47555 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
47556         LDKLightningError this_ptr_conv;
47557         this_ptr_conv.inner = untag_ptr(this_ptr);
47558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47560         this_ptr_conv.is_owned = false;
47561         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
47562         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
47563         Str_free(ret_str);
47564         return ret_conv;
47565 }
47566
47567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
47568         LDKLightningError this_ptr_conv;
47569         this_ptr_conv.inner = untag_ptr(this_ptr);
47570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47572         this_ptr_conv.is_owned = false;
47573         LDKStr val_conv = java_to_owned_str(env, val);
47574         LightningError_set_err(&this_ptr_conv, val_conv);
47575 }
47576
47577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
47578         LDKLightningError this_ptr_conv;
47579         this_ptr_conv.inner = untag_ptr(this_ptr);
47580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47582         this_ptr_conv.is_owned = false;
47583         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
47584         *ret_copy = LightningError_get_action(&this_ptr_conv);
47585         int64_t ret_ref = tag_ptr(ret_copy, true);
47586         return ret_ref;
47587 }
47588
47589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47590         LDKLightningError this_ptr_conv;
47591         this_ptr_conv.inner = untag_ptr(this_ptr);
47592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47594         this_ptr_conv.is_owned = false;
47595         void* val_ptr = untag_ptr(val);
47596         CHECK_ACCESS(val_ptr);
47597         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
47598         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
47599         LightningError_set_action(&this_ptr_conv, val_conv);
47600 }
47601
47602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
47603         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
47604         void* action_arg_ptr = untag_ptr(action_arg);
47605         CHECK_ACCESS(action_arg_ptr);
47606         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
47607         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
47608         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
47609         int64_t ret_ref = 0;
47610         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47611         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47612         return ret_ref;
47613 }
47614
47615 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
47616         LDKLightningError ret_var = LightningError_clone(arg);
47617         int64_t ret_ref = 0;
47618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47620         return ret_ref;
47621 }
47622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47623         LDKLightningError arg_conv;
47624         arg_conv.inner = untag_ptr(arg);
47625         arg_conv.is_owned = ptr_is_owned(arg);
47626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47627         arg_conv.is_owned = false;
47628         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
47629         return ret_conv;
47630 }
47631
47632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47633         LDKLightningError orig_conv;
47634         orig_conv.inner = untag_ptr(orig);
47635         orig_conv.is_owned = ptr_is_owned(orig);
47636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47637         orig_conv.is_owned = false;
47638         LDKLightningError ret_var = LightningError_clone(&orig_conv);
47639         int64_t ret_ref = 0;
47640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47642         return ret_ref;
47643 }
47644
47645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47646         LDKCommitmentUpdate this_obj_conv;
47647         this_obj_conv.inner = untag_ptr(this_obj);
47648         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47650         CommitmentUpdate_free(this_obj_conv);
47651 }
47652
47653 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47654         LDKCommitmentUpdate this_ptr_conv;
47655         this_ptr_conv.inner = untag_ptr(this_ptr);
47656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47658         this_ptr_conv.is_owned = false;
47659         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
47660         int64_tArray ret_arr = NULL;
47661         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47662         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47663         for (size_t p = 0; p < ret_var.datalen; p++) {
47664                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
47665                 int64_t ret_conv_15_ref = 0;
47666                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
47667                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
47668                 ret_arr_ptr[p] = ret_conv_15_ref;
47669         }
47670         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47671         FREE(ret_var.data);
47672         return ret_arr;
47673 }
47674
47675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47676         LDKCommitmentUpdate this_ptr_conv;
47677         this_ptr_conv.inner = untag_ptr(this_ptr);
47678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47680         this_ptr_conv.is_owned = false;
47681         LDKCVec_UpdateAddHTLCZ val_constr;
47682         val_constr.datalen = (*env)->GetArrayLength(env, val);
47683         if (val_constr.datalen > 0)
47684                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
47685         else
47686                 val_constr.data = NULL;
47687         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47688         for (size_t p = 0; p < val_constr.datalen; p++) {
47689                 int64_t val_conv_15 = val_vals[p];
47690                 LDKUpdateAddHTLC val_conv_15_conv;
47691                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
47692                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
47693                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
47694                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
47695                 val_constr.data[p] = val_conv_15_conv;
47696         }
47697         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47698         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
47699 }
47700
47701 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47702         LDKCommitmentUpdate this_ptr_conv;
47703         this_ptr_conv.inner = untag_ptr(this_ptr);
47704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47706         this_ptr_conv.is_owned = false;
47707         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
47708         int64_tArray ret_arr = NULL;
47709         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47710         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47711         for (size_t t = 0; t < ret_var.datalen; t++) {
47712                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
47713                 int64_t ret_conv_19_ref = 0;
47714                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
47715                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
47716                 ret_arr_ptr[t] = ret_conv_19_ref;
47717         }
47718         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47719         FREE(ret_var.data);
47720         return ret_arr;
47721 }
47722
47723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47724         LDKCommitmentUpdate this_ptr_conv;
47725         this_ptr_conv.inner = untag_ptr(this_ptr);
47726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47728         this_ptr_conv.is_owned = false;
47729         LDKCVec_UpdateFulfillHTLCZ val_constr;
47730         val_constr.datalen = (*env)->GetArrayLength(env, val);
47731         if (val_constr.datalen > 0)
47732                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
47733         else
47734                 val_constr.data = NULL;
47735         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47736         for (size_t t = 0; t < val_constr.datalen; t++) {
47737                 int64_t val_conv_19 = val_vals[t];
47738                 LDKUpdateFulfillHTLC val_conv_19_conv;
47739                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
47740                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
47741                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
47742                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
47743                 val_constr.data[t] = val_conv_19_conv;
47744         }
47745         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47746         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
47747 }
47748
47749 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47750         LDKCommitmentUpdate this_ptr_conv;
47751         this_ptr_conv.inner = untag_ptr(this_ptr);
47752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47754         this_ptr_conv.is_owned = false;
47755         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
47756         int64_tArray ret_arr = NULL;
47757         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47758         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47759         for (size_t q = 0; q < ret_var.datalen; q++) {
47760                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
47761                 int64_t ret_conv_16_ref = 0;
47762                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47763                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47764                 ret_arr_ptr[q] = ret_conv_16_ref;
47765         }
47766         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47767         FREE(ret_var.data);
47768         return ret_arr;
47769 }
47770
47771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47772         LDKCommitmentUpdate this_ptr_conv;
47773         this_ptr_conv.inner = untag_ptr(this_ptr);
47774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47776         this_ptr_conv.is_owned = false;
47777         LDKCVec_UpdateFailHTLCZ val_constr;
47778         val_constr.datalen = (*env)->GetArrayLength(env, val);
47779         if (val_constr.datalen > 0)
47780                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
47781         else
47782                 val_constr.data = NULL;
47783         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47784         for (size_t q = 0; q < val_constr.datalen; q++) {
47785                 int64_t val_conv_16 = val_vals[q];
47786                 LDKUpdateFailHTLC val_conv_16_conv;
47787                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
47788                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
47789                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
47790                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
47791                 val_constr.data[q] = val_conv_16_conv;
47792         }
47793         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47794         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
47795 }
47796
47797 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
47798         LDKCommitmentUpdate this_ptr_conv;
47799         this_ptr_conv.inner = untag_ptr(this_ptr);
47800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47802         this_ptr_conv.is_owned = false;
47803         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
47804         int64_tArray ret_arr = NULL;
47805         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47806         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47807         for (size_t z = 0; z < ret_var.datalen; z++) {
47808                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
47809                 int64_t ret_conv_25_ref = 0;
47810                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
47811                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
47812                 ret_arr_ptr[z] = ret_conv_25_ref;
47813         }
47814         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47815         FREE(ret_var.data);
47816         return ret_arr;
47817 }
47818
47819 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) {
47820         LDKCommitmentUpdate this_ptr_conv;
47821         this_ptr_conv.inner = untag_ptr(this_ptr);
47822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47824         this_ptr_conv.is_owned = false;
47825         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
47826         val_constr.datalen = (*env)->GetArrayLength(env, val);
47827         if (val_constr.datalen > 0)
47828                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
47829         else
47830                 val_constr.data = NULL;
47831         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47832         for (size_t z = 0; z < val_constr.datalen; z++) {
47833                 int64_t val_conv_25 = val_vals[z];
47834                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
47835                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
47836                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
47837                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
47838                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
47839                 val_constr.data[z] = val_conv_25_conv;
47840         }
47841         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47842         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
47843 }
47844
47845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
47846         LDKCommitmentUpdate this_ptr_conv;
47847         this_ptr_conv.inner = untag_ptr(this_ptr);
47848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47850         this_ptr_conv.is_owned = false;
47851         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
47852         int64_t ret_ref = 0;
47853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47855         return ret_ref;
47856 }
47857
47858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47859         LDKCommitmentUpdate this_ptr_conv;
47860         this_ptr_conv.inner = untag_ptr(this_ptr);
47861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47863         this_ptr_conv.is_owned = false;
47864         LDKUpdateFee val_conv;
47865         val_conv.inner = untag_ptr(val);
47866         val_conv.is_owned = ptr_is_owned(val);
47867         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47868         val_conv = UpdateFee_clone(&val_conv);
47869         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
47870 }
47871
47872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
47873         LDKCommitmentUpdate this_ptr_conv;
47874         this_ptr_conv.inner = untag_ptr(this_ptr);
47875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47877         this_ptr_conv.is_owned = false;
47878         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
47879         int64_t ret_ref = 0;
47880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47882         return ret_ref;
47883 }
47884
47885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47886         LDKCommitmentUpdate this_ptr_conv;
47887         this_ptr_conv.inner = untag_ptr(this_ptr);
47888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47890         this_ptr_conv.is_owned = false;
47891         LDKCommitmentSigned val_conv;
47892         val_conv.inner = untag_ptr(val);
47893         val_conv.is_owned = ptr_is_owned(val);
47894         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47895         val_conv = CommitmentSigned_clone(&val_conv);
47896         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
47897 }
47898
47899 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) {
47900         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
47901         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
47902         if (update_add_htlcs_arg_constr.datalen > 0)
47903                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
47904         else
47905                 update_add_htlcs_arg_constr.data = NULL;
47906         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
47907         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
47908                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
47909                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
47910                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
47911                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
47912                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
47913                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
47914                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
47915         }
47916         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
47917         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
47918         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
47919         if (update_fulfill_htlcs_arg_constr.datalen > 0)
47920                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
47921         else
47922                 update_fulfill_htlcs_arg_constr.data = NULL;
47923         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
47924         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
47925                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
47926                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
47927                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
47928                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
47929                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
47930                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
47931                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
47932         }
47933         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
47934         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
47935         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
47936         if (update_fail_htlcs_arg_constr.datalen > 0)
47937                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
47938         else
47939                 update_fail_htlcs_arg_constr.data = NULL;
47940         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
47941         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
47942                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
47943                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
47944                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
47945                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
47946                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
47947                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
47948                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
47949         }
47950         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
47951         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
47952         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
47953         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
47954                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
47955         else
47956                 update_fail_malformed_htlcs_arg_constr.data = NULL;
47957         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
47958         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
47959                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
47960                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
47961                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
47962                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
47963                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
47964                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
47965                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
47966         }
47967         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
47968         LDKUpdateFee update_fee_arg_conv;
47969         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
47970         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
47971         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
47972         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
47973         LDKCommitmentSigned commitment_signed_arg_conv;
47974         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
47975         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
47976         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
47977         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
47978         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);
47979         int64_t ret_ref = 0;
47980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47982         return ret_ref;
47983 }
47984
47985 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
47986         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
47987         int64_t ret_ref = 0;
47988         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47989         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47990         return ret_ref;
47991 }
47992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47993         LDKCommitmentUpdate arg_conv;
47994         arg_conv.inner = untag_ptr(arg);
47995         arg_conv.is_owned = ptr_is_owned(arg);
47996         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47997         arg_conv.is_owned = false;
47998         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
47999         return ret_conv;
48000 }
48001
48002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
48003         LDKCommitmentUpdate orig_conv;
48004         orig_conv.inner = untag_ptr(orig);
48005         orig_conv.is_owned = ptr_is_owned(orig);
48006         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
48007         orig_conv.is_owned = false;
48008         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
48009         int64_t ret_ref = 0;
48010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48012         return ret_ref;
48013 }
48014
48015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
48016         LDKCommitmentUpdate a_conv;
48017         a_conv.inner = untag_ptr(a);
48018         a_conv.is_owned = ptr_is_owned(a);
48019         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48020         a_conv.is_owned = false;
48021         LDKCommitmentUpdate b_conv;
48022         b_conv.inner = untag_ptr(b);
48023         b_conv.is_owned = ptr_is_owned(b);
48024         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
48025         b_conv.is_owned = false;
48026         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
48027         return ret_conv;
48028 }
48029
48030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48031         if (!ptr_is_owned(this_ptr)) return;
48032         void* this_ptr_ptr = untag_ptr(this_ptr);
48033         CHECK_ACCESS(this_ptr_ptr);
48034         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
48035         FREE(untag_ptr(this_ptr));
48036         ChannelMessageHandler_free(this_ptr_conv);
48037 }
48038
48039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48040         if (!ptr_is_owned(this_ptr)) return;
48041         void* this_ptr_ptr = untag_ptr(this_ptr);
48042         CHECK_ACCESS(this_ptr_ptr);
48043         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
48044         FREE(untag_ptr(this_ptr));
48045         RoutingMessageHandler_free(this_ptr_conv);
48046 }
48047
48048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
48049         if (!ptr_is_owned(this_ptr)) return;
48050         void* this_ptr_ptr = untag_ptr(this_ptr);
48051         CHECK_ACCESS(this_ptr_ptr);
48052         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
48053         FREE(untag_ptr(this_ptr));
48054         OnionMessageHandler_free(this_ptr_conv);
48055 }
48056
48057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
48058         LDKAcceptChannel obj_conv;
48059         obj_conv.inner = untag_ptr(obj);
48060         obj_conv.is_owned = ptr_is_owned(obj);
48061         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48062         obj_conv.is_owned = false;
48063         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
48064         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48065         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48066         CVec_u8Z_free(ret_var);
48067         return ret_arr;
48068 }
48069
48070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48071         LDKu8slice ser_ref;
48072         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48073         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48074         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
48075         *ret_conv = AcceptChannel_read(ser_ref);
48076         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48077         return tag_ptr(ret_conv, true);
48078 }
48079
48080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
48081         LDKAcceptChannelV2 obj_conv;
48082         obj_conv.inner = untag_ptr(obj);
48083         obj_conv.is_owned = ptr_is_owned(obj);
48084         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48085         obj_conv.is_owned = false;
48086         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
48087         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48088         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48089         CVec_u8Z_free(ret_var);
48090         return ret_arr;
48091 }
48092
48093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48094         LDKu8slice ser_ref;
48095         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48096         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48097         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
48098         *ret_conv = AcceptChannelV2_read(ser_ref);
48099         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48100         return tag_ptr(ret_conv, true);
48101 }
48102
48103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
48104         LDKTxAddInput obj_conv;
48105         obj_conv.inner = untag_ptr(obj);
48106         obj_conv.is_owned = ptr_is_owned(obj);
48107         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48108         obj_conv.is_owned = false;
48109         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
48110         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48111         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48112         CVec_u8Z_free(ret_var);
48113         return ret_arr;
48114 }
48115
48116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48117         LDKu8slice ser_ref;
48118         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48119         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48120         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
48121         *ret_conv = TxAddInput_read(ser_ref);
48122         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48123         return tag_ptr(ret_conv, true);
48124 }
48125
48126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
48127         LDKTxAddOutput obj_conv;
48128         obj_conv.inner = untag_ptr(obj);
48129         obj_conv.is_owned = ptr_is_owned(obj);
48130         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48131         obj_conv.is_owned = false;
48132         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
48133         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48134         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48135         CVec_u8Z_free(ret_var);
48136         return ret_arr;
48137 }
48138
48139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48140         LDKu8slice ser_ref;
48141         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48142         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48143         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
48144         *ret_conv = TxAddOutput_read(ser_ref);
48145         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48146         return tag_ptr(ret_conv, true);
48147 }
48148
48149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
48150         LDKTxRemoveInput obj_conv;
48151         obj_conv.inner = untag_ptr(obj);
48152         obj_conv.is_owned = ptr_is_owned(obj);
48153         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48154         obj_conv.is_owned = false;
48155         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
48156         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48157         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48158         CVec_u8Z_free(ret_var);
48159         return ret_arr;
48160 }
48161
48162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48163         LDKu8slice ser_ref;
48164         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48165         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48166         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
48167         *ret_conv = TxRemoveInput_read(ser_ref);
48168         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48169         return tag_ptr(ret_conv, true);
48170 }
48171
48172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
48173         LDKTxRemoveOutput obj_conv;
48174         obj_conv.inner = untag_ptr(obj);
48175         obj_conv.is_owned = ptr_is_owned(obj);
48176         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48177         obj_conv.is_owned = false;
48178         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
48179         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48180         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48181         CVec_u8Z_free(ret_var);
48182         return ret_arr;
48183 }
48184
48185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48186         LDKu8slice ser_ref;
48187         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48188         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48189         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
48190         *ret_conv = TxRemoveOutput_read(ser_ref);
48191         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48192         return tag_ptr(ret_conv, true);
48193 }
48194
48195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
48196         LDKTxComplete obj_conv;
48197         obj_conv.inner = untag_ptr(obj);
48198         obj_conv.is_owned = ptr_is_owned(obj);
48199         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48200         obj_conv.is_owned = false;
48201         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
48202         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48203         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48204         CVec_u8Z_free(ret_var);
48205         return ret_arr;
48206 }
48207
48208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48209         LDKu8slice ser_ref;
48210         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48211         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48212         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
48213         *ret_conv = TxComplete_read(ser_ref);
48214         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48215         return tag_ptr(ret_conv, true);
48216 }
48217
48218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
48219         LDKTxSignatures obj_conv;
48220         obj_conv.inner = untag_ptr(obj);
48221         obj_conv.is_owned = ptr_is_owned(obj);
48222         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48223         obj_conv.is_owned = false;
48224         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
48225         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48226         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48227         CVec_u8Z_free(ret_var);
48228         return ret_arr;
48229 }
48230
48231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48232         LDKu8slice ser_ref;
48233         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48234         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48235         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
48236         *ret_conv = TxSignatures_read(ser_ref);
48237         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48238         return tag_ptr(ret_conv, true);
48239 }
48240
48241 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
48242         LDKTxInitRbf obj_conv;
48243         obj_conv.inner = untag_ptr(obj);
48244         obj_conv.is_owned = ptr_is_owned(obj);
48245         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48246         obj_conv.is_owned = false;
48247         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
48248         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48249         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48250         CVec_u8Z_free(ret_var);
48251         return ret_arr;
48252 }
48253
48254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48255         LDKu8slice ser_ref;
48256         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48257         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48258         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
48259         *ret_conv = TxInitRbf_read(ser_ref);
48260         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48261         return tag_ptr(ret_conv, true);
48262 }
48263
48264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
48265         LDKTxAckRbf obj_conv;
48266         obj_conv.inner = untag_ptr(obj);
48267         obj_conv.is_owned = ptr_is_owned(obj);
48268         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48269         obj_conv.is_owned = false;
48270         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
48271         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48272         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48273         CVec_u8Z_free(ret_var);
48274         return ret_arr;
48275 }
48276
48277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48278         LDKu8slice ser_ref;
48279         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48280         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48281         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
48282         *ret_conv = TxAckRbf_read(ser_ref);
48283         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48284         return tag_ptr(ret_conv, true);
48285 }
48286
48287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
48288         LDKTxAbort obj_conv;
48289         obj_conv.inner = untag_ptr(obj);
48290         obj_conv.is_owned = ptr_is_owned(obj);
48291         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48292         obj_conv.is_owned = false;
48293         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
48294         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48295         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48296         CVec_u8Z_free(ret_var);
48297         return ret_arr;
48298 }
48299
48300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48301         LDKu8slice ser_ref;
48302         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48303         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48304         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
48305         *ret_conv = TxAbort_read(ser_ref);
48306         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48307         return tag_ptr(ret_conv, true);
48308 }
48309
48310 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
48311         LDKAnnouncementSignatures obj_conv;
48312         obj_conv.inner = untag_ptr(obj);
48313         obj_conv.is_owned = ptr_is_owned(obj);
48314         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48315         obj_conv.is_owned = false;
48316         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
48317         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48318         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48319         CVec_u8Z_free(ret_var);
48320         return ret_arr;
48321 }
48322
48323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48324         LDKu8slice ser_ref;
48325         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48326         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48327         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
48328         *ret_conv = AnnouncementSignatures_read(ser_ref);
48329         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48330         return tag_ptr(ret_conv, true);
48331 }
48332
48333 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
48334         LDKChannelReestablish obj_conv;
48335         obj_conv.inner = untag_ptr(obj);
48336         obj_conv.is_owned = ptr_is_owned(obj);
48337         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48338         obj_conv.is_owned = false;
48339         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
48340         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48341         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48342         CVec_u8Z_free(ret_var);
48343         return ret_arr;
48344 }
48345
48346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48347         LDKu8slice ser_ref;
48348         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48349         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48350         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
48351         *ret_conv = ChannelReestablish_read(ser_ref);
48352         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48353         return tag_ptr(ret_conv, true);
48354 }
48355
48356 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
48357         LDKClosingSigned obj_conv;
48358         obj_conv.inner = untag_ptr(obj);
48359         obj_conv.is_owned = ptr_is_owned(obj);
48360         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48361         obj_conv.is_owned = false;
48362         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
48363         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48364         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48365         CVec_u8Z_free(ret_var);
48366         return ret_arr;
48367 }
48368
48369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48370         LDKu8slice ser_ref;
48371         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48372         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48373         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
48374         *ret_conv = ClosingSigned_read(ser_ref);
48375         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48376         return tag_ptr(ret_conv, true);
48377 }
48378
48379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
48380         LDKClosingSignedFeeRange obj_conv;
48381         obj_conv.inner = untag_ptr(obj);
48382         obj_conv.is_owned = ptr_is_owned(obj);
48383         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48384         obj_conv.is_owned = false;
48385         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
48386         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48387         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48388         CVec_u8Z_free(ret_var);
48389         return ret_arr;
48390 }
48391
48392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48393         LDKu8slice ser_ref;
48394         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48395         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48396         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
48397         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
48398         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48399         return tag_ptr(ret_conv, true);
48400 }
48401
48402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
48403         LDKCommitmentSigned obj_conv;
48404         obj_conv.inner = untag_ptr(obj);
48405         obj_conv.is_owned = ptr_is_owned(obj);
48406         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48407         obj_conv.is_owned = false;
48408         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
48409         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48410         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48411         CVec_u8Z_free(ret_var);
48412         return ret_arr;
48413 }
48414
48415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48416         LDKu8slice ser_ref;
48417         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48418         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48419         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
48420         *ret_conv = CommitmentSigned_read(ser_ref);
48421         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48422         return tag_ptr(ret_conv, true);
48423 }
48424
48425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
48426         LDKFundingCreated obj_conv;
48427         obj_conv.inner = untag_ptr(obj);
48428         obj_conv.is_owned = ptr_is_owned(obj);
48429         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48430         obj_conv.is_owned = false;
48431         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
48432         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48433         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48434         CVec_u8Z_free(ret_var);
48435         return ret_arr;
48436 }
48437
48438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48439         LDKu8slice ser_ref;
48440         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48441         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48442         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
48443         *ret_conv = FundingCreated_read(ser_ref);
48444         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48445         return tag_ptr(ret_conv, true);
48446 }
48447
48448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
48449         LDKFundingSigned obj_conv;
48450         obj_conv.inner = untag_ptr(obj);
48451         obj_conv.is_owned = ptr_is_owned(obj);
48452         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48453         obj_conv.is_owned = false;
48454         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
48455         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48456         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48457         CVec_u8Z_free(ret_var);
48458         return ret_arr;
48459 }
48460
48461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48462         LDKu8slice ser_ref;
48463         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48464         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48465         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
48466         *ret_conv = FundingSigned_read(ser_ref);
48467         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48468         return tag_ptr(ret_conv, true);
48469 }
48470
48471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
48472         LDKChannelReady obj_conv;
48473         obj_conv.inner = untag_ptr(obj);
48474         obj_conv.is_owned = ptr_is_owned(obj);
48475         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48476         obj_conv.is_owned = false;
48477         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
48478         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48479         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48480         CVec_u8Z_free(ret_var);
48481         return ret_arr;
48482 }
48483
48484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48485         LDKu8slice ser_ref;
48486         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48487         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48488         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
48489         *ret_conv = ChannelReady_read(ser_ref);
48490         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48491         return tag_ptr(ret_conv, true);
48492 }
48493
48494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
48495         LDKInit obj_conv;
48496         obj_conv.inner = untag_ptr(obj);
48497         obj_conv.is_owned = ptr_is_owned(obj);
48498         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48499         obj_conv.is_owned = false;
48500         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
48501         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48502         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48503         CVec_u8Z_free(ret_var);
48504         return ret_arr;
48505 }
48506
48507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48508         LDKu8slice ser_ref;
48509         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48510         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48511         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
48512         *ret_conv = Init_read(ser_ref);
48513         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48514         return tag_ptr(ret_conv, true);
48515 }
48516
48517 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
48518         LDKOpenChannel obj_conv;
48519         obj_conv.inner = untag_ptr(obj);
48520         obj_conv.is_owned = ptr_is_owned(obj);
48521         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48522         obj_conv.is_owned = false;
48523         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
48524         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48525         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48526         CVec_u8Z_free(ret_var);
48527         return ret_arr;
48528 }
48529
48530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48531         LDKu8slice ser_ref;
48532         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48533         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48534         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
48535         *ret_conv = OpenChannel_read(ser_ref);
48536         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48537         return tag_ptr(ret_conv, true);
48538 }
48539
48540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
48541         LDKOpenChannelV2 obj_conv;
48542         obj_conv.inner = untag_ptr(obj);
48543         obj_conv.is_owned = ptr_is_owned(obj);
48544         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48545         obj_conv.is_owned = false;
48546         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
48547         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48548         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48549         CVec_u8Z_free(ret_var);
48550         return ret_arr;
48551 }
48552
48553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48554         LDKu8slice ser_ref;
48555         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48556         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48557         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
48558         *ret_conv = OpenChannelV2_read(ser_ref);
48559         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48560         return tag_ptr(ret_conv, true);
48561 }
48562
48563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
48564         LDKRevokeAndACK obj_conv;
48565         obj_conv.inner = untag_ptr(obj);
48566         obj_conv.is_owned = ptr_is_owned(obj);
48567         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48568         obj_conv.is_owned = false;
48569         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
48570         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48571         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48572         CVec_u8Z_free(ret_var);
48573         return ret_arr;
48574 }
48575
48576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48577         LDKu8slice ser_ref;
48578         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48579         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48580         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
48581         *ret_conv = RevokeAndACK_read(ser_ref);
48582         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48583         return tag_ptr(ret_conv, true);
48584 }
48585
48586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
48587         LDKShutdown obj_conv;
48588         obj_conv.inner = untag_ptr(obj);
48589         obj_conv.is_owned = ptr_is_owned(obj);
48590         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48591         obj_conv.is_owned = false;
48592         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
48593         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48594         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48595         CVec_u8Z_free(ret_var);
48596         return ret_arr;
48597 }
48598
48599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48600         LDKu8slice ser_ref;
48601         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48602         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48603         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
48604         *ret_conv = Shutdown_read(ser_ref);
48605         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48606         return tag_ptr(ret_conv, true);
48607 }
48608
48609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
48610         LDKUpdateFailHTLC obj_conv;
48611         obj_conv.inner = untag_ptr(obj);
48612         obj_conv.is_owned = ptr_is_owned(obj);
48613         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48614         obj_conv.is_owned = false;
48615         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
48616         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48617         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48618         CVec_u8Z_free(ret_var);
48619         return ret_arr;
48620 }
48621
48622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48623         LDKu8slice ser_ref;
48624         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48625         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48626         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
48627         *ret_conv = UpdateFailHTLC_read(ser_ref);
48628         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48629         return tag_ptr(ret_conv, true);
48630 }
48631
48632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
48633         LDKUpdateFailMalformedHTLC obj_conv;
48634         obj_conv.inner = untag_ptr(obj);
48635         obj_conv.is_owned = ptr_is_owned(obj);
48636         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48637         obj_conv.is_owned = false;
48638         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
48639         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48640         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48641         CVec_u8Z_free(ret_var);
48642         return ret_arr;
48643 }
48644
48645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48646         LDKu8slice ser_ref;
48647         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48648         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48649         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
48650         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
48651         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48652         return tag_ptr(ret_conv, true);
48653 }
48654
48655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
48656         LDKUpdateFee obj_conv;
48657         obj_conv.inner = untag_ptr(obj);
48658         obj_conv.is_owned = ptr_is_owned(obj);
48659         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48660         obj_conv.is_owned = false;
48661         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
48662         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48663         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48664         CVec_u8Z_free(ret_var);
48665         return ret_arr;
48666 }
48667
48668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48669         LDKu8slice ser_ref;
48670         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48671         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48672         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
48673         *ret_conv = UpdateFee_read(ser_ref);
48674         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48675         return tag_ptr(ret_conv, true);
48676 }
48677
48678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
48679         LDKUpdateFulfillHTLC obj_conv;
48680         obj_conv.inner = untag_ptr(obj);
48681         obj_conv.is_owned = ptr_is_owned(obj);
48682         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48683         obj_conv.is_owned = false;
48684         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
48685         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48686         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48687         CVec_u8Z_free(ret_var);
48688         return ret_arr;
48689 }
48690
48691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48692         LDKu8slice ser_ref;
48693         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48694         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48695         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
48696         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
48697         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48698         return tag_ptr(ret_conv, true);
48699 }
48700
48701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
48702         LDKUpdateAddHTLC obj_conv;
48703         obj_conv.inner = untag_ptr(obj);
48704         obj_conv.is_owned = ptr_is_owned(obj);
48705         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48706         obj_conv.is_owned = false;
48707         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
48708         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48709         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48710         CVec_u8Z_free(ret_var);
48711         return ret_arr;
48712 }
48713
48714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48715         LDKu8slice ser_ref;
48716         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48717         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48718         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
48719         *ret_conv = UpdateAddHTLC_read(ser_ref);
48720         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48721         return tag_ptr(ret_conv, true);
48722 }
48723
48724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48725         LDKu8slice ser_ref;
48726         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48727         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48728         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
48729         *ret_conv = OnionMessage_read(ser_ref);
48730         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48731         return tag_ptr(ret_conv, true);
48732 }
48733
48734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
48735         LDKOnionMessage obj_conv;
48736         obj_conv.inner = untag_ptr(obj);
48737         obj_conv.is_owned = ptr_is_owned(obj);
48738         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48739         obj_conv.is_owned = false;
48740         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
48741         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48742         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48743         CVec_u8Z_free(ret_var);
48744         return ret_arr;
48745 }
48746
48747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
48748         LDKPing obj_conv;
48749         obj_conv.inner = untag_ptr(obj);
48750         obj_conv.is_owned = ptr_is_owned(obj);
48751         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48752         obj_conv.is_owned = false;
48753         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
48754         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48755         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48756         CVec_u8Z_free(ret_var);
48757         return ret_arr;
48758 }
48759
48760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48761         LDKu8slice ser_ref;
48762         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48763         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48764         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
48765         *ret_conv = Ping_read(ser_ref);
48766         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48767         return tag_ptr(ret_conv, true);
48768 }
48769
48770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
48771         LDKPong obj_conv;
48772         obj_conv.inner = untag_ptr(obj);
48773         obj_conv.is_owned = ptr_is_owned(obj);
48774         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48775         obj_conv.is_owned = false;
48776         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
48777         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48778         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48779         CVec_u8Z_free(ret_var);
48780         return ret_arr;
48781 }
48782
48783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48784         LDKu8slice ser_ref;
48785         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48786         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48787         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
48788         *ret_conv = Pong_read(ser_ref);
48789         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48790         return tag_ptr(ret_conv, true);
48791 }
48792
48793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
48794         LDKUnsignedChannelAnnouncement obj_conv;
48795         obj_conv.inner = untag_ptr(obj);
48796         obj_conv.is_owned = ptr_is_owned(obj);
48797         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48798         obj_conv.is_owned = false;
48799         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
48800         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48801         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48802         CVec_u8Z_free(ret_var);
48803         return ret_arr;
48804 }
48805
48806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48807         LDKu8slice ser_ref;
48808         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48809         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48810         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
48811         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
48812         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48813         return tag_ptr(ret_conv, true);
48814 }
48815
48816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
48817         LDKChannelAnnouncement obj_conv;
48818         obj_conv.inner = untag_ptr(obj);
48819         obj_conv.is_owned = ptr_is_owned(obj);
48820         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48821         obj_conv.is_owned = false;
48822         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
48823         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48824         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48825         CVec_u8Z_free(ret_var);
48826         return ret_arr;
48827 }
48828
48829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48830         LDKu8slice ser_ref;
48831         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48832         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48833         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
48834         *ret_conv = ChannelAnnouncement_read(ser_ref);
48835         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48836         return tag_ptr(ret_conv, true);
48837 }
48838
48839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
48840         LDKUnsignedChannelUpdate obj_conv;
48841         obj_conv.inner = untag_ptr(obj);
48842         obj_conv.is_owned = ptr_is_owned(obj);
48843         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48844         obj_conv.is_owned = false;
48845         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
48846         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48847         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48848         CVec_u8Z_free(ret_var);
48849         return ret_arr;
48850 }
48851
48852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48853         LDKu8slice ser_ref;
48854         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48855         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48856         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
48857         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
48858         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48859         return tag_ptr(ret_conv, true);
48860 }
48861
48862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
48863         LDKChannelUpdate obj_conv;
48864         obj_conv.inner = untag_ptr(obj);
48865         obj_conv.is_owned = ptr_is_owned(obj);
48866         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48867         obj_conv.is_owned = false;
48868         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
48869         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48870         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48871         CVec_u8Z_free(ret_var);
48872         return ret_arr;
48873 }
48874
48875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48876         LDKu8slice ser_ref;
48877         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48878         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48879         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
48880         *ret_conv = ChannelUpdate_read(ser_ref);
48881         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48882         return tag_ptr(ret_conv, true);
48883 }
48884
48885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
48886         LDKErrorMessage obj_conv;
48887         obj_conv.inner = untag_ptr(obj);
48888         obj_conv.is_owned = ptr_is_owned(obj);
48889         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48890         obj_conv.is_owned = false;
48891         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
48892         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48893         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48894         CVec_u8Z_free(ret_var);
48895         return ret_arr;
48896 }
48897
48898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48899         LDKu8slice ser_ref;
48900         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48901         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48902         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
48903         *ret_conv = ErrorMessage_read(ser_ref);
48904         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48905         return tag_ptr(ret_conv, true);
48906 }
48907
48908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
48909         LDKWarningMessage obj_conv;
48910         obj_conv.inner = untag_ptr(obj);
48911         obj_conv.is_owned = ptr_is_owned(obj);
48912         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48913         obj_conv.is_owned = false;
48914         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
48915         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48916         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48917         CVec_u8Z_free(ret_var);
48918         return ret_arr;
48919 }
48920
48921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48922         LDKu8slice ser_ref;
48923         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48924         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48925         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
48926         *ret_conv = WarningMessage_read(ser_ref);
48927         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48928         return tag_ptr(ret_conv, true);
48929 }
48930
48931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
48932         LDKUnsignedNodeAnnouncement obj_conv;
48933         obj_conv.inner = untag_ptr(obj);
48934         obj_conv.is_owned = ptr_is_owned(obj);
48935         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48936         obj_conv.is_owned = false;
48937         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
48938         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48939         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48940         CVec_u8Z_free(ret_var);
48941         return ret_arr;
48942 }
48943
48944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48945         LDKu8slice ser_ref;
48946         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48947         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48948         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
48949         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
48950         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48951         return tag_ptr(ret_conv, true);
48952 }
48953
48954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
48955         LDKNodeAnnouncement obj_conv;
48956         obj_conv.inner = untag_ptr(obj);
48957         obj_conv.is_owned = ptr_is_owned(obj);
48958         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48959         obj_conv.is_owned = false;
48960         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
48961         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48962         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48963         CVec_u8Z_free(ret_var);
48964         return ret_arr;
48965 }
48966
48967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48968         LDKu8slice ser_ref;
48969         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48970         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48971         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
48972         *ret_conv = NodeAnnouncement_read(ser_ref);
48973         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48974         return tag_ptr(ret_conv, true);
48975 }
48976
48977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48978         LDKu8slice ser_ref;
48979         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48980         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48981         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
48982         *ret_conv = QueryShortChannelIds_read(ser_ref);
48983         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48984         return tag_ptr(ret_conv, true);
48985 }
48986
48987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
48988         LDKQueryShortChannelIds obj_conv;
48989         obj_conv.inner = untag_ptr(obj);
48990         obj_conv.is_owned = ptr_is_owned(obj);
48991         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48992         obj_conv.is_owned = false;
48993         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
48994         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48995         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48996         CVec_u8Z_free(ret_var);
48997         return ret_arr;
48998 }
48999
49000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
49001         LDKReplyShortChannelIdsEnd obj_conv;
49002         obj_conv.inner = untag_ptr(obj);
49003         obj_conv.is_owned = ptr_is_owned(obj);
49004         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49005         obj_conv.is_owned = false;
49006         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
49007         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49008         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49009         CVec_u8Z_free(ret_var);
49010         return ret_arr;
49011 }
49012
49013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49014         LDKu8slice ser_ref;
49015         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49016         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49017         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
49018         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
49019         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49020         return tag_ptr(ret_conv, true);
49021 }
49022
49023 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
49024         LDKQueryChannelRange this_arg_conv;
49025         this_arg_conv.inner = untag_ptr(this_arg);
49026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49028         this_arg_conv.is_owned = false;
49029         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
49030         return ret_conv;
49031 }
49032
49033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
49034         LDKQueryChannelRange obj_conv;
49035         obj_conv.inner = untag_ptr(obj);
49036         obj_conv.is_owned = ptr_is_owned(obj);
49037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49038         obj_conv.is_owned = false;
49039         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
49040         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49041         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49042         CVec_u8Z_free(ret_var);
49043         return ret_arr;
49044 }
49045
49046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49047         LDKu8slice ser_ref;
49048         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49049         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49050         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
49051         *ret_conv = QueryChannelRange_read(ser_ref);
49052         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49053         return tag_ptr(ret_conv, true);
49054 }
49055
49056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49057         LDKu8slice ser_ref;
49058         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49059         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49060         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
49061         *ret_conv = ReplyChannelRange_read(ser_ref);
49062         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49063         return tag_ptr(ret_conv, true);
49064 }
49065
49066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
49067         LDKReplyChannelRange obj_conv;
49068         obj_conv.inner = untag_ptr(obj);
49069         obj_conv.is_owned = ptr_is_owned(obj);
49070         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49071         obj_conv.is_owned = false;
49072         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
49073         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49074         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49075         CVec_u8Z_free(ret_var);
49076         return ret_arr;
49077 }
49078
49079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
49080         LDKGossipTimestampFilter obj_conv;
49081         obj_conv.inner = untag_ptr(obj);
49082         obj_conv.is_owned = ptr_is_owned(obj);
49083         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49084         obj_conv.is_owned = false;
49085         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
49086         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49087         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49088         CVec_u8Z_free(ret_var);
49089         return ret_arr;
49090 }
49091
49092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49093         LDKu8slice ser_ref;
49094         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49095         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49096         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
49097         *ret_conv = GossipTimestampFilter_read(ser_ref);
49098         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49099         return tag_ptr(ret_conv, true);
49100 }
49101
49102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49103         if (!ptr_is_owned(this_ptr)) return;
49104         void* this_ptr_ptr = untag_ptr(this_ptr);
49105         CHECK_ACCESS(this_ptr_ptr);
49106         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
49107         FREE(untag_ptr(this_ptr));
49108         CustomMessageHandler_free(this_ptr_conv);
49109 }
49110
49111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49112         LDKIgnoringMessageHandler this_obj_conv;
49113         this_obj_conv.inner = untag_ptr(this_obj);
49114         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49116         IgnoringMessageHandler_free(this_obj_conv);
49117 }
49118
49119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
49120         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
49121         int64_t ret_ref = 0;
49122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49124         return ret_ref;
49125 }
49126
49127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
49128         LDKIgnoringMessageHandler this_arg_conv;
49129         this_arg_conv.inner = untag_ptr(this_arg);
49130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49132         this_arg_conv.is_owned = false;
49133         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
49134         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
49135         return tag_ptr(ret_ret, true);
49136 }
49137
49138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49139         LDKIgnoringMessageHandler this_arg_conv;
49140         this_arg_conv.inner = untag_ptr(this_arg);
49141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49143         this_arg_conv.is_owned = false;
49144         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
49145         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
49146         return tag_ptr(ret_ret, true);
49147 }
49148
49149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
49150         LDKIgnoringMessageHandler this_arg_conv;
49151         this_arg_conv.inner = untag_ptr(this_arg);
49152         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49154         this_arg_conv.is_owned = false;
49155         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
49156         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
49157         return tag_ptr(ret_ret, true);
49158 }
49159
49160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49161         LDKIgnoringMessageHandler this_arg_conv;
49162         this_arg_conv.inner = untag_ptr(this_arg);
49163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49165         this_arg_conv.is_owned = false;
49166         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
49167         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
49168         return tag_ptr(ret_ret, true);
49169 }
49170
49171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49172         LDKIgnoringMessageHandler this_arg_conv;
49173         this_arg_conv.inner = untag_ptr(this_arg);
49174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49176         this_arg_conv.is_owned = false;
49177         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
49178         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
49179         return tag_ptr(ret_ret, true);
49180 }
49181
49182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49183         LDKIgnoringMessageHandler this_arg_conv;
49184         this_arg_conv.inner = untag_ptr(this_arg);
49185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49187         this_arg_conv.is_owned = false;
49188         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
49189         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
49190         return tag_ptr(ret_ret, true);
49191 }
49192
49193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
49194         LDKIgnoringMessageHandler this_arg_conv;
49195         this_arg_conv.inner = untag_ptr(this_arg);
49196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49198         this_arg_conv.is_owned = false;
49199         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
49200         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
49201         return tag_ptr(ret_ret, true);
49202 }
49203
49204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49205         LDKIgnoringMessageHandler this_arg_conv;
49206         this_arg_conv.inner = untag_ptr(this_arg);
49207         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49209         this_arg_conv.is_owned = false;
49210         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
49211         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
49212         return tag_ptr(ret_ret, true);
49213 }
49214
49215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49216         LDKErroringMessageHandler this_obj_conv;
49217         this_obj_conv.inner = untag_ptr(this_obj);
49218         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49220         ErroringMessageHandler_free(this_obj_conv);
49221 }
49222
49223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
49224         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
49225         int64_t ret_ref = 0;
49226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49228         return ret_ref;
49229 }
49230
49231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
49232         LDKErroringMessageHandler this_arg_conv;
49233         this_arg_conv.inner = untag_ptr(this_arg);
49234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49236         this_arg_conv.is_owned = false;
49237         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
49238         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
49239         return tag_ptr(ret_ret, true);
49240 }
49241
49242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
49243         LDKErroringMessageHandler this_arg_conv;
49244         this_arg_conv.inner = untag_ptr(this_arg);
49245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49247         this_arg_conv.is_owned = false;
49248         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
49249         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
49250         return tag_ptr(ret_ret, true);
49251 }
49252
49253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49254         LDKMessageHandler this_obj_conv;
49255         this_obj_conv.inner = untag_ptr(this_obj);
49256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49258         MessageHandler_free(this_obj_conv);
49259 }
49260
49261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
49262         LDKMessageHandler this_ptr_conv;
49263         this_ptr_conv.inner = untag_ptr(this_ptr);
49264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49266         this_ptr_conv.is_owned = false;
49267         // WARNING: This object doesn't live past this scope, needs clone!
49268         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
49269         return ret_ret;
49270 }
49271
49272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49273         LDKMessageHandler this_ptr_conv;
49274         this_ptr_conv.inner = untag_ptr(this_ptr);
49275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49277         this_ptr_conv.is_owned = false;
49278         void* val_ptr = untag_ptr(val);
49279         CHECK_ACCESS(val_ptr);
49280         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
49281         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
49282                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49283                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
49284         }
49285         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
49286 }
49287
49288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
49289         LDKMessageHandler this_ptr_conv;
49290         this_ptr_conv.inner = untag_ptr(this_ptr);
49291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49293         this_ptr_conv.is_owned = false;
49294         // WARNING: This object doesn't live past this scope, needs clone!
49295         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
49296         return ret_ret;
49297 }
49298
49299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49300         LDKMessageHandler this_ptr_conv;
49301         this_ptr_conv.inner = untag_ptr(this_ptr);
49302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49304         this_ptr_conv.is_owned = false;
49305         void* val_ptr = untag_ptr(val);
49306         CHECK_ACCESS(val_ptr);
49307         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
49308         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
49309                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49310                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
49311         }
49312         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
49313 }
49314
49315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
49316         LDKMessageHandler this_ptr_conv;
49317         this_ptr_conv.inner = untag_ptr(this_ptr);
49318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49320         this_ptr_conv.is_owned = false;
49321         // WARNING: This object doesn't live past this scope, needs clone!
49322         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
49323         return ret_ret;
49324 }
49325
49326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49327         LDKMessageHandler this_ptr_conv;
49328         this_ptr_conv.inner = untag_ptr(this_ptr);
49329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49331         this_ptr_conv.is_owned = false;
49332         void* val_ptr = untag_ptr(val);
49333         CHECK_ACCESS(val_ptr);
49334         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
49335         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
49336                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49337                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
49338         }
49339         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
49340 }
49341
49342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
49343         LDKMessageHandler this_ptr_conv;
49344         this_ptr_conv.inner = untag_ptr(this_ptr);
49345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49347         this_ptr_conv.is_owned = false;
49348         // WARNING: This object doesn't live past this scope, needs clone!
49349         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
49350         return ret_ret;
49351 }
49352
49353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49354         LDKMessageHandler this_ptr_conv;
49355         this_ptr_conv.inner = untag_ptr(this_ptr);
49356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49358         this_ptr_conv.is_owned = false;
49359         void* val_ptr = untag_ptr(val);
49360         CHECK_ACCESS(val_ptr);
49361         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
49362         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
49363                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49364                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
49365         }
49366         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
49367 }
49368
49369 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) {
49370         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
49371         CHECK_ACCESS(chan_handler_arg_ptr);
49372         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
49373         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
49374                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49375                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
49376         }
49377         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
49378         CHECK_ACCESS(route_handler_arg_ptr);
49379         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
49380         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
49381                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49382                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
49383         }
49384         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
49385         CHECK_ACCESS(onion_message_handler_arg_ptr);
49386         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
49387         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
49388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49389                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
49390         }
49391         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
49392         CHECK_ACCESS(custom_message_handler_arg_ptr);
49393         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
49394         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
49395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49396                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
49397         }
49398         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
49399         int64_t ret_ref = 0;
49400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49402         return ret_ref;
49403 }
49404
49405 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
49406         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
49407         *ret_ret = SocketDescriptor_clone(arg);
49408         return tag_ptr(ret_ret, true);
49409 }
49410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49411         void* arg_ptr = untag_ptr(arg);
49412         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
49413         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
49414         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
49415         return ret_conv;
49416 }
49417
49418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49419         void* orig_ptr = untag_ptr(orig);
49420         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
49421         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
49422         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
49423         *ret_ret = SocketDescriptor_clone(orig_conv);
49424         return tag_ptr(ret_ret, true);
49425 }
49426
49427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
49428         if (!ptr_is_owned(this_ptr)) return;
49429         void* this_ptr_ptr = untag_ptr(this_ptr);
49430         CHECK_ACCESS(this_ptr_ptr);
49431         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
49432         FREE(untag_ptr(this_ptr));
49433         SocketDescriptor_free(this_ptr_conv);
49434 }
49435
49436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49437         LDKPeerHandleError this_obj_conv;
49438         this_obj_conv.inner = untag_ptr(this_obj);
49439         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49441         PeerHandleError_free(this_obj_conv);
49442 }
49443
49444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
49445         LDKPeerHandleError ret_var = PeerHandleError_new();
49446         int64_t ret_ref = 0;
49447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49449         return ret_ref;
49450 }
49451
49452 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
49453         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
49454         int64_t ret_ref = 0;
49455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49457         return ret_ref;
49458 }
49459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49460         LDKPeerHandleError arg_conv;
49461         arg_conv.inner = untag_ptr(arg);
49462         arg_conv.is_owned = ptr_is_owned(arg);
49463         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49464         arg_conv.is_owned = false;
49465         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
49466         return ret_conv;
49467 }
49468
49469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49470         LDKPeerHandleError orig_conv;
49471         orig_conv.inner = untag_ptr(orig);
49472         orig_conv.is_owned = ptr_is_owned(orig);
49473         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49474         orig_conv.is_owned = false;
49475         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
49476         int64_t ret_ref = 0;
49477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49479         return ret_ref;
49480 }
49481
49482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49483         LDKPeerManager this_obj_conv;
49484         this_obj_conv.inner = untag_ptr(this_obj);
49485         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49487         PeerManager_free(this_obj_conv);
49488 }
49489
49490 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) {
49491         LDKMessageHandler message_handler_conv;
49492         message_handler_conv.inner = untag_ptr(message_handler);
49493         message_handler_conv.is_owned = ptr_is_owned(message_handler);
49494         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
49495         // WARNING: we need a move here but no clone is available for LDKMessageHandler
49496         
49497         uint8_t ephemeral_random_data_arr[32];
49498         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
49499         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
49500         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
49501         void* logger_ptr = untag_ptr(logger);
49502         CHECK_ACCESS(logger_ptr);
49503         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49504         if (logger_conv.free == LDKLogger_JCalls_free) {
49505                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49506                 LDKLogger_JCalls_cloned(&logger_conv);
49507         }
49508         void* node_signer_ptr = untag_ptr(node_signer);
49509         CHECK_ACCESS(node_signer_ptr);
49510         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
49511         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
49512                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49513                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
49514         }
49515         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
49516         int64_t ret_ref = 0;
49517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49519         return ret_ref;
49520 }
49521
49522 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
49523         LDKPeerManager this_arg_conv;
49524         this_arg_conv.inner = untag_ptr(this_arg);
49525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49527         this_arg_conv.is_owned = false;
49528         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
49529         int64_tArray ret_arr = NULL;
49530         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
49531         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
49532         for (size_t o = 0; o < ret_var.datalen; o++) {
49533                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
49534                 *ret_conv_40_conv = ret_var.data[o];
49535                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
49536         }
49537         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
49538         FREE(ret_var.data);
49539         return ret_arr;
49540 }
49541
49542 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) {
49543         LDKPeerManager this_arg_conv;
49544         this_arg_conv.inner = untag_ptr(this_arg);
49545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49547         this_arg_conv.is_owned = false;
49548         LDKPublicKey their_node_id_ref;
49549         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
49550         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
49551         void* descriptor_ptr = untag_ptr(descriptor);
49552         CHECK_ACCESS(descriptor_ptr);
49553         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
49554         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
49555                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49556                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
49557         }
49558         void* remote_network_address_ptr = untag_ptr(remote_network_address);
49559         CHECK_ACCESS(remote_network_address_ptr);
49560         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
49561         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
49562         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
49563         return tag_ptr(ret_conv, true);
49564 }
49565
49566 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) {
49567         LDKPeerManager this_arg_conv;
49568         this_arg_conv.inner = untag_ptr(this_arg);
49569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49571         this_arg_conv.is_owned = false;
49572         void* descriptor_ptr = untag_ptr(descriptor);
49573         CHECK_ACCESS(descriptor_ptr);
49574         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
49575         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
49576                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49577                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
49578         }
49579         void* remote_network_address_ptr = untag_ptr(remote_network_address);
49580         CHECK_ACCESS(remote_network_address_ptr);
49581         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
49582         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
49583         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
49584         return tag_ptr(ret_conv, true);
49585 }
49586
49587 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) {
49588         LDKPeerManager this_arg_conv;
49589         this_arg_conv.inner = untag_ptr(this_arg);
49590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49592         this_arg_conv.is_owned = false;
49593         void* descriptor_ptr = untag_ptr(descriptor);
49594         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
49595         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
49596         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
49597         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
49598         return tag_ptr(ret_conv, true);
49599 }
49600
49601 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) {
49602         LDKPeerManager this_arg_conv;
49603         this_arg_conv.inner = untag_ptr(this_arg);
49604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49606         this_arg_conv.is_owned = false;
49607         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
49608         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
49609         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
49610         LDKu8slice data_ref;
49611         data_ref.datalen = (*env)->GetArrayLength(env, data);
49612         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
49613         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
49614         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
49615         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
49616         return tag_ptr(ret_conv, true);
49617 }
49618
49619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
49620         LDKPeerManager this_arg_conv;
49621         this_arg_conv.inner = untag_ptr(this_arg);
49622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49624         this_arg_conv.is_owned = false;
49625         PeerManager_process_events(&this_arg_conv);
49626 }
49627
49628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
49629         LDKPeerManager this_arg_conv;
49630         this_arg_conv.inner = untag_ptr(this_arg);
49631         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49633         this_arg_conv.is_owned = false;
49634         void* descriptor_ptr = untag_ptr(descriptor);
49635         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
49636         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
49637         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
49638 }
49639
49640 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) {
49641         LDKPeerManager this_arg_conv;
49642         this_arg_conv.inner = untag_ptr(this_arg);
49643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49645         this_arg_conv.is_owned = false;
49646         LDKPublicKey node_id_ref;
49647         CHECK((*env)->GetArrayLength(env, node_id) == 33);
49648         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
49649         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
49650 }
49651
49652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
49653         LDKPeerManager this_arg_conv;
49654         this_arg_conv.inner = untag_ptr(this_arg);
49655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49657         this_arg_conv.is_owned = false;
49658         PeerManager_disconnect_all_peers(&this_arg_conv);
49659 }
49660
49661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
49662         LDKPeerManager this_arg_conv;
49663         this_arg_conv.inner = untag_ptr(this_arg);
49664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49666         this_arg_conv.is_owned = false;
49667         PeerManager_timer_tick_occurred(&this_arg_conv);
49668 }
49669
49670 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) {
49671         LDKPeerManager this_arg_conv;
49672         this_arg_conv.inner = untag_ptr(this_arg);
49673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49675         this_arg_conv.is_owned = false;
49676         LDKThreeBytes rgb_ref;
49677         CHECK((*env)->GetArrayLength(env, rgb) == 3);
49678         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
49679         LDKThirtyTwoBytes alias_ref;
49680         CHECK((*env)->GetArrayLength(env, alias) == 32);
49681         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
49682         LDKCVec_NetAddressZ addresses_constr;
49683         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
49684         if (addresses_constr.datalen > 0)
49685                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
49686         else
49687                 addresses_constr.data = NULL;
49688         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
49689         for (size_t m = 0; m < addresses_constr.datalen; m++) {
49690                 int64_t addresses_conv_12 = addresses_vals[m];
49691                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
49692                 CHECK_ACCESS(addresses_conv_12_ptr);
49693                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
49694                 addresses_constr.data[m] = addresses_conv_12_conv;
49695         }
49696         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
49697         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
49698 }
49699
49700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
49701         LDKChannelTypeFeatures channel_type_features_conv;
49702         channel_type_features_conv.inner = untag_ptr(channel_type_features);
49703         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
49704         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
49705         channel_type_features_conv.is_owned = false;
49706         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
49707         return ret_conv;
49708 }
49709
49710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
49711         LDKChannelTypeFeatures channel_type_features_conv;
49712         channel_type_features_conv.inner = untag_ptr(channel_type_features);
49713         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
49714         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
49715         channel_type_features_conv.is_owned = false;
49716         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
49717         return ret_conv;
49718 }
49719
49720 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49721         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
49722         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
49723         return ret_conv;
49724 }
49725
49726 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
49727         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
49728         return ret_conv;
49729 }
49730
49731 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
49732         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
49733         return ret_conv;
49734 }
49735
49736 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
49737         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
49738         return ret_conv;
49739 }
49740
49741 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
49742         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
49743         return ret_conv;
49744 }
49745
49746 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
49747         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
49748         return ret_conv;
49749 }
49750
49751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49752         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
49753         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
49754         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
49755         return ret_conv;
49756 }
49757
49758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
49759         LDKWitness witness_ref;
49760         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
49761         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
49762         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
49763         witness_ref.data_is_owned = true;
49764         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
49765         *ret_copy = HTLCClaim_from_witness(witness_ref);
49766         int64_t ret_ref = tag_ptr(ret_copy, true);
49767         return ret_ref;
49768 }
49769
49770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
49771         uint8_t commitment_seed_arr[32];
49772         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
49773         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
49774         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
49775         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49776         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
49777         return ret_arr;
49778 }
49779
49780 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) {
49781         LDKCVec_u8Z to_holder_script_ref;
49782         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
49783         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
49784         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
49785         LDKCVec_u8Z to_counterparty_script_ref;
49786         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
49787         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
49788         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
49789         LDKOutPoint funding_outpoint_conv;
49790         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
49791         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
49792         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
49793         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
49794         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);
49795         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49796         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49797         Transaction_free(ret_var);
49798         return ret_arr;
49799 }
49800
49801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49802         LDKCounterpartyCommitmentSecrets this_obj_conv;
49803         this_obj_conv.inner = untag_ptr(this_obj);
49804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49806         CounterpartyCommitmentSecrets_free(this_obj_conv);
49807 }
49808
49809 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
49810         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
49811         int64_t ret_ref = 0;
49812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49814         return ret_ref;
49815 }
49816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49817         LDKCounterpartyCommitmentSecrets arg_conv;
49818         arg_conv.inner = untag_ptr(arg);
49819         arg_conv.is_owned = ptr_is_owned(arg);
49820         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49821         arg_conv.is_owned = false;
49822         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
49823         return ret_conv;
49824 }
49825
49826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49827         LDKCounterpartyCommitmentSecrets orig_conv;
49828         orig_conv.inner = untag_ptr(orig);
49829         orig_conv.is_owned = ptr_is_owned(orig);
49830         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49831         orig_conv.is_owned = false;
49832         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
49833         int64_t ret_ref = 0;
49834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49836         return ret_ref;
49837 }
49838
49839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
49840         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
49841         int64_t ret_ref = 0;
49842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49844         return ret_ref;
49845 }
49846
49847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
49848         LDKCounterpartyCommitmentSecrets this_arg_conv;
49849         this_arg_conv.inner = untag_ptr(this_arg);
49850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49852         this_arg_conv.is_owned = false;
49853         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
49854         return ret_conv;
49855 }
49856
49857 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) {
49858         LDKCounterpartyCommitmentSecrets this_arg_conv;
49859         this_arg_conv.inner = untag_ptr(this_arg);
49860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49862         this_arg_conv.is_owned = false;
49863         LDKThirtyTwoBytes secret_ref;
49864         CHECK((*env)->GetArrayLength(env, secret) == 32);
49865         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
49866         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
49867         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
49868         return tag_ptr(ret_conv, true);
49869 }
49870
49871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
49872         LDKCounterpartyCommitmentSecrets this_arg_conv;
49873         this_arg_conv.inner = untag_ptr(this_arg);
49874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49876         this_arg_conv.is_owned = false;
49877         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49878         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
49879         return ret_arr;
49880 }
49881
49882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
49883         LDKCounterpartyCommitmentSecrets obj_conv;
49884         obj_conv.inner = untag_ptr(obj);
49885         obj_conv.is_owned = ptr_is_owned(obj);
49886         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49887         obj_conv.is_owned = false;
49888         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
49889         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49890         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49891         CVec_u8Z_free(ret_var);
49892         return ret_arr;
49893 }
49894
49895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49896         LDKu8slice ser_ref;
49897         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49898         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49899         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
49900         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
49901         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49902         return tag_ptr(ret_conv, true);
49903 }
49904
49905 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) {
49906         LDKPublicKey per_commitment_point_ref;
49907         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49908         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49909         uint8_t base_secret_arr[32];
49910         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
49911         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
49912         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
49913         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49914         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
49915         return ret_arr;
49916 }
49917
49918 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) {
49919         LDKPublicKey per_commitment_point_ref;
49920         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49921         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49922         LDKPublicKey base_point_ref;
49923         CHECK((*env)->GetArrayLength(env, base_point) == 33);
49924         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
49925         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49926         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form);
49927         return ret_arr;
49928 }
49929
49930 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) {
49931         uint8_t per_commitment_secret_arr[32];
49932         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
49933         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
49934         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
49935         uint8_t countersignatory_revocation_base_secret_arr[32];
49936         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
49937         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
49938         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
49939         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49940         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
49941         return ret_arr;
49942 }
49943
49944 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) {
49945         LDKPublicKey per_commitment_point_ref;
49946         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49947         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49948         LDKPublicKey countersignatory_revocation_base_point_ref;
49949         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
49950         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
49951         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49952         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form);
49953         return ret_arr;
49954 }
49955
49956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49957         LDKTxCreationKeys this_obj_conv;
49958         this_obj_conv.inner = untag_ptr(this_obj);
49959         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49961         TxCreationKeys_free(this_obj_conv);
49962 }
49963
49964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
49965         LDKTxCreationKeys this_ptr_conv;
49966         this_ptr_conv.inner = untag_ptr(this_ptr);
49967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49969         this_ptr_conv.is_owned = false;
49970         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49971         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
49972         return ret_arr;
49973 }
49974
49975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49976         LDKTxCreationKeys this_ptr_conv;
49977         this_ptr_conv.inner = untag_ptr(this_ptr);
49978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49980         this_ptr_conv.is_owned = false;
49981         LDKPublicKey val_ref;
49982         CHECK((*env)->GetArrayLength(env, val) == 33);
49983         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49984         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
49985 }
49986
49987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
49988         LDKTxCreationKeys this_ptr_conv;
49989         this_ptr_conv.inner = untag_ptr(this_ptr);
49990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49992         this_ptr_conv.is_owned = false;
49993         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49994         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
49995         return ret_arr;
49996 }
49997
49998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49999         LDKTxCreationKeys this_ptr_conv;
50000         this_ptr_conv.inner = untag_ptr(this_ptr);
50001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50003         this_ptr_conv.is_owned = false;
50004         LDKPublicKey val_ref;
50005         CHECK((*env)->GetArrayLength(env, val) == 33);
50006         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50007         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
50008 }
50009
50010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
50011         LDKTxCreationKeys this_ptr_conv;
50012         this_ptr_conv.inner = untag_ptr(this_ptr);
50013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50015         this_ptr_conv.is_owned = false;
50016         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50017         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
50018         return ret_arr;
50019 }
50020
50021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50022         LDKTxCreationKeys this_ptr_conv;
50023         this_ptr_conv.inner = untag_ptr(this_ptr);
50024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50026         this_ptr_conv.is_owned = false;
50027         LDKPublicKey val_ref;
50028         CHECK((*env)->GetArrayLength(env, val) == 33);
50029         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50030         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
50031 }
50032
50033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
50034         LDKTxCreationKeys this_ptr_conv;
50035         this_ptr_conv.inner = untag_ptr(this_ptr);
50036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50038         this_ptr_conv.is_owned = false;
50039         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50040         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
50041         return ret_arr;
50042 }
50043
50044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50045         LDKTxCreationKeys this_ptr_conv;
50046         this_ptr_conv.inner = untag_ptr(this_ptr);
50047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50049         this_ptr_conv.is_owned = false;
50050         LDKPublicKey val_ref;
50051         CHECK((*env)->GetArrayLength(env, val) == 33);
50052         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50053         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
50054 }
50055
50056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
50057         LDKTxCreationKeys this_ptr_conv;
50058         this_ptr_conv.inner = untag_ptr(this_ptr);
50059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50061         this_ptr_conv.is_owned = false;
50062         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50063         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
50064         return ret_arr;
50065 }
50066
50067 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) {
50068         LDKTxCreationKeys this_ptr_conv;
50069         this_ptr_conv.inner = untag_ptr(this_ptr);
50070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50072         this_ptr_conv.is_owned = false;
50073         LDKPublicKey val_ref;
50074         CHECK((*env)->GetArrayLength(env, val) == 33);
50075         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50076         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
50077 }
50078
50079 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) {
50080         LDKPublicKey per_commitment_point_arg_ref;
50081         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
50082         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
50083         LDKPublicKey revocation_key_arg_ref;
50084         CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
50085         (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
50086         LDKPublicKey broadcaster_htlc_key_arg_ref;
50087         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
50088         (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
50089         LDKPublicKey countersignatory_htlc_key_arg_ref;
50090         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
50091         (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
50092         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
50093         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
50094         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
50095         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);
50096         int64_t ret_ref = 0;
50097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50099         return ret_ref;
50100 }
50101
50102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50103         LDKTxCreationKeys a_conv;
50104         a_conv.inner = untag_ptr(a);
50105         a_conv.is_owned = ptr_is_owned(a);
50106         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50107         a_conv.is_owned = false;
50108         LDKTxCreationKeys b_conv;
50109         b_conv.inner = untag_ptr(b);
50110         b_conv.is_owned = ptr_is_owned(b);
50111         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50112         b_conv.is_owned = false;
50113         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
50114         return ret_conv;
50115 }
50116
50117 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
50118         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
50119         int64_t ret_ref = 0;
50120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50122         return ret_ref;
50123 }
50124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50125         LDKTxCreationKeys arg_conv;
50126         arg_conv.inner = untag_ptr(arg);
50127         arg_conv.is_owned = ptr_is_owned(arg);
50128         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50129         arg_conv.is_owned = false;
50130         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
50131         return ret_conv;
50132 }
50133
50134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50135         LDKTxCreationKeys orig_conv;
50136         orig_conv.inner = untag_ptr(orig);
50137         orig_conv.is_owned = ptr_is_owned(orig);
50138         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50139         orig_conv.is_owned = false;
50140         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
50141         int64_t ret_ref = 0;
50142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50144         return ret_ref;
50145 }
50146
50147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
50148         LDKTxCreationKeys obj_conv;
50149         obj_conv.inner = untag_ptr(obj);
50150         obj_conv.is_owned = ptr_is_owned(obj);
50151         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50152         obj_conv.is_owned = false;
50153         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
50154         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50155         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50156         CVec_u8Z_free(ret_var);
50157         return ret_arr;
50158 }
50159
50160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50161         LDKu8slice ser_ref;
50162         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50163         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50164         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
50165         *ret_conv = TxCreationKeys_read(ser_ref);
50166         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50167         return tag_ptr(ret_conv, true);
50168 }
50169
50170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50171         LDKChannelPublicKeys this_obj_conv;
50172         this_obj_conv.inner = untag_ptr(this_obj);
50173         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50175         ChannelPublicKeys_free(this_obj_conv);
50176 }
50177
50178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
50179         LDKChannelPublicKeys this_ptr_conv;
50180         this_ptr_conv.inner = untag_ptr(this_ptr);
50181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50183         this_ptr_conv.is_owned = false;
50184         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50185         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
50186         return ret_arr;
50187 }
50188
50189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50190         LDKChannelPublicKeys this_ptr_conv;
50191         this_ptr_conv.inner = untag_ptr(this_ptr);
50192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50194         this_ptr_conv.is_owned = false;
50195         LDKPublicKey val_ref;
50196         CHECK((*env)->GetArrayLength(env, val) == 33);
50197         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50198         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
50199 }
50200
50201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
50202         LDKChannelPublicKeys this_ptr_conv;
50203         this_ptr_conv.inner = untag_ptr(this_ptr);
50204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50206         this_ptr_conv.is_owned = false;
50207         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50208         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
50209         return ret_arr;
50210 }
50211
50212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50213         LDKChannelPublicKeys this_ptr_conv;
50214         this_ptr_conv.inner = untag_ptr(this_ptr);
50215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50217         this_ptr_conv.is_owned = false;
50218         LDKPublicKey val_ref;
50219         CHECK((*env)->GetArrayLength(env, val) == 33);
50220         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50221         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
50222 }
50223
50224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
50225         LDKChannelPublicKeys this_ptr_conv;
50226         this_ptr_conv.inner = untag_ptr(this_ptr);
50227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50229         this_ptr_conv.is_owned = false;
50230         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50231         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
50232         return ret_arr;
50233 }
50234
50235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50236         LDKChannelPublicKeys this_ptr_conv;
50237         this_ptr_conv.inner = untag_ptr(this_ptr);
50238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50240         this_ptr_conv.is_owned = false;
50241         LDKPublicKey val_ref;
50242         CHECK((*env)->GetArrayLength(env, val) == 33);
50243         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50244         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
50245 }
50246
50247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
50248         LDKChannelPublicKeys this_ptr_conv;
50249         this_ptr_conv.inner = untag_ptr(this_ptr);
50250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50252         this_ptr_conv.is_owned = false;
50253         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50254         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
50255         return ret_arr;
50256 }
50257
50258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50259         LDKChannelPublicKeys this_ptr_conv;
50260         this_ptr_conv.inner = untag_ptr(this_ptr);
50261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50263         this_ptr_conv.is_owned = false;
50264         LDKPublicKey val_ref;
50265         CHECK((*env)->GetArrayLength(env, val) == 33);
50266         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50267         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
50268 }
50269
50270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
50271         LDKChannelPublicKeys this_ptr_conv;
50272         this_ptr_conv.inner = untag_ptr(this_ptr);
50273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50275         this_ptr_conv.is_owned = false;
50276         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50277         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
50278         return ret_arr;
50279 }
50280
50281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50282         LDKChannelPublicKeys this_ptr_conv;
50283         this_ptr_conv.inner = untag_ptr(this_ptr);
50284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50286         this_ptr_conv.is_owned = false;
50287         LDKPublicKey val_ref;
50288         CHECK((*env)->GetArrayLength(env, val) == 33);
50289         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50290         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
50291 }
50292
50293 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) {
50294         LDKPublicKey funding_pubkey_arg_ref;
50295         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
50296         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
50297         LDKPublicKey revocation_basepoint_arg_ref;
50298         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
50299         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
50300         LDKPublicKey payment_point_arg_ref;
50301         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
50302         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
50303         LDKPublicKey delayed_payment_basepoint_arg_ref;
50304         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
50305         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
50306         LDKPublicKey htlc_basepoint_arg_ref;
50307         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
50308         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
50309         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);
50310         int64_t ret_ref = 0;
50311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50313         return ret_ref;
50314 }
50315
50316 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
50317         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
50318         int64_t ret_ref = 0;
50319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50321         return ret_ref;
50322 }
50323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50324         LDKChannelPublicKeys arg_conv;
50325         arg_conv.inner = untag_ptr(arg);
50326         arg_conv.is_owned = ptr_is_owned(arg);
50327         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50328         arg_conv.is_owned = false;
50329         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
50330         return ret_conv;
50331 }
50332
50333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50334         LDKChannelPublicKeys orig_conv;
50335         orig_conv.inner = untag_ptr(orig);
50336         orig_conv.is_owned = ptr_is_owned(orig);
50337         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50338         orig_conv.is_owned = false;
50339         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
50340         int64_t ret_ref = 0;
50341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50343         return ret_ref;
50344 }
50345
50346 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50347         LDKChannelPublicKeys a_conv;
50348         a_conv.inner = untag_ptr(a);
50349         a_conv.is_owned = ptr_is_owned(a);
50350         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50351         a_conv.is_owned = false;
50352         LDKChannelPublicKeys b_conv;
50353         b_conv.inner = untag_ptr(b);
50354         b_conv.is_owned = ptr_is_owned(b);
50355         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50356         b_conv.is_owned = false;
50357         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
50358         return ret_conv;
50359 }
50360
50361 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
50362         LDKChannelPublicKeys obj_conv;
50363         obj_conv.inner = untag_ptr(obj);
50364         obj_conv.is_owned = ptr_is_owned(obj);
50365         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50366         obj_conv.is_owned = false;
50367         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
50368         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50369         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50370         CVec_u8Z_free(ret_var);
50371         return ret_arr;
50372 }
50373
50374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50375         LDKu8slice ser_ref;
50376         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50377         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50378         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
50379         *ret_conv = ChannelPublicKeys_read(ser_ref);
50380         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50381         return tag_ptr(ret_conv, true);
50382 }
50383
50384 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) {
50385         LDKPublicKey per_commitment_point_ref;
50386         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
50387         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
50388         LDKPublicKey broadcaster_delayed_payment_base_ref;
50389         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
50390         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
50391         LDKPublicKey broadcaster_htlc_base_ref;
50392         CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
50393         (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
50394         LDKPublicKey countersignatory_revocation_base_ref;
50395         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
50396         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
50397         LDKPublicKey countersignatory_htlc_base_ref;
50398         CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
50399         (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
50400         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);
50401         int64_t ret_ref = 0;
50402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50404         return ret_ref;
50405 }
50406
50407 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) {
50408         LDKPublicKey per_commitment_point_ref;
50409         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
50410         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
50411         LDKChannelPublicKeys broadcaster_keys_conv;
50412         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
50413         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
50414         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
50415         broadcaster_keys_conv.is_owned = false;
50416         LDKChannelPublicKeys countersignatory_keys_conv;
50417         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
50418         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
50419         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
50420         countersignatory_keys_conv.is_owned = false;
50421         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
50422         int64_t ret_ref = 0;
50423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50425         return ret_ref;
50426 }
50427
50428 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) {
50429         LDKPublicKey revocation_key_ref;
50430         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
50431         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
50432         LDKPublicKey broadcaster_delayed_payment_key_ref;
50433         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
50434         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
50435         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
50436         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50437         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50438         CVec_u8Z_free(ret_var);
50439         return ret_arr;
50440 }
50441
50442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50443         LDKHTLCOutputInCommitment this_obj_conv;
50444         this_obj_conv.inner = untag_ptr(this_obj);
50445         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50447         HTLCOutputInCommitment_free(this_obj_conv);
50448 }
50449
50450 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
50451         LDKHTLCOutputInCommitment this_ptr_conv;
50452         this_ptr_conv.inner = untag_ptr(this_ptr);
50453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50455         this_ptr_conv.is_owned = false;
50456         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
50457         return ret_conv;
50458 }
50459
50460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
50461         LDKHTLCOutputInCommitment this_ptr_conv;
50462         this_ptr_conv.inner = untag_ptr(this_ptr);
50463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50465         this_ptr_conv.is_owned = false;
50466         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
50467 }
50468
50469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
50470         LDKHTLCOutputInCommitment this_ptr_conv;
50471         this_ptr_conv.inner = untag_ptr(this_ptr);
50472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50474         this_ptr_conv.is_owned = false;
50475         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
50476         return ret_conv;
50477 }
50478
50479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50480         LDKHTLCOutputInCommitment this_ptr_conv;
50481         this_ptr_conv.inner = untag_ptr(this_ptr);
50482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50484         this_ptr_conv.is_owned = false;
50485         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
50486 }
50487
50488 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
50489         LDKHTLCOutputInCommitment this_ptr_conv;
50490         this_ptr_conv.inner = untag_ptr(this_ptr);
50491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50493         this_ptr_conv.is_owned = false;
50494         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
50495         return ret_conv;
50496 }
50497
50498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
50499         LDKHTLCOutputInCommitment this_ptr_conv;
50500         this_ptr_conv.inner = untag_ptr(this_ptr);
50501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50503         this_ptr_conv.is_owned = false;
50504         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
50505 }
50506
50507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
50508         LDKHTLCOutputInCommitment this_ptr_conv;
50509         this_ptr_conv.inner = untag_ptr(this_ptr);
50510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50512         this_ptr_conv.is_owned = false;
50513         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
50514         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
50515         return ret_arr;
50516 }
50517
50518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50519         LDKHTLCOutputInCommitment this_ptr_conv;
50520         this_ptr_conv.inner = untag_ptr(this_ptr);
50521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50523         this_ptr_conv.is_owned = false;
50524         LDKThirtyTwoBytes val_ref;
50525         CHECK((*env)->GetArrayLength(env, val) == 32);
50526         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
50527         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
50528 }
50529
50530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
50531         LDKHTLCOutputInCommitment this_ptr_conv;
50532         this_ptr_conv.inner = untag_ptr(this_ptr);
50533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50535         this_ptr_conv.is_owned = false;
50536         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
50537         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
50538         int64_t ret_ref = tag_ptr(ret_copy, true);
50539         return ret_ref;
50540 }
50541
50542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50543         LDKHTLCOutputInCommitment this_ptr_conv;
50544         this_ptr_conv.inner = untag_ptr(this_ptr);
50545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50547         this_ptr_conv.is_owned = false;
50548         void* val_ptr = untag_ptr(val);
50549         CHECK_ACCESS(val_ptr);
50550         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
50551         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
50552         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
50553 }
50554
50555 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) {
50556         LDKThirtyTwoBytes payment_hash_arg_ref;
50557         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
50558         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
50559         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
50560         CHECK_ACCESS(transaction_output_index_arg_ptr);
50561         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
50562         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
50563         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
50564         int64_t ret_ref = 0;
50565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50567         return ret_ref;
50568 }
50569
50570 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
50571         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
50572         int64_t ret_ref = 0;
50573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50575         return ret_ref;
50576 }
50577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50578         LDKHTLCOutputInCommitment arg_conv;
50579         arg_conv.inner = untag_ptr(arg);
50580         arg_conv.is_owned = ptr_is_owned(arg);
50581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50582         arg_conv.is_owned = false;
50583         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
50584         return ret_conv;
50585 }
50586
50587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50588         LDKHTLCOutputInCommitment orig_conv;
50589         orig_conv.inner = untag_ptr(orig);
50590         orig_conv.is_owned = ptr_is_owned(orig);
50591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50592         orig_conv.is_owned = false;
50593         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
50594         int64_t ret_ref = 0;
50595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50597         return ret_ref;
50598 }
50599
50600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50601         LDKHTLCOutputInCommitment a_conv;
50602         a_conv.inner = untag_ptr(a);
50603         a_conv.is_owned = ptr_is_owned(a);
50604         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50605         a_conv.is_owned = false;
50606         LDKHTLCOutputInCommitment b_conv;
50607         b_conv.inner = untag_ptr(b);
50608         b_conv.is_owned = ptr_is_owned(b);
50609         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50610         b_conv.is_owned = false;
50611         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
50612         return ret_conv;
50613 }
50614
50615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
50616         LDKHTLCOutputInCommitment obj_conv;
50617         obj_conv.inner = untag_ptr(obj);
50618         obj_conv.is_owned = ptr_is_owned(obj);
50619         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50620         obj_conv.is_owned = false;
50621         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
50622         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50623         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50624         CVec_u8Z_free(ret_var);
50625         return ret_arr;
50626 }
50627
50628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50629         LDKu8slice ser_ref;
50630         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50631         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50632         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
50633         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
50634         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50635         return tag_ptr(ret_conv, true);
50636 }
50637
50638 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) {
50639         LDKHTLCOutputInCommitment htlc_conv;
50640         htlc_conv.inner = untag_ptr(htlc);
50641         htlc_conv.is_owned = ptr_is_owned(htlc);
50642         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
50643         htlc_conv.is_owned = false;
50644         LDKChannelTypeFeatures channel_type_features_conv;
50645         channel_type_features_conv.inner = untag_ptr(channel_type_features);
50646         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
50647         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
50648         channel_type_features_conv.is_owned = false;
50649         LDKTxCreationKeys keys_conv;
50650         keys_conv.inner = untag_ptr(keys);
50651         keys_conv.is_owned = ptr_is_owned(keys);
50652         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
50653         keys_conv.is_owned = false;
50654         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
50655         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50656         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50657         CVec_u8Z_free(ret_var);
50658         return ret_arr;
50659 }
50660
50661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
50662         LDKPublicKey broadcaster_ref;
50663         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
50664         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
50665         LDKPublicKey countersignatory_ref;
50666         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
50667         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
50668         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
50669         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50670         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50671         CVec_u8Z_free(ret_var);
50672         return ret_arr;
50673 }
50674
50675 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) {
50676         uint8_t commitment_txid_arr[32];
50677         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
50678         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
50679         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
50680         LDKHTLCOutputInCommitment htlc_conv;
50681         htlc_conv.inner = untag_ptr(htlc);
50682         htlc_conv.is_owned = ptr_is_owned(htlc);
50683         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
50684         htlc_conv.is_owned = false;
50685         LDKChannelTypeFeatures channel_type_features_conv;
50686         channel_type_features_conv.inner = untag_ptr(channel_type_features);
50687         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
50688         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
50689         channel_type_features_conv.is_owned = false;
50690         LDKPublicKey broadcaster_delayed_payment_key_ref;
50691         CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
50692         (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
50693         LDKPublicKey revocation_key_ref;
50694         CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
50695         (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
50696         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);
50697         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50698         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50699         Transaction_free(ret_var);
50700         return ret_arr;
50701 }
50702
50703 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) {
50704         LDKSignature local_sig_ref;
50705         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
50706         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
50707         LDKSignature remote_sig_ref;
50708         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
50709         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
50710         void* preimage_ptr = untag_ptr(preimage);
50711         CHECK_ACCESS(preimage_ptr);
50712         LDKCOption_PaymentPreimageZ preimage_conv = *(LDKCOption_PaymentPreimageZ*)(preimage_ptr);
50713         preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(preimage));
50714         LDKu8slice redeem_script_ref;
50715         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
50716         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
50717         LDKChannelTypeFeatures channel_type_features_conv;
50718         channel_type_features_conv.inner = untag_ptr(channel_type_features);
50719         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
50720         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
50721         channel_type_features_conv.is_owned = false;
50722         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
50723         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50724         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50725         Witness_free(ret_var);
50726         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
50727         return ret_arr;
50728 }
50729
50730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
50731         LDKPublicKey payment_point_ref;
50732         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
50733         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
50734         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
50735         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50736         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50737         CVec_u8Z_free(ret_var);
50738         return ret_arr;
50739 }
50740
50741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
50742         LDKPublicKey funding_pubkey_ref;
50743         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
50744         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
50745         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
50746         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50747         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50748         CVec_u8Z_free(ret_var);
50749         return ret_arr;
50750 }
50751
50752 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) {
50753         LDKPublicKey funding_key_ref;
50754         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
50755         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
50756         LDKSignature funding_sig_ref;
50757         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
50758         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
50759         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
50760         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50761         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50762         Witness_free(ret_var);
50763         return ret_arr;
50764 }
50765
50766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50767         LDKChannelTransactionParameters this_obj_conv;
50768         this_obj_conv.inner = untag_ptr(this_obj);
50769         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50771         ChannelTransactionParameters_free(this_obj_conv);
50772 }
50773
50774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
50775         LDKChannelTransactionParameters this_ptr_conv;
50776         this_ptr_conv.inner = untag_ptr(this_ptr);
50777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50779         this_ptr_conv.is_owned = false;
50780         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
50781         int64_t ret_ref = 0;
50782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50784         return ret_ref;
50785 }
50786
50787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50788         LDKChannelTransactionParameters this_ptr_conv;
50789         this_ptr_conv.inner = untag_ptr(this_ptr);
50790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50792         this_ptr_conv.is_owned = false;
50793         LDKChannelPublicKeys val_conv;
50794         val_conv.inner = untag_ptr(val);
50795         val_conv.is_owned = ptr_is_owned(val);
50796         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50797         val_conv = ChannelPublicKeys_clone(&val_conv);
50798         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
50799 }
50800
50801 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
50802         LDKChannelTransactionParameters this_ptr_conv;
50803         this_ptr_conv.inner = untag_ptr(this_ptr);
50804         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50806         this_ptr_conv.is_owned = false;
50807         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
50808         return ret_conv;
50809 }
50810
50811 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) {
50812         LDKChannelTransactionParameters this_ptr_conv;
50813         this_ptr_conv.inner = untag_ptr(this_ptr);
50814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50816         this_ptr_conv.is_owned = false;
50817         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
50818 }
50819
50820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
50821         LDKChannelTransactionParameters this_ptr_conv;
50822         this_ptr_conv.inner = untag_ptr(this_ptr);
50823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50825         this_ptr_conv.is_owned = false;
50826         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
50827         return ret_conv;
50828 }
50829
50830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
50831         LDKChannelTransactionParameters this_ptr_conv;
50832         this_ptr_conv.inner = untag_ptr(this_ptr);
50833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50835         this_ptr_conv.is_owned = false;
50836         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
50837 }
50838
50839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
50840         LDKChannelTransactionParameters this_ptr_conv;
50841         this_ptr_conv.inner = untag_ptr(this_ptr);
50842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50844         this_ptr_conv.is_owned = false;
50845         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
50846         int64_t ret_ref = 0;
50847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50849         return ret_ref;
50850 }
50851
50852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50853         LDKChannelTransactionParameters this_ptr_conv;
50854         this_ptr_conv.inner = untag_ptr(this_ptr);
50855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50857         this_ptr_conv.is_owned = false;
50858         LDKCounterpartyChannelTransactionParameters val_conv;
50859         val_conv.inner = untag_ptr(val);
50860         val_conv.is_owned = ptr_is_owned(val);
50861         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50862         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
50863         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
50864 }
50865
50866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
50867         LDKChannelTransactionParameters this_ptr_conv;
50868         this_ptr_conv.inner = untag_ptr(this_ptr);
50869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50871         this_ptr_conv.is_owned = false;
50872         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
50873         int64_t ret_ref = 0;
50874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50876         return ret_ref;
50877 }
50878
50879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50880         LDKChannelTransactionParameters this_ptr_conv;
50881         this_ptr_conv.inner = untag_ptr(this_ptr);
50882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50884         this_ptr_conv.is_owned = false;
50885         LDKOutPoint val_conv;
50886         val_conv.inner = untag_ptr(val);
50887         val_conv.is_owned = ptr_is_owned(val);
50888         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50889         val_conv = OutPoint_clone(&val_conv);
50890         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
50891 }
50892
50893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
50894         LDKChannelTransactionParameters this_ptr_conv;
50895         this_ptr_conv.inner = untag_ptr(this_ptr);
50896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50898         this_ptr_conv.is_owned = false;
50899         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
50900         int64_t ret_ref = 0;
50901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50903         return ret_ref;
50904 }
50905
50906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50907         LDKChannelTransactionParameters this_ptr_conv;
50908         this_ptr_conv.inner = untag_ptr(this_ptr);
50909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50911         this_ptr_conv.is_owned = false;
50912         LDKChannelTypeFeatures val_conv;
50913         val_conv.inner = untag_ptr(val);
50914         val_conv.is_owned = ptr_is_owned(val);
50915         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50916         val_conv = ChannelTypeFeatures_clone(&val_conv);
50917         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
50918 }
50919
50920 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) {
50921         LDKChannelPublicKeys holder_pubkeys_arg_conv;
50922         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
50923         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
50924         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
50925         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
50926         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
50927         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
50928         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
50929         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
50930         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
50931         LDKOutPoint funding_outpoint_arg_conv;
50932         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
50933         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
50934         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
50935         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
50936         LDKChannelTypeFeatures channel_type_features_arg_conv;
50937         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
50938         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
50939         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
50940         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
50941         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);
50942         int64_t ret_ref = 0;
50943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50945         return ret_ref;
50946 }
50947
50948 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
50949         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
50950         int64_t ret_ref = 0;
50951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50953         return ret_ref;
50954 }
50955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50956         LDKChannelTransactionParameters arg_conv;
50957         arg_conv.inner = untag_ptr(arg);
50958         arg_conv.is_owned = ptr_is_owned(arg);
50959         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50960         arg_conv.is_owned = false;
50961         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
50962         return ret_conv;
50963 }
50964
50965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50966         LDKChannelTransactionParameters orig_conv;
50967         orig_conv.inner = untag_ptr(orig);
50968         orig_conv.is_owned = ptr_is_owned(orig);
50969         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50970         orig_conv.is_owned = false;
50971         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
50972         int64_t ret_ref = 0;
50973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50975         return ret_ref;
50976 }
50977
50978 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50979         LDKChannelTransactionParameters a_conv;
50980         a_conv.inner = untag_ptr(a);
50981         a_conv.is_owned = ptr_is_owned(a);
50982         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50983         a_conv.is_owned = false;
50984         LDKChannelTransactionParameters b_conv;
50985         b_conv.inner = untag_ptr(b);
50986         b_conv.is_owned = ptr_is_owned(b);
50987         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50988         b_conv.is_owned = false;
50989         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
50990         return ret_conv;
50991 }
50992
50993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50994         LDKCounterpartyChannelTransactionParameters this_obj_conv;
50995         this_obj_conv.inner = untag_ptr(this_obj);
50996         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50998         CounterpartyChannelTransactionParameters_free(this_obj_conv);
50999 }
51000
51001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
51002         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
51003         this_ptr_conv.inner = untag_ptr(this_ptr);
51004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51006         this_ptr_conv.is_owned = false;
51007         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
51008         int64_t ret_ref = 0;
51009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51011         return ret_ref;
51012 }
51013
51014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51015         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
51016         this_ptr_conv.inner = untag_ptr(this_ptr);
51017         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51019         this_ptr_conv.is_owned = false;
51020         LDKChannelPublicKeys val_conv;
51021         val_conv.inner = untag_ptr(val);
51022         val_conv.is_owned = ptr_is_owned(val);
51023         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51024         val_conv = ChannelPublicKeys_clone(&val_conv);
51025         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
51026 }
51027
51028 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
51029         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
51030         this_ptr_conv.inner = untag_ptr(this_ptr);
51031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51033         this_ptr_conv.is_owned = false;
51034         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
51035         return ret_conv;
51036 }
51037
51038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
51039         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
51040         this_ptr_conv.inner = untag_ptr(this_ptr);
51041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51043         this_ptr_conv.is_owned = false;
51044         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
51045 }
51046
51047 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) {
51048         LDKChannelPublicKeys pubkeys_arg_conv;
51049         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
51050         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
51051         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
51052         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
51053         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
51054         int64_t ret_ref = 0;
51055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51057         return ret_ref;
51058 }
51059
51060 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
51061         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
51062         int64_t ret_ref = 0;
51063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51065         return ret_ref;
51066 }
51067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51068         LDKCounterpartyChannelTransactionParameters arg_conv;
51069         arg_conv.inner = untag_ptr(arg);
51070         arg_conv.is_owned = ptr_is_owned(arg);
51071         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51072         arg_conv.is_owned = false;
51073         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
51074         return ret_conv;
51075 }
51076
51077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51078         LDKCounterpartyChannelTransactionParameters orig_conv;
51079         orig_conv.inner = untag_ptr(orig);
51080         orig_conv.is_owned = ptr_is_owned(orig);
51081         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51082         orig_conv.is_owned = false;
51083         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
51084         int64_t ret_ref = 0;
51085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51087         return ret_ref;
51088 }
51089
51090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51091         LDKCounterpartyChannelTransactionParameters a_conv;
51092         a_conv.inner = untag_ptr(a);
51093         a_conv.is_owned = ptr_is_owned(a);
51094         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51095         a_conv.is_owned = false;
51096         LDKCounterpartyChannelTransactionParameters b_conv;
51097         b_conv.inner = untag_ptr(b);
51098         b_conv.is_owned = ptr_is_owned(b);
51099         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51100         b_conv.is_owned = false;
51101         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
51102         return ret_conv;
51103 }
51104
51105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
51106         LDKChannelTransactionParameters this_arg_conv;
51107         this_arg_conv.inner = untag_ptr(this_arg);
51108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51110         this_arg_conv.is_owned = false;
51111         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
51112         return ret_conv;
51113 }
51114
51115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
51116         LDKChannelTransactionParameters this_arg_conv;
51117         this_arg_conv.inner = untag_ptr(this_arg);
51118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51120         this_arg_conv.is_owned = false;
51121         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
51122         int64_t ret_ref = 0;
51123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51125         return ret_ref;
51126 }
51127
51128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
51129         LDKChannelTransactionParameters this_arg_conv;
51130         this_arg_conv.inner = untag_ptr(this_arg);
51131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51133         this_arg_conv.is_owned = false;
51134         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
51135         int64_t ret_ref = 0;
51136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51138         return ret_ref;
51139 }
51140
51141 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
51142         LDKCounterpartyChannelTransactionParameters obj_conv;
51143         obj_conv.inner = untag_ptr(obj);
51144         obj_conv.is_owned = ptr_is_owned(obj);
51145         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51146         obj_conv.is_owned = false;
51147         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
51148         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51149         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51150         CVec_u8Z_free(ret_var);
51151         return ret_arr;
51152 }
51153
51154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51155         LDKu8slice ser_ref;
51156         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51157         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51158         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
51159         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
51160         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51161         return tag_ptr(ret_conv, true);
51162 }
51163
51164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
51165         LDKChannelTransactionParameters obj_conv;
51166         obj_conv.inner = untag_ptr(obj);
51167         obj_conv.is_owned = ptr_is_owned(obj);
51168         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51169         obj_conv.is_owned = false;
51170         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
51171         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51172         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51173         CVec_u8Z_free(ret_var);
51174         return ret_arr;
51175 }
51176
51177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51178         LDKu8slice ser_ref;
51179         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51180         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51181         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
51182         *ret_conv = ChannelTransactionParameters_read(ser_ref);
51183         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51184         return tag_ptr(ret_conv, true);
51185 }
51186
51187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51188         LDKDirectedChannelTransactionParameters this_obj_conv;
51189         this_obj_conv.inner = untag_ptr(this_obj);
51190         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51192         DirectedChannelTransactionParameters_free(this_obj_conv);
51193 }
51194
51195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
51196         LDKDirectedChannelTransactionParameters this_arg_conv;
51197         this_arg_conv.inner = untag_ptr(this_arg);
51198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51200         this_arg_conv.is_owned = false;
51201         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
51202         int64_t ret_ref = 0;
51203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51205         return ret_ref;
51206 }
51207
51208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
51209         LDKDirectedChannelTransactionParameters this_arg_conv;
51210         this_arg_conv.inner = untag_ptr(this_arg);
51211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51213         this_arg_conv.is_owned = false;
51214         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
51215         int64_t ret_ref = 0;
51216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51218         return ret_ref;
51219 }
51220
51221 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
51222         LDKDirectedChannelTransactionParameters this_arg_conv;
51223         this_arg_conv.inner = untag_ptr(this_arg);
51224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51226         this_arg_conv.is_owned = false;
51227         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
51228         return ret_conv;
51229 }
51230
51231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
51232         LDKDirectedChannelTransactionParameters this_arg_conv;
51233         this_arg_conv.inner = untag_ptr(this_arg);
51234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51236         this_arg_conv.is_owned = false;
51237         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
51238         return ret_conv;
51239 }
51240
51241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
51242         LDKDirectedChannelTransactionParameters this_arg_conv;
51243         this_arg_conv.inner = untag_ptr(this_arg);
51244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51246         this_arg_conv.is_owned = false;
51247         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
51248         int64_t ret_ref = 0;
51249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51251         return ret_ref;
51252 }
51253
51254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
51255         LDKDirectedChannelTransactionParameters this_arg_conv;
51256         this_arg_conv.inner = untag_ptr(this_arg);
51257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51259         this_arg_conv.is_owned = false;
51260         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
51261         int64_t ret_ref = 0;
51262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51264         return ret_ref;
51265 }
51266
51267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51268         LDKHolderCommitmentTransaction this_obj_conv;
51269         this_obj_conv.inner = untag_ptr(this_obj);
51270         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51272         HolderCommitmentTransaction_free(this_obj_conv);
51273 }
51274
51275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
51276         LDKHolderCommitmentTransaction this_ptr_conv;
51277         this_ptr_conv.inner = untag_ptr(this_ptr);
51278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51280         this_ptr_conv.is_owned = false;
51281         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51282         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
51283         return ret_arr;
51284 }
51285
51286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51287         LDKHolderCommitmentTransaction this_ptr_conv;
51288         this_ptr_conv.inner = untag_ptr(this_ptr);
51289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51291         this_ptr_conv.is_owned = false;
51292         LDKSignature val_ref;
51293         CHECK((*env)->GetArrayLength(env, val) == 64);
51294         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
51295         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
51296 }
51297
51298 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
51299         LDKHolderCommitmentTransaction this_ptr_conv;
51300         this_ptr_conv.inner = untag_ptr(this_ptr);
51301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51303         this_ptr_conv.is_owned = false;
51304         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
51305         jobjectArray ret_arr = NULL;
51306         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
51307         ;
51308         for (size_t i = 0; i < ret_var.datalen; i++) {
51309                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
51310                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
51311                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
51312         }
51313         
51314         FREE(ret_var.data);
51315         return ret_arr;
51316 }
51317
51318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
51319         LDKHolderCommitmentTransaction this_ptr_conv;
51320         this_ptr_conv.inner = untag_ptr(this_ptr);
51321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51323         this_ptr_conv.is_owned = false;
51324         LDKCVec_SignatureZ val_constr;
51325         val_constr.datalen = (*env)->GetArrayLength(env, val);
51326         if (val_constr.datalen > 0)
51327                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
51328         else
51329                 val_constr.data = NULL;
51330         for (size_t i = 0; i < val_constr.datalen; i++) {
51331                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
51332                 LDKSignature val_conv_8_ref;
51333                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
51334                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
51335                 val_constr.data[i] = val_conv_8_ref;
51336         }
51337         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
51338 }
51339
51340 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
51341         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
51342         int64_t ret_ref = 0;
51343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51345         return ret_ref;
51346 }
51347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51348         LDKHolderCommitmentTransaction arg_conv;
51349         arg_conv.inner = untag_ptr(arg);
51350         arg_conv.is_owned = ptr_is_owned(arg);
51351         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51352         arg_conv.is_owned = false;
51353         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
51354         return ret_conv;
51355 }
51356
51357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51358         LDKHolderCommitmentTransaction orig_conv;
51359         orig_conv.inner = untag_ptr(orig);
51360         orig_conv.is_owned = ptr_is_owned(orig);
51361         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51362         orig_conv.is_owned = false;
51363         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
51364         int64_t ret_ref = 0;
51365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51367         return ret_ref;
51368 }
51369
51370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
51371         LDKHolderCommitmentTransaction obj_conv;
51372         obj_conv.inner = untag_ptr(obj);
51373         obj_conv.is_owned = ptr_is_owned(obj);
51374         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51375         obj_conv.is_owned = false;
51376         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
51377         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51378         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51379         CVec_u8Z_free(ret_var);
51380         return ret_arr;
51381 }
51382
51383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51384         LDKu8slice ser_ref;
51385         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51386         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51387         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
51388         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
51389         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51390         return tag_ptr(ret_conv, true);
51391 }
51392
51393 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) {
51394         LDKCommitmentTransaction commitment_tx_conv;
51395         commitment_tx_conv.inner = untag_ptr(commitment_tx);
51396         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
51397         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
51398         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
51399         LDKSignature counterparty_sig_ref;
51400         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
51401         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
51402         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
51403         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
51404         if (counterparty_htlc_sigs_constr.datalen > 0)
51405                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
51406         else
51407                 counterparty_htlc_sigs_constr.data = NULL;
51408         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
51409                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
51410                 LDKSignature counterparty_htlc_sigs_conv_8_ref;
51411                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
51412                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
51413                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
51414         }
51415         LDKPublicKey holder_funding_key_ref;
51416         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
51417         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
51418         LDKPublicKey counterparty_funding_key_ref;
51419         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
51420         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
51421         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
51422         int64_t ret_ref = 0;
51423         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51424         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51425         return ret_ref;
51426 }
51427
51428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51429         LDKBuiltCommitmentTransaction this_obj_conv;
51430         this_obj_conv.inner = untag_ptr(this_obj);
51431         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51433         BuiltCommitmentTransaction_free(this_obj_conv);
51434 }
51435
51436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
51437         LDKBuiltCommitmentTransaction this_ptr_conv;
51438         this_ptr_conv.inner = untag_ptr(this_ptr);
51439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51441         this_ptr_conv.is_owned = false;
51442         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
51443         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51444         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51445         Transaction_free(ret_var);
51446         return ret_arr;
51447 }
51448
51449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51450         LDKBuiltCommitmentTransaction this_ptr_conv;
51451         this_ptr_conv.inner = untag_ptr(this_ptr);
51452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51454         this_ptr_conv.is_owned = false;
51455         LDKTransaction val_ref;
51456         val_ref.datalen = (*env)->GetArrayLength(env, val);
51457         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
51458         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
51459         val_ref.data_is_owned = true;
51460         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
51461 }
51462
51463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
51464         LDKBuiltCommitmentTransaction this_ptr_conv;
51465         this_ptr_conv.inner = untag_ptr(this_ptr);
51466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51468         this_ptr_conv.is_owned = false;
51469         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51470         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
51471         return ret_arr;
51472 }
51473
51474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51475         LDKBuiltCommitmentTransaction this_ptr_conv;
51476         this_ptr_conv.inner = untag_ptr(this_ptr);
51477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51479         this_ptr_conv.is_owned = false;
51480         LDKThirtyTwoBytes val_ref;
51481         CHECK((*env)->GetArrayLength(env, val) == 32);
51482         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51483         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
51484 }
51485
51486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
51487         LDKTransaction transaction_arg_ref;
51488         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
51489         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
51490         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
51491         transaction_arg_ref.data_is_owned = true;
51492         LDKThirtyTwoBytes txid_arg_ref;
51493         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
51494         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
51495         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
51496         int64_t ret_ref = 0;
51497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51499         return ret_ref;
51500 }
51501
51502 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
51503         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
51504         int64_t ret_ref = 0;
51505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51507         return ret_ref;
51508 }
51509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51510         LDKBuiltCommitmentTransaction arg_conv;
51511         arg_conv.inner = untag_ptr(arg);
51512         arg_conv.is_owned = ptr_is_owned(arg);
51513         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51514         arg_conv.is_owned = false;
51515         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
51516         return ret_conv;
51517 }
51518
51519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51520         LDKBuiltCommitmentTransaction orig_conv;
51521         orig_conv.inner = untag_ptr(orig);
51522         orig_conv.is_owned = ptr_is_owned(orig);
51523         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51524         orig_conv.is_owned = false;
51525         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
51526         int64_t ret_ref = 0;
51527         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51528         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51529         return ret_ref;
51530 }
51531
51532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
51533         LDKBuiltCommitmentTransaction obj_conv;
51534         obj_conv.inner = untag_ptr(obj);
51535         obj_conv.is_owned = ptr_is_owned(obj);
51536         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51537         obj_conv.is_owned = false;
51538         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
51539         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51540         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51541         CVec_u8Z_free(ret_var);
51542         return ret_arr;
51543 }
51544
51545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51546         LDKu8slice ser_ref;
51547         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51548         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51549         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
51550         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
51551         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51552         return tag_ptr(ret_conv, true);
51553 }
51554
51555 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) {
51556         LDKBuiltCommitmentTransaction this_arg_conv;
51557         this_arg_conv.inner = untag_ptr(this_arg);
51558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51560         this_arg_conv.is_owned = false;
51561         LDKu8slice funding_redeemscript_ref;
51562         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51563         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51564         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51565         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
51566         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51567         return ret_arr;
51568 }
51569
51570 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) {
51571         LDKBuiltCommitmentTransaction this_arg_conv;
51572         this_arg_conv.inner = untag_ptr(this_arg);
51573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51575         this_arg_conv.is_owned = false;
51576         uint8_t funding_key_arr[32];
51577         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
51578         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
51579         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
51580         LDKu8slice funding_redeemscript_ref;
51581         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51582         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51583         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51584         (*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);
51585         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51586         return ret_arr;
51587 }
51588
51589 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) {
51590         LDKBuiltCommitmentTransaction this_arg_conv;
51591         this_arg_conv.inner = untag_ptr(this_arg);
51592         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51594         this_arg_conv.is_owned = false;
51595         uint8_t funding_key_arr[32];
51596         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
51597         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
51598         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
51599         LDKu8slice funding_redeemscript_ref;
51600         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51601         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51602         void* entropy_source_ptr = untag_ptr(entropy_source);
51603         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
51604         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
51605         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51606         (*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);
51607         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51608         return ret_arr;
51609 }
51610
51611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51612         LDKClosingTransaction this_obj_conv;
51613         this_obj_conv.inner = untag_ptr(this_obj);
51614         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51616         ClosingTransaction_free(this_obj_conv);
51617 }
51618
51619 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
51620         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
51621         int64_t ret_ref = 0;
51622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51624         return ret_ref;
51625 }
51626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51627         LDKClosingTransaction arg_conv;
51628         arg_conv.inner = untag_ptr(arg);
51629         arg_conv.is_owned = ptr_is_owned(arg);
51630         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51631         arg_conv.is_owned = false;
51632         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
51633         return ret_conv;
51634 }
51635
51636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51637         LDKClosingTransaction orig_conv;
51638         orig_conv.inner = untag_ptr(orig);
51639         orig_conv.is_owned = ptr_is_owned(orig);
51640         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51641         orig_conv.is_owned = false;
51642         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
51643         int64_t ret_ref = 0;
51644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51646         return ret_ref;
51647 }
51648
51649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
51650         LDKClosingTransaction o_conv;
51651         o_conv.inner = untag_ptr(o);
51652         o_conv.is_owned = ptr_is_owned(o);
51653         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51654         o_conv.is_owned = false;
51655         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
51656         return ret_conv;
51657 }
51658
51659 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51660         LDKClosingTransaction a_conv;
51661         a_conv.inner = untag_ptr(a);
51662         a_conv.is_owned = ptr_is_owned(a);
51663         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51664         a_conv.is_owned = false;
51665         LDKClosingTransaction b_conv;
51666         b_conv.inner = untag_ptr(b);
51667         b_conv.is_owned = ptr_is_owned(b);
51668         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51669         b_conv.is_owned = false;
51670         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
51671         return ret_conv;
51672 }
51673
51674 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) {
51675         LDKCVec_u8Z to_holder_script_ref;
51676         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
51677         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
51678         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
51679         LDKCVec_u8Z to_counterparty_script_ref;
51680         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
51681         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
51682         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
51683         LDKOutPoint funding_outpoint_conv;
51684         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
51685         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
51686         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
51687         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
51688         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
51689         int64_t ret_ref = 0;
51690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51692         return ret_ref;
51693 }
51694
51695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
51696         LDKClosingTransaction this_arg_conv;
51697         this_arg_conv.inner = untag_ptr(this_arg);
51698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51700         this_arg_conv.is_owned = false;
51701         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
51702         int64_t ret_ref = 0;
51703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51705         return ret_ref;
51706 }
51707
51708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
51709         LDKClosingTransaction this_arg_conv;
51710         this_arg_conv.inner = untag_ptr(this_arg);
51711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51713         this_arg_conv.is_owned = false;
51714         LDKOutPoint funding_outpoint_conv;
51715         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
51716         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
51717         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
51718         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
51719         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
51720         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
51721         return tag_ptr(ret_conv, true);
51722 }
51723
51724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
51725         LDKClosingTransaction this_arg_conv;
51726         this_arg_conv.inner = untag_ptr(this_arg);
51727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51729         this_arg_conv.is_owned = false;
51730         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
51731         return ret_conv;
51732 }
51733
51734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
51735         LDKClosingTransaction this_arg_conv;
51736         this_arg_conv.inner = untag_ptr(this_arg);
51737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51739         this_arg_conv.is_owned = false;
51740         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
51741         return ret_conv;
51742 }
51743
51744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
51745         LDKClosingTransaction this_arg_conv;
51746         this_arg_conv.inner = untag_ptr(this_arg);
51747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51749         this_arg_conv.is_owned = false;
51750         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
51751         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51752         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51753         return ret_arr;
51754 }
51755
51756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
51757         LDKClosingTransaction this_arg_conv;
51758         this_arg_conv.inner = untag_ptr(this_arg);
51759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51761         this_arg_conv.is_owned = false;
51762         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
51763         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51764         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51765         return ret_arr;
51766 }
51767
51768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51769         LDKTrustedClosingTransaction this_obj_conv;
51770         this_obj_conv.inner = untag_ptr(this_obj);
51771         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51773         TrustedClosingTransaction_free(this_obj_conv);
51774 }
51775
51776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
51777         LDKTrustedClosingTransaction this_arg_conv;
51778         this_arg_conv.inner = untag_ptr(this_arg);
51779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51781         this_arg_conv.is_owned = false;
51782         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
51783         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51784         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51785         Transaction_free(ret_var);
51786         return ret_arr;
51787 }
51788
51789 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) {
51790         LDKTrustedClosingTransaction this_arg_conv;
51791         this_arg_conv.inner = untag_ptr(this_arg);
51792         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51794         this_arg_conv.is_owned = false;
51795         LDKu8slice funding_redeemscript_ref;
51796         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51797         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51798         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51799         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
51800         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51801         return ret_arr;
51802 }
51803
51804 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) {
51805         LDKTrustedClosingTransaction this_arg_conv;
51806         this_arg_conv.inner = untag_ptr(this_arg);
51807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51809         this_arg_conv.is_owned = false;
51810         uint8_t funding_key_arr[32];
51811         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
51812         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
51813         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
51814         LDKu8slice funding_redeemscript_ref;
51815         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
51816         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
51817         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
51818         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
51819         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
51820         return ret_arr;
51821 }
51822
51823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51824         LDKCommitmentTransaction this_obj_conv;
51825         this_obj_conv.inner = untag_ptr(this_obj);
51826         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51828         CommitmentTransaction_free(this_obj_conv);
51829 }
51830
51831 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
51832         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
51833         int64_t ret_ref = 0;
51834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51836         return ret_ref;
51837 }
51838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51839         LDKCommitmentTransaction arg_conv;
51840         arg_conv.inner = untag_ptr(arg);
51841         arg_conv.is_owned = ptr_is_owned(arg);
51842         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51843         arg_conv.is_owned = false;
51844         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
51845         return ret_conv;
51846 }
51847
51848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51849         LDKCommitmentTransaction orig_conv;
51850         orig_conv.inner = untag_ptr(orig);
51851         orig_conv.is_owned = ptr_is_owned(orig);
51852         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51853         orig_conv.is_owned = false;
51854         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
51855         int64_t ret_ref = 0;
51856         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51857         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51858         return ret_ref;
51859 }
51860
51861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
51862         LDKCommitmentTransaction obj_conv;
51863         obj_conv.inner = untag_ptr(obj);
51864         obj_conv.is_owned = ptr_is_owned(obj);
51865         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51866         obj_conv.is_owned = false;
51867         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
51868         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
51869         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
51870         CVec_u8Z_free(ret_var);
51871         return ret_arr;
51872 }
51873
51874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
51875         LDKu8slice ser_ref;
51876         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
51877         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
51878         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
51879         *ret_conv = CommitmentTransaction_read(ser_ref);
51880         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
51881         return tag_ptr(ret_conv, true);
51882 }
51883
51884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
51885         LDKCommitmentTransaction this_arg_conv;
51886         this_arg_conv.inner = untag_ptr(this_arg);
51887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51889         this_arg_conv.is_owned = false;
51890         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
51891         return ret_conv;
51892 }
51893
51894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
51895         LDKCommitmentTransaction this_arg_conv;
51896         this_arg_conv.inner = untag_ptr(this_arg);
51897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51899         this_arg_conv.is_owned = false;
51900         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
51901         return ret_conv;
51902 }
51903
51904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
51905         LDKCommitmentTransaction this_arg_conv;
51906         this_arg_conv.inner = untag_ptr(this_arg);
51907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51909         this_arg_conv.is_owned = false;
51910         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
51911         return ret_conv;
51912 }
51913
51914 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
51915         LDKCommitmentTransaction this_arg_conv;
51916         this_arg_conv.inner = untag_ptr(this_arg);
51917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51919         this_arg_conv.is_owned = false;
51920         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
51921         return ret_conv;
51922 }
51923
51924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
51925         LDKCommitmentTransaction this_arg_conv;
51926         this_arg_conv.inner = untag_ptr(this_arg);
51927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51929         this_arg_conv.is_owned = false;
51930         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
51931         int64_t ret_ref = 0;
51932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51934         return ret_ref;
51935 }
51936
51937 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) {
51938         LDKCommitmentTransaction this_arg_conv;
51939         this_arg_conv.inner = untag_ptr(this_arg);
51940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51942         this_arg_conv.is_owned = false;
51943         LDKDirectedChannelTransactionParameters channel_parameters_conv;
51944         channel_parameters_conv.inner = untag_ptr(channel_parameters);
51945         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
51946         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
51947         channel_parameters_conv.is_owned = false;
51948         LDKChannelPublicKeys broadcaster_keys_conv;
51949         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
51950         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
51951         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
51952         broadcaster_keys_conv.is_owned = false;
51953         LDKChannelPublicKeys countersignatory_keys_conv;
51954         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
51955         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
51956         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
51957         countersignatory_keys_conv.is_owned = false;
51958         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
51959         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
51960         return tag_ptr(ret_conv, true);
51961 }
51962
51963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51964         LDKTrustedCommitmentTransaction this_obj_conv;
51965         this_obj_conv.inner = untag_ptr(this_obj);
51966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51968         TrustedCommitmentTransaction_free(this_obj_conv);
51969 }
51970
51971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
51972         LDKTrustedCommitmentTransaction this_arg_conv;
51973         this_arg_conv.inner = untag_ptr(this_arg);
51974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51976         this_arg_conv.is_owned = false;
51977         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51978         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
51979         return ret_arr;
51980 }
51981
51982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
51983         LDKTrustedCommitmentTransaction this_arg_conv;
51984         this_arg_conv.inner = untag_ptr(this_arg);
51985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51987         this_arg_conv.is_owned = false;
51988         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
51989         int64_t ret_ref = 0;
51990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51992         return ret_ref;
51993 }
51994
51995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
51996         LDKTrustedCommitmentTransaction this_arg_conv;
51997         this_arg_conv.inner = untag_ptr(this_arg);
51998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52000         this_arg_conv.is_owned = false;
52001         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
52002         int64_t ret_ref = 0;
52003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52005         return ret_ref;
52006 }
52007
52008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
52009         LDKTrustedCommitmentTransaction this_arg_conv;
52010         this_arg_conv.inner = untag_ptr(this_arg);
52011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52013         this_arg_conv.is_owned = false;
52014         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
52015         int64_t ret_ref = 0;
52016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52018         return ret_ref;
52019 }
52020
52021 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) {
52022         LDKTrustedCommitmentTransaction this_arg_conv;
52023         this_arg_conv.inner = untag_ptr(this_arg);
52024         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52026         this_arg_conv.is_owned = false;
52027         uint8_t htlc_base_key_arr[32];
52028         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
52029         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
52030         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
52031         LDKDirectedChannelTransactionParameters channel_parameters_conv;
52032         channel_parameters_conv.inner = untag_ptr(channel_parameters);
52033         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
52034         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
52035         channel_parameters_conv.is_owned = false;
52036         void* entropy_source_ptr = untag_ptr(entropy_source);
52037         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
52038         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
52039         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
52040         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
52041         return tag_ptr(ret_conv, true);
52042 }
52043
52044 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) {
52045         LDKPublicKey broadcaster_payment_basepoint_ref;
52046         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
52047         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
52048         LDKPublicKey countersignatory_payment_basepoint_ref;
52049         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
52050         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
52051         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
52052         return ret_conv;
52053 }
52054
52055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52056         LDKInitFeatures a_conv;
52057         a_conv.inner = untag_ptr(a);
52058         a_conv.is_owned = ptr_is_owned(a);
52059         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52060         a_conv.is_owned = false;
52061         LDKInitFeatures b_conv;
52062         b_conv.inner = untag_ptr(b);
52063         b_conv.is_owned = ptr_is_owned(b);
52064         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52065         b_conv.is_owned = false;
52066         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
52067         return ret_conv;
52068 }
52069
52070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52071         LDKNodeFeatures a_conv;
52072         a_conv.inner = untag_ptr(a);
52073         a_conv.is_owned = ptr_is_owned(a);
52074         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52075         a_conv.is_owned = false;
52076         LDKNodeFeatures b_conv;
52077         b_conv.inner = untag_ptr(b);
52078         b_conv.is_owned = ptr_is_owned(b);
52079         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52080         b_conv.is_owned = false;
52081         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
52082         return ret_conv;
52083 }
52084
52085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52086         LDKChannelFeatures a_conv;
52087         a_conv.inner = untag_ptr(a);
52088         a_conv.is_owned = ptr_is_owned(a);
52089         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52090         a_conv.is_owned = false;
52091         LDKChannelFeatures b_conv;
52092         b_conv.inner = untag_ptr(b);
52093         b_conv.is_owned = ptr_is_owned(b);
52094         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52095         b_conv.is_owned = false;
52096         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
52097         return ret_conv;
52098 }
52099
52100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52101         LDKBolt11InvoiceFeatures a_conv;
52102         a_conv.inner = untag_ptr(a);
52103         a_conv.is_owned = ptr_is_owned(a);
52104         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52105         a_conv.is_owned = false;
52106         LDKBolt11InvoiceFeatures b_conv;
52107         b_conv.inner = untag_ptr(b);
52108         b_conv.is_owned = ptr_is_owned(b);
52109         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52110         b_conv.is_owned = false;
52111         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
52112         return ret_conv;
52113 }
52114
52115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52116         LDKOfferFeatures a_conv;
52117         a_conv.inner = untag_ptr(a);
52118         a_conv.is_owned = ptr_is_owned(a);
52119         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52120         a_conv.is_owned = false;
52121         LDKOfferFeatures b_conv;
52122         b_conv.inner = untag_ptr(b);
52123         b_conv.is_owned = ptr_is_owned(b);
52124         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52125         b_conv.is_owned = false;
52126         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
52127         return ret_conv;
52128 }
52129
52130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52131         LDKInvoiceRequestFeatures a_conv;
52132         a_conv.inner = untag_ptr(a);
52133         a_conv.is_owned = ptr_is_owned(a);
52134         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52135         a_conv.is_owned = false;
52136         LDKInvoiceRequestFeatures b_conv;
52137         b_conv.inner = untag_ptr(b);
52138         b_conv.is_owned = ptr_is_owned(b);
52139         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52140         b_conv.is_owned = false;
52141         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
52142         return ret_conv;
52143 }
52144
52145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52146         LDKBolt12InvoiceFeatures a_conv;
52147         a_conv.inner = untag_ptr(a);
52148         a_conv.is_owned = ptr_is_owned(a);
52149         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52150         a_conv.is_owned = false;
52151         LDKBolt12InvoiceFeatures b_conv;
52152         b_conv.inner = untag_ptr(b);
52153         b_conv.is_owned = ptr_is_owned(b);
52154         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52155         b_conv.is_owned = false;
52156         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
52157         return ret_conv;
52158 }
52159
52160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52161         LDKBlindedHopFeatures a_conv;
52162         a_conv.inner = untag_ptr(a);
52163         a_conv.is_owned = ptr_is_owned(a);
52164         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52165         a_conv.is_owned = false;
52166         LDKBlindedHopFeatures b_conv;
52167         b_conv.inner = untag_ptr(b);
52168         b_conv.is_owned = ptr_is_owned(b);
52169         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52170         b_conv.is_owned = false;
52171         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
52172         return ret_conv;
52173 }
52174
52175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52176         LDKChannelTypeFeatures a_conv;
52177         a_conv.inner = untag_ptr(a);
52178         a_conv.is_owned = ptr_is_owned(a);
52179         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52180         a_conv.is_owned = false;
52181         LDKChannelTypeFeatures b_conv;
52182         b_conv.inner = untag_ptr(b);
52183         b_conv.is_owned = ptr_is_owned(b);
52184         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52185         b_conv.is_owned = false;
52186         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
52187         return ret_conv;
52188 }
52189
52190 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
52191         LDKInitFeatures ret_var = InitFeatures_clone(arg);
52192         int64_t ret_ref = 0;
52193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52195         return ret_ref;
52196 }
52197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52198         LDKInitFeatures arg_conv;
52199         arg_conv.inner = untag_ptr(arg);
52200         arg_conv.is_owned = ptr_is_owned(arg);
52201         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52202         arg_conv.is_owned = false;
52203         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
52204         return ret_conv;
52205 }
52206
52207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52208         LDKInitFeatures orig_conv;
52209         orig_conv.inner = untag_ptr(orig);
52210         orig_conv.is_owned = ptr_is_owned(orig);
52211         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52212         orig_conv.is_owned = false;
52213         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
52214         int64_t ret_ref = 0;
52215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52217         return ret_ref;
52218 }
52219
52220 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
52221         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
52222         int64_t ret_ref = 0;
52223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52225         return ret_ref;
52226 }
52227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52228         LDKNodeFeatures arg_conv;
52229         arg_conv.inner = untag_ptr(arg);
52230         arg_conv.is_owned = ptr_is_owned(arg);
52231         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52232         arg_conv.is_owned = false;
52233         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
52234         return ret_conv;
52235 }
52236
52237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52238         LDKNodeFeatures orig_conv;
52239         orig_conv.inner = untag_ptr(orig);
52240         orig_conv.is_owned = ptr_is_owned(orig);
52241         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52242         orig_conv.is_owned = false;
52243         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
52244         int64_t ret_ref = 0;
52245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52247         return ret_ref;
52248 }
52249
52250 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
52251         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
52252         int64_t ret_ref = 0;
52253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52255         return ret_ref;
52256 }
52257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52258         LDKChannelFeatures arg_conv;
52259         arg_conv.inner = untag_ptr(arg);
52260         arg_conv.is_owned = ptr_is_owned(arg);
52261         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52262         arg_conv.is_owned = false;
52263         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
52264         return ret_conv;
52265 }
52266
52267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52268         LDKChannelFeatures orig_conv;
52269         orig_conv.inner = untag_ptr(orig);
52270         orig_conv.is_owned = ptr_is_owned(orig);
52271         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52272         orig_conv.is_owned = false;
52273         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
52274         int64_t ret_ref = 0;
52275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52277         return ret_ref;
52278 }
52279
52280 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
52281         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
52282         int64_t ret_ref = 0;
52283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52285         return ret_ref;
52286 }
52287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52288         LDKBolt11InvoiceFeatures arg_conv;
52289         arg_conv.inner = untag_ptr(arg);
52290         arg_conv.is_owned = ptr_is_owned(arg);
52291         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52292         arg_conv.is_owned = false;
52293         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
52294         return ret_conv;
52295 }
52296
52297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52298         LDKBolt11InvoiceFeatures orig_conv;
52299         orig_conv.inner = untag_ptr(orig);
52300         orig_conv.is_owned = ptr_is_owned(orig);
52301         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52302         orig_conv.is_owned = false;
52303         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
52304         int64_t ret_ref = 0;
52305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52307         return ret_ref;
52308 }
52309
52310 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
52311         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
52312         int64_t ret_ref = 0;
52313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52315         return ret_ref;
52316 }
52317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52318         LDKOfferFeatures arg_conv;
52319         arg_conv.inner = untag_ptr(arg);
52320         arg_conv.is_owned = ptr_is_owned(arg);
52321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52322         arg_conv.is_owned = false;
52323         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
52324         return ret_conv;
52325 }
52326
52327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52328         LDKOfferFeatures orig_conv;
52329         orig_conv.inner = untag_ptr(orig);
52330         orig_conv.is_owned = ptr_is_owned(orig);
52331         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52332         orig_conv.is_owned = false;
52333         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
52334         int64_t ret_ref = 0;
52335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52337         return ret_ref;
52338 }
52339
52340 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
52341         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
52342         int64_t ret_ref = 0;
52343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52345         return ret_ref;
52346 }
52347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52348         LDKInvoiceRequestFeatures arg_conv;
52349         arg_conv.inner = untag_ptr(arg);
52350         arg_conv.is_owned = ptr_is_owned(arg);
52351         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52352         arg_conv.is_owned = false;
52353         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
52354         return ret_conv;
52355 }
52356
52357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52358         LDKInvoiceRequestFeatures orig_conv;
52359         orig_conv.inner = untag_ptr(orig);
52360         orig_conv.is_owned = ptr_is_owned(orig);
52361         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52362         orig_conv.is_owned = false;
52363         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
52364         int64_t ret_ref = 0;
52365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52367         return ret_ref;
52368 }
52369
52370 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
52371         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
52372         int64_t ret_ref = 0;
52373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52375         return ret_ref;
52376 }
52377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52378         LDKBolt12InvoiceFeatures arg_conv;
52379         arg_conv.inner = untag_ptr(arg);
52380         arg_conv.is_owned = ptr_is_owned(arg);
52381         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52382         arg_conv.is_owned = false;
52383         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
52384         return ret_conv;
52385 }
52386
52387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52388         LDKBolt12InvoiceFeatures orig_conv;
52389         orig_conv.inner = untag_ptr(orig);
52390         orig_conv.is_owned = ptr_is_owned(orig);
52391         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52392         orig_conv.is_owned = false;
52393         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
52394         int64_t ret_ref = 0;
52395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52397         return ret_ref;
52398 }
52399
52400 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
52401         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
52402         int64_t ret_ref = 0;
52403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52405         return ret_ref;
52406 }
52407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52408         LDKBlindedHopFeatures arg_conv;
52409         arg_conv.inner = untag_ptr(arg);
52410         arg_conv.is_owned = ptr_is_owned(arg);
52411         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52412         arg_conv.is_owned = false;
52413         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
52414         return ret_conv;
52415 }
52416
52417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52418         LDKBlindedHopFeatures orig_conv;
52419         orig_conv.inner = untag_ptr(orig);
52420         orig_conv.is_owned = ptr_is_owned(orig);
52421         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52422         orig_conv.is_owned = false;
52423         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
52424         int64_t ret_ref = 0;
52425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52427         return ret_ref;
52428 }
52429
52430 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
52431         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
52432         int64_t ret_ref = 0;
52433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52435         return ret_ref;
52436 }
52437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52438         LDKChannelTypeFeatures arg_conv;
52439         arg_conv.inner = untag_ptr(arg);
52440         arg_conv.is_owned = ptr_is_owned(arg);
52441         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52442         arg_conv.is_owned = false;
52443         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
52444         return ret_conv;
52445 }
52446
52447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52448         LDKChannelTypeFeatures orig_conv;
52449         orig_conv.inner = untag_ptr(orig);
52450         orig_conv.is_owned = ptr_is_owned(orig);
52451         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52452         orig_conv.is_owned = false;
52453         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
52454         int64_t ret_ref = 0;
52455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52457         return ret_ref;
52458 }
52459
52460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52461         LDKInitFeatures this_obj_conv;
52462         this_obj_conv.inner = untag_ptr(this_obj);
52463         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52465         InitFeatures_free(this_obj_conv);
52466 }
52467
52468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52469         LDKNodeFeatures this_obj_conv;
52470         this_obj_conv.inner = untag_ptr(this_obj);
52471         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52473         NodeFeatures_free(this_obj_conv);
52474 }
52475
52476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52477         LDKChannelFeatures this_obj_conv;
52478         this_obj_conv.inner = untag_ptr(this_obj);
52479         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52481         ChannelFeatures_free(this_obj_conv);
52482 }
52483
52484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52485         LDKBolt11InvoiceFeatures this_obj_conv;
52486         this_obj_conv.inner = untag_ptr(this_obj);
52487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52489         Bolt11InvoiceFeatures_free(this_obj_conv);
52490 }
52491
52492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52493         LDKOfferFeatures this_obj_conv;
52494         this_obj_conv.inner = untag_ptr(this_obj);
52495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52497         OfferFeatures_free(this_obj_conv);
52498 }
52499
52500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52501         LDKInvoiceRequestFeatures this_obj_conv;
52502         this_obj_conv.inner = untag_ptr(this_obj);
52503         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52505         InvoiceRequestFeatures_free(this_obj_conv);
52506 }
52507
52508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52509         LDKBolt12InvoiceFeatures this_obj_conv;
52510         this_obj_conv.inner = untag_ptr(this_obj);
52511         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52513         Bolt12InvoiceFeatures_free(this_obj_conv);
52514 }
52515
52516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52517         LDKBlindedHopFeatures this_obj_conv;
52518         this_obj_conv.inner = untag_ptr(this_obj);
52519         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52521         BlindedHopFeatures_free(this_obj_conv);
52522 }
52523
52524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52525         LDKChannelTypeFeatures this_obj_conv;
52526         this_obj_conv.inner = untag_ptr(this_obj);
52527         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52529         ChannelTypeFeatures_free(this_obj_conv);
52530 }
52531
52532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
52533         LDKInitFeatures ret_var = InitFeatures_empty();
52534         int64_t ret_ref = 0;
52535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52537         return ret_ref;
52538 }
52539
52540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52541         LDKInitFeatures this_arg_conv;
52542         this_arg_conv.inner = untag_ptr(this_arg);
52543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52545         this_arg_conv.is_owned = false;
52546         LDKInitFeatures other_conv;
52547         other_conv.inner = untag_ptr(other);
52548         other_conv.is_owned = ptr_is_owned(other);
52549         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52550         other_conv.is_owned = false;
52551         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52552         return ret_conv;
52553 }
52554
52555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52556         LDKInitFeatures this_arg_conv;
52557         this_arg_conv.inner = untag_ptr(this_arg);
52558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52560         this_arg_conv.is_owned = false;
52561         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
52562         return ret_conv;
52563 }
52564
52565 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) {
52566         LDKInitFeatures this_arg_conv;
52567         this_arg_conv.inner = untag_ptr(this_arg);
52568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52570         this_arg_conv.is_owned = false;
52571         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52572         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
52573         return tag_ptr(ret_conv, true);
52574 }
52575
52576 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) {
52577         LDKInitFeatures this_arg_conv;
52578         this_arg_conv.inner = untag_ptr(this_arg);
52579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52581         this_arg_conv.is_owned = false;
52582         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52583         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52584         return tag_ptr(ret_conv, true);
52585 }
52586
52587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
52588         LDKNodeFeatures ret_var = NodeFeatures_empty();
52589         int64_t ret_ref = 0;
52590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52592         return ret_ref;
52593 }
52594
52595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52596         LDKNodeFeatures this_arg_conv;
52597         this_arg_conv.inner = untag_ptr(this_arg);
52598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52600         this_arg_conv.is_owned = false;
52601         LDKNodeFeatures other_conv;
52602         other_conv.inner = untag_ptr(other);
52603         other_conv.is_owned = ptr_is_owned(other);
52604         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52605         other_conv.is_owned = false;
52606         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52607         return ret_conv;
52608 }
52609
52610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52611         LDKNodeFeatures this_arg_conv;
52612         this_arg_conv.inner = untag_ptr(this_arg);
52613         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52615         this_arg_conv.is_owned = false;
52616         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
52617         return ret_conv;
52618 }
52619
52620 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) {
52621         LDKNodeFeatures this_arg_conv;
52622         this_arg_conv.inner = untag_ptr(this_arg);
52623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52625         this_arg_conv.is_owned = false;
52626         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52627         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
52628         return tag_ptr(ret_conv, true);
52629 }
52630
52631 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) {
52632         LDKNodeFeatures this_arg_conv;
52633         this_arg_conv.inner = untag_ptr(this_arg);
52634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52636         this_arg_conv.is_owned = false;
52637         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52638         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52639         return tag_ptr(ret_conv, true);
52640 }
52641
52642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
52643         LDKChannelFeatures ret_var = ChannelFeatures_empty();
52644         int64_t ret_ref = 0;
52645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52647         return ret_ref;
52648 }
52649
52650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52651         LDKChannelFeatures this_arg_conv;
52652         this_arg_conv.inner = untag_ptr(this_arg);
52653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52655         this_arg_conv.is_owned = false;
52656         LDKChannelFeatures other_conv;
52657         other_conv.inner = untag_ptr(other);
52658         other_conv.is_owned = ptr_is_owned(other);
52659         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52660         other_conv.is_owned = false;
52661         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52662         return ret_conv;
52663 }
52664
52665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52666         LDKChannelFeatures this_arg_conv;
52667         this_arg_conv.inner = untag_ptr(this_arg);
52668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52670         this_arg_conv.is_owned = false;
52671         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
52672         return ret_conv;
52673 }
52674
52675 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) {
52676         LDKChannelFeatures this_arg_conv;
52677         this_arg_conv.inner = untag_ptr(this_arg);
52678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52680         this_arg_conv.is_owned = false;
52681         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52682         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
52683         return tag_ptr(ret_conv, true);
52684 }
52685
52686 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) {
52687         LDKChannelFeatures this_arg_conv;
52688         this_arg_conv.inner = untag_ptr(this_arg);
52689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52691         this_arg_conv.is_owned = false;
52692         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52693         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52694         return tag_ptr(ret_conv, true);
52695 }
52696
52697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
52698         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
52699         int64_t ret_ref = 0;
52700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52702         return ret_ref;
52703 }
52704
52705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52706         LDKBolt11InvoiceFeatures this_arg_conv;
52707         this_arg_conv.inner = untag_ptr(this_arg);
52708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52710         this_arg_conv.is_owned = false;
52711         LDKBolt11InvoiceFeatures other_conv;
52712         other_conv.inner = untag_ptr(other);
52713         other_conv.is_owned = ptr_is_owned(other);
52714         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52715         other_conv.is_owned = false;
52716         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52717         return ret_conv;
52718 }
52719
52720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52721         LDKBolt11InvoiceFeatures this_arg_conv;
52722         this_arg_conv.inner = untag_ptr(this_arg);
52723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52725         this_arg_conv.is_owned = false;
52726         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
52727         return ret_conv;
52728 }
52729
52730 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) {
52731         LDKBolt11InvoiceFeatures this_arg_conv;
52732         this_arg_conv.inner = untag_ptr(this_arg);
52733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52735         this_arg_conv.is_owned = false;
52736         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52737         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
52738         return tag_ptr(ret_conv, true);
52739 }
52740
52741 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) {
52742         LDKBolt11InvoiceFeatures this_arg_conv;
52743         this_arg_conv.inner = untag_ptr(this_arg);
52744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52746         this_arg_conv.is_owned = false;
52747         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52748         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52749         return tag_ptr(ret_conv, true);
52750 }
52751
52752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
52753         LDKOfferFeatures ret_var = OfferFeatures_empty();
52754         int64_t ret_ref = 0;
52755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52757         return ret_ref;
52758 }
52759
52760 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52761         LDKOfferFeatures this_arg_conv;
52762         this_arg_conv.inner = untag_ptr(this_arg);
52763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52765         this_arg_conv.is_owned = false;
52766         LDKOfferFeatures other_conv;
52767         other_conv.inner = untag_ptr(other);
52768         other_conv.is_owned = ptr_is_owned(other);
52769         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52770         other_conv.is_owned = false;
52771         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52772         return ret_conv;
52773 }
52774
52775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52776         LDKOfferFeatures this_arg_conv;
52777         this_arg_conv.inner = untag_ptr(this_arg);
52778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52780         this_arg_conv.is_owned = false;
52781         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
52782         return ret_conv;
52783 }
52784
52785 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) {
52786         LDKOfferFeatures this_arg_conv;
52787         this_arg_conv.inner = untag_ptr(this_arg);
52788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52790         this_arg_conv.is_owned = false;
52791         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52792         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
52793         return tag_ptr(ret_conv, true);
52794 }
52795
52796 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) {
52797         LDKOfferFeatures this_arg_conv;
52798         this_arg_conv.inner = untag_ptr(this_arg);
52799         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52801         this_arg_conv.is_owned = false;
52802         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52803         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52804         return tag_ptr(ret_conv, true);
52805 }
52806
52807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
52808         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
52809         int64_t ret_ref = 0;
52810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52812         return ret_ref;
52813 }
52814
52815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52816         LDKInvoiceRequestFeatures this_arg_conv;
52817         this_arg_conv.inner = untag_ptr(this_arg);
52818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52820         this_arg_conv.is_owned = false;
52821         LDKInvoiceRequestFeatures other_conv;
52822         other_conv.inner = untag_ptr(other);
52823         other_conv.is_owned = ptr_is_owned(other);
52824         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52825         other_conv.is_owned = false;
52826         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52827         return ret_conv;
52828 }
52829
52830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52831         LDKInvoiceRequestFeatures this_arg_conv;
52832         this_arg_conv.inner = untag_ptr(this_arg);
52833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52835         this_arg_conv.is_owned = false;
52836         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
52837         return ret_conv;
52838 }
52839
52840 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) {
52841         LDKInvoiceRequestFeatures this_arg_conv;
52842         this_arg_conv.inner = untag_ptr(this_arg);
52843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52845         this_arg_conv.is_owned = false;
52846         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52847         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
52848         return tag_ptr(ret_conv, true);
52849 }
52850
52851 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) {
52852         LDKInvoiceRequestFeatures this_arg_conv;
52853         this_arg_conv.inner = untag_ptr(this_arg);
52854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52856         this_arg_conv.is_owned = false;
52857         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52858         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52859         return tag_ptr(ret_conv, true);
52860 }
52861
52862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
52863         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
52864         int64_t ret_ref = 0;
52865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52867         return ret_ref;
52868 }
52869
52870 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52871         LDKBolt12InvoiceFeatures this_arg_conv;
52872         this_arg_conv.inner = untag_ptr(this_arg);
52873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52875         this_arg_conv.is_owned = false;
52876         LDKBolt12InvoiceFeatures other_conv;
52877         other_conv.inner = untag_ptr(other);
52878         other_conv.is_owned = ptr_is_owned(other);
52879         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52880         other_conv.is_owned = false;
52881         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52882         return ret_conv;
52883 }
52884
52885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52886         LDKBolt12InvoiceFeatures this_arg_conv;
52887         this_arg_conv.inner = untag_ptr(this_arg);
52888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52890         this_arg_conv.is_owned = false;
52891         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
52892         return ret_conv;
52893 }
52894
52895 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) {
52896         LDKBolt12InvoiceFeatures this_arg_conv;
52897         this_arg_conv.inner = untag_ptr(this_arg);
52898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52900         this_arg_conv.is_owned = false;
52901         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52902         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
52903         return tag_ptr(ret_conv, true);
52904 }
52905
52906 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) {
52907         LDKBolt12InvoiceFeatures this_arg_conv;
52908         this_arg_conv.inner = untag_ptr(this_arg);
52909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52911         this_arg_conv.is_owned = false;
52912         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52913         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52914         return tag_ptr(ret_conv, true);
52915 }
52916
52917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
52918         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
52919         int64_t ret_ref = 0;
52920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52922         return ret_ref;
52923 }
52924
52925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52926         LDKBlindedHopFeatures this_arg_conv;
52927         this_arg_conv.inner = untag_ptr(this_arg);
52928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52930         this_arg_conv.is_owned = false;
52931         LDKBlindedHopFeatures other_conv;
52932         other_conv.inner = untag_ptr(other);
52933         other_conv.is_owned = ptr_is_owned(other);
52934         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52935         other_conv.is_owned = false;
52936         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52937         return ret_conv;
52938 }
52939
52940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52941         LDKBlindedHopFeatures this_arg_conv;
52942         this_arg_conv.inner = untag_ptr(this_arg);
52943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52945         this_arg_conv.is_owned = false;
52946         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
52947         return ret_conv;
52948 }
52949
52950 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) {
52951         LDKBlindedHopFeatures this_arg_conv;
52952         this_arg_conv.inner = untag_ptr(this_arg);
52953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52955         this_arg_conv.is_owned = false;
52956         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52957         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
52958         return tag_ptr(ret_conv, true);
52959 }
52960
52961 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) {
52962         LDKBlindedHopFeatures this_arg_conv;
52963         this_arg_conv.inner = untag_ptr(this_arg);
52964         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52966         this_arg_conv.is_owned = false;
52967         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
52968         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
52969         return tag_ptr(ret_conv, true);
52970 }
52971
52972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
52973         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
52974         int64_t ret_ref = 0;
52975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52977         return ret_ref;
52978 }
52979
52980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
52981         LDKChannelTypeFeatures this_arg_conv;
52982         this_arg_conv.inner = untag_ptr(this_arg);
52983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52985         this_arg_conv.is_owned = false;
52986         LDKChannelTypeFeatures other_conv;
52987         other_conv.inner = untag_ptr(other);
52988         other_conv.is_owned = ptr_is_owned(other);
52989         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
52990         other_conv.is_owned = false;
52991         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
52992         return ret_conv;
52993 }
52994
52995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
52996         LDKChannelTypeFeatures this_arg_conv;
52997         this_arg_conv.inner = untag_ptr(this_arg);
52998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53000         this_arg_conv.is_owned = false;
53001         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
53002         return ret_conv;
53003 }
53004
53005 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) {
53006         LDKChannelTypeFeatures this_arg_conv;
53007         this_arg_conv.inner = untag_ptr(this_arg);
53008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53010         this_arg_conv.is_owned = false;
53011         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
53012         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
53013         return tag_ptr(ret_conv, true);
53014 }
53015
53016 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) {
53017         LDKChannelTypeFeatures this_arg_conv;
53018         this_arg_conv.inner = untag_ptr(this_arg);
53019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53021         this_arg_conv.is_owned = false;
53022         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
53023         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
53024         return tag_ptr(ret_conv, true);
53025 }
53026
53027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53028         LDKInitFeatures obj_conv;
53029         obj_conv.inner = untag_ptr(obj);
53030         obj_conv.is_owned = ptr_is_owned(obj);
53031         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53032         obj_conv.is_owned = false;
53033         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
53034         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53035         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53036         CVec_u8Z_free(ret_var);
53037         return ret_arr;
53038 }
53039
53040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53041         LDKu8slice ser_ref;
53042         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53043         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53044         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
53045         *ret_conv = InitFeatures_read(ser_ref);
53046         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53047         return tag_ptr(ret_conv, true);
53048 }
53049
53050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53051         LDKChannelFeatures obj_conv;
53052         obj_conv.inner = untag_ptr(obj);
53053         obj_conv.is_owned = ptr_is_owned(obj);
53054         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53055         obj_conv.is_owned = false;
53056         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
53057         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53058         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53059         CVec_u8Z_free(ret_var);
53060         return ret_arr;
53061 }
53062
53063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53064         LDKu8slice ser_ref;
53065         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53066         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53067         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
53068         *ret_conv = ChannelFeatures_read(ser_ref);
53069         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53070         return tag_ptr(ret_conv, true);
53071 }
53072
53073 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53074         LDKNodeFeatures obj_conv;
53075         obj_conv.inner = untag_ptr(obj);
53076         obj_conv.is_owned = ptr_is_owned(obj);
53077         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53078         obj_conv.is_owned = false;
53079         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
53080         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53081         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53082         CVec_u8Z_free(ret_var);
53083         return ret_arr;
53084 }
53085
53086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53087         LDKu8slice ser_ref;
53088         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53089         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53090         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
53091         *ret_conv = NodeFeatures_read(ser_ref);
53092         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53093         return tag_ptr(ret_conv, true);
53094 }
53095
53096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53097         LDKBolt11InvoiceFeatures obj_conv;
53098         obj_conv.inner = untag_ptr(obj);
53099         obj_conv.is_owned = ptr_is_owned(obj);
53100         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53101         obj_conv.is_owned = false;
53102         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
53103         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53104         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53105         CVec_u8Z_free(ret_var);
53106         return ret_arr;
53107 }
53108
53109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53110         LDKu8slice ser_ref;
53111         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53112         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53113         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
53114         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
53115         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53116         return tag_ptr(ret_conv, true);
53117 }
53118
53119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53120         LDKBolt12InvoiceFeatures obj_conv;
53121         obj_conv.inner = untag_ptr(obj);
53122         obj_conv.is_owned = ptr_is_owned(obj);
53123         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53124         obj_conv.is_owned = false;
53125         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
53126         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53127         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53128         CVec_u8Z_free(ret_var);
53129         return ret_arr;
53130 }
53131
53132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53133         LDKu8slice ser_ref;
53134         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53135         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53136         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
53137         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
53138         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53139         return tag_ptr(ret_conv, true);
53140 }
53141
53142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53143         LDKBlindedHopFeatures obj_conv;
53144         obj_conv.inner = untag_ptr(obj);
53145         obj_conv.is_owned = ptr_is_owned(obj);
53146         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53147         obj_conv.is_owned = false;
53148         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
53149         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53150         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53151         CVec_u8Z_free(ret_var);
53152         return ret_arr;
53153 }
53154
53155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53156         LDKu8slice ser_ref;
53157         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53158         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53159         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
53160         *ret_conv = BlindedHopFeatures_read(ser_ref);
53161         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53162         return tag_ptr(ret_conv, true);
53163 }
53164
53165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
53166         LDKChannelTypeFeatures obj_conv;
53167         obj_conv.inner = untag_ptr(obj);
53168         obj_conv.is_owned = ptr_is_owned(obj);
53169         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53170         obj_conv.is_owned = false;
53171         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
53172         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
53173         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
53174         CVec_u8Z_free(ret_var);
53175         return ret_arr;
53176 }
53177
53178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
53179         LDKu8slice ser_ref;
53180         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
53181         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
53182         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
53183         *ret_conv = ChannelTypeFeatures_read(ser_ref);
53184         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
53185         return tag_ptr(ret_conv, true);
53186 }
53187
53188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53189         LDKInitFeatures this_arg_conv;
53190         this_arg_conv.inner = untag_ptr(this_arg);
53191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53193         this_arg_conv.is_owned = false;
53194         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
53195 }
53196
53197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53198         LDKInitFeatures this_arg_conv;
53199         this_arg_conv.inner = untag_ptr(this_arg);
53200         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53202         this_arg_conv.is_owned = false;
53203         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
53204 }
53205
53206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
53207         LDKInitFeatures this_arg_conv;
53208         this_arg_conv.inner = untag_ptr(this_arg);
53209         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53211         this_arg_conv.is_owned = false;
53212         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
53213         return ret_conv;
53214 }
53215
53216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53217         LDKNodeFeatures this_arg_conv;
53218         this_arg_conv.inner = untag_ptr(this_arg);
53219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53221         this_arg_conv.is_owned = false;
53222         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
53223 }
53224
53225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53226         LDKNodeFeatures this_arg_conv;
53227         this_arg_conv.inner = untag_ptr(this_arg);
53228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53230         this_arg_conv.is_owned = false;
53231         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
53232 }
53233
53234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
53235         LDKNodeFeatures this_arg_conv;
53236         this_arg_conv.inner = untag_ptr(this_arg);
53237         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53239         this_arg_conv.is_owned = false;
53240         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
53241         return ret_conv;
53242 }
53243
53244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
53245         LDKInitFeatures this_arg_conv;
53246         this_arg_conv.inner = untag_ptr(this_arg);
53247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53249         this_arg_conv.is_owned = false;
53250         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
53251         return ret_conv;
53252 }
53253
53254 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
53255         LDKNodeFeatures this_arg_conv;
53256         this_arg_conv.inner = untag_ptr(this_arg);
53257         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53259         this_arg_conv.is_owned = false;
53260         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
53261         return ret_conv;
53262 }
53263
53264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53265         LDKInitFeatures this_arg_conv;
53266         this_arg_conv.inner = untag_ptr(this_arg);
53267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53269         this_arg_conv.is_owned = false;
53270         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
53271 }
53272
53273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53274         LDKInitFeatures this_arg_conv;
53275         this_arg_conv.inner = untag_ptr(this_arg);
53276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53278         this_arg_conv.is_owned = false;
53279         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
53280 }
53281
53282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
53283         LDKInitFeatures this_arg_conv;
53284         this_arg_conv.inner = untag_ptr(this_arg);
53285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53287         this_arg_conv.is_owned = false;
53288         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
53289         return ret_conv;
53290 }
53291
53292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53293         LDKInitFeatures this_arg_conv;
53294         this_arg_conv.inner = untag_ptr(this_arg);
53295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53297         this_arg_conv.is_owned = false;
53298         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
53299 }
53300
53301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53302         LDKInitFeatures this_arg_conv;
53303         this_arg_conv.inner = untag_ptr(this_arg);
53304         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53306         this_arg_conv.is_owned = false;
53307         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
53308 }
53309
53310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
53311         LDKInitFeatures this_arg_conv;
53312         this_arg_conv.inner = untag_ptr(this_arg);
53313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53315         this_arg_conv.is_owned = false;
53316         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
53317         return ret_conv;
53318 }
53319
53320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53321         LDKNodeFeatures this_arg_conv;
53322         this_arg_conv.inner = untag_ptr(this_arg);
53323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53325         this_arg_conv.is_owned = false;
53326         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
53327 }
53328
53329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53330         LDKNodeFeatures this_arg_conv;
53331         this_arg_conv.inner = untag_ptr(this_arg);
53332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53334         this_arg_conv.is_owned = false;
53335         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
53336 }
53337
53338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
53339         LDKNodeFeatures this_arg_conv;
53340         this_arg_conv.inner = untag_ptr(this_arg);
53341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53343         this_arg_conv.is_owned = false;
53344         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
53345         return ret_conv;
53346 }
53347
53348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
53349         LDKInitFeatures this_arg_conv;
53350         this_arg_conv.inner = untag_ptr(this_arg);
53351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53353         this_arg_conv.is_owned = false;
53354         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
53355         return ret_conv;
53356 }
53357
53358 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
53359         LDKNodeFeatures this_arg_conv;
53360         this_arg_conv.inner = untag_ptr(this_arg);
53361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53363         this_arg_conv.is_owned = false;
53364         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
53365         return ret_conv;
53366 }
53367
53368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53369         LDKInitFeatures this_arg_conv;
53370         this_arg_conv.inner = untag_ptr(this_arg);
53371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53373         this_arg_conv.is_owned = false;
53374         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
53375 }
53376
53377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53378         LDKInitFeatures this_arg_conv;
53379         this_arg_conv.inner = untag_ptr(this_arg);
53380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53382         this_arg_conv.is_owned = false;
53383         InitFeatures_set_gossip_queries_required(&this_arg_conv);
53384 }
53385
53386 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
53387         LDKInitFeatures this_arg_conv;
53388         this_arg_conv.inner = untag_ptr(this_arg);
53389         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53391         this_arg_conv.is_owned = false;
53392         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
53393         return ret_conv;
53394 }
53395
53396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53397         LDKNodeFeatures this_arg_conv;
53398         this_arg_conv.inner = untag_ptr(this_arg);
53399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53401         this_arg_conv.is_owned = false;
53402         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
53403 }
53404
53405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53406         LDKNodeFeatures this_arg_conv;
53407         this_arg_conv.inner = untag_ptr(this_arg);
53408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53410         this_arg_conv.is_owned = false;
53411         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
53412 }
53413
53414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
53415         LDKNodeFeatures this_arg_conv;
53416         this_arg_conv.inner = untag_ptr(this_arg);
53417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53419         this_arg_conv.is_owned = false;
53420         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
53421         return ret_conv;
53422 }
53423
53424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
53425         LDKInitFeatures this_arg_conv;
53426         this_arg_conv.inner = untag_ptr(this_arg);
53427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53429         this_arg_conv.is_owned = false;
53430         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
53431         return ret_conv;
53432 }
53433
53434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
53435         LDKNodeFeatures this_arg_conv;
53436         this_arg_conv.inner = untag_ptr(this_arg);
53437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53439         this_arg_conv.is_owned = false;
53440         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
53441         return ret_conv;
53442 }
53443
53444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53445         LDKInitFeatures this_arg_conv;
53446         this_arg_conv.inner = untag_ptr(this_arg);
53447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53449         this_arg_conv.is_owned = false;
53450         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
53451 }
53452
53453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53454         LDKInitFeatures this_arg_conv;
53455         this_arg_conv.inner = untag_ptr(this_arg);
53456         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53458         this_arg_conv.is_owned = false;
53459         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
53460 }
53461
53462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53463         LDKInitFeatures this_arg_conv;
53464         this_arg_conv.inner = untag_ptr(this_arg);
53465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53467         this_arg_conv.is_owned = false;
53468         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
53469         return ret_conv;
53470 }
53471
53472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53473         LDKNodeFeatures this_arg_conv;
53474         this_arg_conv.inner = untag_ptr(this_arg);
53475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53477         this_arg_conv.is_owned = false;
53478         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
53479 }
53480
53481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53482         LDKNodeFeatures this_arg_conv;
53483         this_arg_conv.inner = untag_ptr(this_arg);
53484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53486         this_arg_conv.is_owned = false;
53487         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
53488 }
53489
53490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53491         LDKNodeFeatures this_arg_conv;
53492         this_arg_conv.inner = untag_ptr(this_arg);
53493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53495         this_arg_conv.is_owned = false;
53496         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
53497         return ret_conv;
53498 }
53499
53500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53501         LDKBolt11InvoiceFeatures this_arg_conv;
53502         this_arg_conv.inner = untag_ptr(this_arg);
53503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53505         this_arg_conv.is_owned = false;
53506         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
53507 }
53508
53509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53510         LDKBolt11InvoiceFeatures this_arg_conv;
53511         this_arg_conv.inner = untag_ptr(this_arg);
53512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53514         this_arg_conv.is_owned = false;
53515         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
53516 }
53517
53518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53519         LDKBolt11InvoiceFeatures this_arg_conv;
53520         this_arg_conv.inner = untag_ptr(this_arg);
53521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53523         this_arg_conv.is_owned = false;
53524         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
53525         return ret_conv;
53526 }
53527
53528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53529         LDKInitFeatures this_arg_conv;
53530         this_arg_conv.inner = untag_ptr(this_arg);
53531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53533         this_arg_conv.is_owned = false;
53534         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
53535         return ret_conv;
53536 }
53537
53538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53539         LDKNodeFeatures this_arg_conv;
53540         this_arg_conv.inner = untag_ptr(this_arg);
53541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53543         this_arg_conv.is_owned = false;
53544         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
53545         return ret_conv;
53546 }
53547
53548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
53549         LDKBolt11InvoiceFeatures this_arg_conv;
53550         this_arg_conv.inner = untag_ptr(this_arg);
53551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53553         this_arg_conv.is_owned = false;
53554         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
53555         return ret_conv;
53556 }
53557
53558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53559         LDKInitFeatures this_arg_conv;
53560         this_arg_conv.inner = untag_ptr(this_arg);
53561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53563         this_arg_conv.is_owned = false;
53564         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
53565 }
53566
53567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53568         LDKInitFeatures this_arg_conv;
53569         this_arg_conv.inner = untag_ptr(this_arg);
53570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53572         this_arg_conv.is_owned = false;
53573         InitFeatures_set_static_remote_key_required(&this_arg_conv);
53574 }
53575
53576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53577         LDKInitFeatures this_arg_conv;
53578         this_arg_conv.inner = untag_ptr(this_arg);
53579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53581         this_arg_conv.is_owned = false;
53582         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
53583         return ret_conv;
53584 }
53585
53586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53587         LDKNodeFeatures this_arg_conv;
53588         this_arg_conv.inner = untag_ptr(this_arg);
53589         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53591         this_arg_conv.is_owned = false;
53592         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
53593 }
53594
53595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53596         LDKNodeFeatures this_arg_conv;
53597         this_arg_conv.inner = untag_ptr(this_arg);
53598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53600         this_arg_conv.is_owned = false;
53601         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
53602 }
53603
53604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53605         LDKNodeFeatures this_arg_conv;
53606         this_arg_conv.inner = untag_ptr(this_arg);
53607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53609         this_arg_conv.is_owned = false;
53610         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
53611         return ret_conv;
53612 }
53613
53614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53615         LDKChannelTypeFeatures this_arg_conv;
53616         this_arg_conv.inner = untag_ptr(this_arg);
53617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53619         this_arg_conv.is_owned = false;
53620         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
53621 }
53622
53623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53624         LDKChannelTypeFeatures this_arg_conv;
53625         this_arg_conv.inner = untag_ptr(this_arg);
53626         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53628         this_arg_conv.is_owned = false;
53629         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
53630 }
53631
53632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53633         LDKChannelTypeFeatures this_arg_conv;
53634         this_arg_conv.inner = untag_ptr(this_arg);
53635         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53637         this_arg_conv.is_owned = false;
53638         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
53639         return ret_conv;
53640 }
53641
53642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53643         LDKInitFeatures this_arg_conv;
53644         this_arg_conv.inner = untag_ptr(this_arg);
53645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53647         this_arg_conv.is_owned = false;
53648         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
53649         return ret_conv;
53650 }
53651
53652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53653         LDKNodeFeatures this_arg_conv;
53654         this_arg_conv.inner = untag_ptr(this_arg);
53655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53657         this_arg_conv.is_owned = false;
53658         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
53659         return ret_conv;
53660 }
53661
53662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
53663         LDKChannelTypeFeatures this_arg_conv;
53664         this_arg_conv.inner = untag_ptr(this_arg);
53665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53667         this_arg_conv.is_owned = false;
53668         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
53669         return ret_conv;
53670 }
53671
53672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53673         LDKInitFeatures this_arg_conv;
53674         this_arg_conv.inner = untag_ptr(this_arg);
53675         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53677         this_arg_conv.is_owned = false;
53678         InitFeatures_set_payment_secret_optional(&this_arg_conv);
53679 }
53680
53681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53682         LDKInitFeatures this_arg_conv;
53683         this_arg_conv.inner = untag_ptr(this_arg);
53684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53686         this_arg_conv.is_owned = false;
53687         InitFeatures_set_payment_secret_required(&this_arg_conv);
53688 }
53689
53690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53691         LDKInitFeatures this_arg_conv;
53692         this_arg_conv.inner = untag_ptr(this_arg);
53693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53695         this_arg_conv.is_owned = false;
53696         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
53697         return ret_conv;
53698 }
53699
53700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53701         LDKNodeFeatures this_arg_conv;
53702         this_arg_conv.inner = untag_ptr(this_arg);
53703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53705         this_arg_conv.is_owned = false;
53706         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
53707 }
53708
53709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53710         LDKNodeFeatures this_arg_conv;
53711         this_arg_conv.inner = untag_ptr(this_arg);
53712         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53714         this_arg_conv.is_owned = false;
53715         NodeFeatures_set_payment_secret_required(&this_arg_conv);
53716 }
53717
53718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53719         LDKNodeFeatures this_arg_conv;
53720         this_arg_conv.inner = untag_ptr(this_arg);
53721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53723         this_arg_conv.is_owned = false;
53724         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
53725         return ret_conv;
53726 }
53727
53728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53729         LDKBolt11InvoiceFeatures this_arg_conv;
53730         this_arg_conv.inner = untag_ptr(this_arg);
53731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53733         this_arg_conv.is_owned = false;
53734         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
53735 }
53736
53737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53738         LDKBolt11InvoiceFeatures this_arg_conv;
53739         this_arg_conv.inner = untag_ptr(this_arg);
53740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53742         this_arg_conv.is_owned = false;
53743         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
53744 }
53745
53746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53747         LDKBolt11InvoiceFeatures this_arg_conv;
53748         this_arg_conv.inner = untag_ptr(this_arg);
53749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53751         this_arg_conv.is_owned = false;
53752         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
53753         return ret_conv;
53754 }
53755
53756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53757         LDKInitFeatures this_arg_conv;
53758         this_arg_conv.inner = untag_ptr(this_arg);
53759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53761         this_arg_conv.is_owned = false;
53762         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
53763         return ret_conv;
53764 }
53765
53766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53767         LDKNodeFeatures this_arg_conv;
53768         this_arg_conv.inner = untag_ptr(this_arg);
53769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53771         this_arg_conv.is_owned = false;
53772         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
53773         return ret_conv;
53774 }
53775
53776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
53777         LDKBolt11InvoiceFeatures this_arg_conv;
53778         this_arg_conv.inner = untag_ptr(this_arg);
53779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53781         this_arg_conv.is_owned = false;
53782         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
53783         return ret_conv;
53784 }
53785
53786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53787         LDKInitFeatures this_arg_conv;
53788         this_arg_conv.inner = untag_ptr(this_arg);
53789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53791         this_arg_conv.is_owned = false;
53792         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
53793 }
53794
53795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53796         LDKInitFeatures this_arg_conv;
53797         this_arg_conv.inner = untag_ptr(this_arg);
53798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53800         this_arg_conv.is_owned = false;
53801         InitFeatures_set_basic_mpp_required(&this_arg_conv);
53802 }
53803
53804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53805         LDKInitFeatures this_arg_conv;
53806         this_arg_conv.inner = untag_ptr(this_arg);
53807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53809         this_arg_conv.is_owned = false;
53810         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
53811         return ret_conv;
53812 }
53813
53814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53815         LDKNodeFeatures this_arg_conv;
53816         this_arg_conv.inner = untag_ptr(this_arg);
53817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53819         this_arg_conv.is_owned = false;
53820         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
53821 }
53822
53823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53824         LDKNodeFeatures this_arg_conv;
53825         this_arg_conv.inner = untag_ptr(this_arg);
53826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53828         this_arg_conv.is_owned = false;
53829         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
53830 }
53831
53832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53833         LDKNodeFeatures this_arg_conv;
53834         this_arg_conv.inner = untag_ptr(this_arg);
53835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53837         this_arg_conv.is_owned = false;
53838         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
53839         return ret_conv;
53840 }
53841
53842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53843         LDKBolt11InvoiceFeatures this_arg_conv;
53844         this_arg_conv.inner = untag_ptr(this_arg);
53845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53847         this_arg_conv.is_owned = false;
53848         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
53849 }
53850
53851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53852         LDKBolt11InvoiceFeatures this_arg_conv;
53853         this_arg_conv.inner = untag_ptr(this_arg);
53854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53856         this_arg_conv.is_owned = false;
53857         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
53858 }
53859
53860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53861         LDKBolt11InvoiceFeatures this_arg_conv;
53862         this_arg_conv.inner = untag_ptr(this_arg);
53863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53865         this_arg_conv.is_owned = false;
53866         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
53867         return ret_conv;
53868 }
53869
53870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53871         LDKBolt12InvoiceFeatures this_arg_conv;
53872         this_arg_conv.inner = untag_ptr(this_arg);
53873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53875         this_arg_conv.is_owned = false;
53876         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
53877 }
53878
53879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53880         LDKBolt12InvoiceFeatures this_arg_conv;
53881         this_arg_conv.inner = untag_ptr(this_arg);
53882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53884         this_arg_conv.is_owned = false;
53885         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
53886 }
53887
53888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53889         LDKBolt12InvoiceFeatures this_arg_conv;
53890         this_arg_conv.inner = untag_ptr(this_arg);
53891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53893         this_arg_conv.is_owned = false;
53894         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
53895         return ret_conv;
53896 }
53897
53898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53899         LDKInitFeatures this_arg_conv;
53900         this_arg_conv.inner = untag_ptr(this_arg);
53901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53903         this_arg_conv.is_owned = false;
53904         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
53905         return ret_conv;
53906 }
53907
53908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53909         LDKNodeFeatures this_arg_conv;
53910         this_arg_conv.inner = untag_ptr(this_arg);
53911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53913         this_arg_conv.is_owned = false;
53914         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
53915         return ret_conv;
53916 }
53917
53918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53919         LDKBolt11InvoiceFeatures this_arg_conv;
53920         this_arg_conv.inner = untag_ptr(this_arg);
53921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53923         this_arg_conv.is_owned = false;
53924         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
53925         return ret_conv;
53926 }
53927
53928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
53929         LDKBolt12InvoiceFeatures this_arg_conv;
53930         this_arg_conv.inner = untag_ptr(this_arg);
53931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53933         this_arg_conv.is_owned = false;
53934         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
53935         return ret_conv;
53936 }
53937
53938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53939         LDKInitFeatures this_arg_conv;
53940         this_arg_conv.inner = untag_ptr(this_arg);
53941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53943         this_arg_conv.is_owned = false;
53944         InitFeatures_set_wumbo_optional(&this_arg_conv);
53945 }
53946
53947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53948         LDKInitFeatures this_arg_conv;
53949         this_arg_conv.inner = untag_ptr(this_arg);
53950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53952         this_arg_conv.is_owned = false;
53953         InitFeatures_set_wumbo_required(&this_arg_conv);
53954 }
53955
53956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
53957         LDKInitFeatures this_arg_conv;
53958         this_arg_conv.inner = untag_ptr(this_arg);
53959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53961         this_arg_conv.is_owned = false;
53962         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
53963         return ret_conv;
53964 }
53965
53966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
53967         LDKNodeFeatures this_arg_conv;
53968         this_arg_conv.inner = untag_ptr(this_arg);
53969         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53971         this_arg_conv.is_owned = false;
53972         NodeFeatures_set_wumbo_optional(&this_arg_conv);
53973 }
53974
53975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
53976         LDKNodeFeatures this_arg_conv;
53977         this_arg_conv.inner = untag_ptr(this_arg);
53978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53980         this_arg_conv.is_owned = false;
53981         NodeFeatures_set_wumbo_required(&this_arg_conv);
53982 }
53983
53984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
53985         LDKNodeFeatures this_arg_conv;
53986         this_arg_conv.inner = untag_ptr(this_arg);
53987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53989         this_arg_conv.is_owned = false;
53990         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
53991         return ret_conv;
53992 }
53993
53994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
53995         LDKInitFeatures this_arg_conv;
53996         this_arg_conv.inner = untag_ptr(this_arg);
53997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53999         this_arg_conv.is_owned = false;
54000         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
54001         return ret_conv;
54002 }
54003
54004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
54005         LDKNodeFeatures this_arg_conv;
54006         this_arg_conv.inner = untag_ptr(this_arg);
54007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54009         this_arg_conv.is_owned = false;
54010         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
54011         return ret_conv;
54012 }
54013
54014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54015         LDKInitFeatures this_arg_conv;
54016         this_arg_conv.inner = untag_ptr(this_arg);
54017         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54019         this_arg_conv.is_owned = false;
54020         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
54021 }
54022
54023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54024         LDKInitFeatures this_arg_conv;
54025         this_arg_conv.inner = untag_ptr(this_arg);
54026         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54028         this_arg_conv.is_owned = false;
54029         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
54030 }
54031
54032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54033         LDKInitFeatures this_arg_conv;
54034         this_arg_conv.inner = untag_ptr(this_arg);
54035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54037         this_arg_conv.is_owned = false;
54038         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54039         return ret_conv;
54040 }
54041
54042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54043         LDKNodeFeatures this_arg_conv;
54044         this_arg_conv.inner = untag_ptr(this_arg);
54045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54047         this_arg_conv.is_owned = false;
54048         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
54049 }
54050
54051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54052         LDKNodeFeatures this_arg_conv;
54053         this_arg_conv.inner = untag_ptr(this_arg);
54054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54056         this_arg_conv.is_owned = false;
54057         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
54058 }
54059
54060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54061         LDKNodeFeatures this_arg_conv;
54062         this_arg_conv.inner = untag_ptr(this_arg);
54063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54065         this_arg_conv.is_owned = false;
54066         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54067         return ret_conv;
54068 }
54069
54070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54071         LDKChannelTypeFeatures this_arg_conv;
54072         this_arg_conv.inner = untag_ptr(this_arg);
54073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54075         this_arg_conv.is_owned = false;
54076         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
54077 }
54078
54079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54080         LDKChannelTypeFeatures this_arg_conv;
54081         this_arg_conv.inner = untag_ptr(this_arg);
54082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54084         this_arg_conv.is_owned = false;
54085         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
54086 }
54087
54088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54089         LDKChannelTypeFeatures this_arg_conv;
54090         this_arg_conv.inner = untag_ptr(this_arg);
54091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54093         this_arg_conv.is_owned = false;
54094         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54095         return ret_conv;
54096 }
54097
54098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54099         LDKInitFeatures this_arg_conv;
54100         this_arg_conv.inner = untag_ptr(this_arg);
54101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54103         this_arg_conv.is_owned = false;
54104         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54105         return ret_conv;
54106 }
54107
54108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54109         LDKNodeFeatures this_arg_conv;
54110         this_arg_conv.inner = untag_ptr(this_arg);
54111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54113         this_arg_conv.is_owned = false;
54114         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54115         return ret_conv;
54116 }
54117
54118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54119         LDKChannelTypeFeatures this_arg_conv;
54120         this_arg_conv.inner = untag_ptr(this_arg);
54121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54123         this_arg_conv.is_owned = false;
54124         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
54125         return ret_conv;
54126 }
54127
54128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54129         LDKInitFeatures this_arg_conv;
54130         this_arg_conv.inner = untag_ptr(this_arg);
54131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54133         this_arg_conv.is_owned = false;
54134         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
54135 }
54136
54137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54138         LDKInitFeatures this_arg_conv;
54139         this_arg_conv.inner = untag_ptr(this_arg);
54140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54142         this_arg_conv.is_owned = false;
54143         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
54144 }
54145
54146 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54147         LDKInitFeatures this_arg_conv;
54148         this_arg_conv.inner = untag_ptr(this_arg);
54149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54151         this_arg_conv.is_owned = false;
54152         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
54153         return ret_conv;
54154 }
54155
54156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54157         LDKNodeFeatures this_arg_conv;
54158         this_arg_conv.inner = untag_ptr(this_arg);
54159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54161         this_arg_conv.is_owned = false;
54162         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
54163 }
54164
54165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54166         LDKNodeFeatures this_arg_conv;
54167         this_arg_conv.inner = untag_ptr(this_arg);
54168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54170         this_arg_conv.is_owned = false;
54171         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
54172 }
54173
54174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54175         LDKNodeFeatures this_arg_conv;
54176         this_arg_conv.inner = untag_ptr(this_arg);
54177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54179         this_arg_conv.is_owned = false;
54180         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
54181         return ret_conv;
54182 }
54183
54184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54185         LDKChannelTypeFeatures this_arg_conv;
54186         this_arg_conv.inner = untag_ptr(this_arg);
54187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54189         this_arg_conv.is_owned = false;
54190         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
54191 }
54192
54193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54194         LDKChannelTypeFeatures this_arg_conv;
54195         this_arg_conv.inner = untag_ptr(this_arg);
54196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54198         this_arg_conv.is_owned = false;
54199         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
54200 }
54201
54202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54203         LDKChannelTypeFeatures this_arg_conv;
54204         this_arg_conv.inner = untag_ptr(this_arg);
54205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54207         this_arg_conv.is_owned = false;
54208         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
54209         return ret_conv;
54210 }
54211
54212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54213         LDKInitFeatures this_arg_conv;
54214         this_arg_conv.inner = untag_ptr(this_arg);
54215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54217         this_arg_conv.is_owned = false;
54218         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
54219         return ret_conv;
54220 }
54221
54222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54223         LDKNodeFeatures this_arg_conv;
54224         this_arg_conv.inner = untag_ptr(this_arg);
54225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54227         this_arg_conv.is_owned = false;
54228         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
54229         return ret_conv;
54230 }
54231
54232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
54233         LDKChannelTypeFeatures this_arg_conv;
54234         this_arg_conv.inner = untag_ptr(this_arg);
54235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54237         this_arg_conv.is_owned = false;
54238         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
54239         return ret_conv;
54240 }
54241
54242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54243         LDKInitFeatures this_arg_conv;
54244         this_arg_conv.inner = untag_ptr(this_arg);
54245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54247         this_arg_conv.is_owned = false;
54248         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
54249 }
54250
54251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54252         LDKInitFeatures this_arg_conv;
54253         this_arg_conv.inner = untag_ptr(this_arg);
54254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54256         this_arg_conv.is_owned = false;
54257         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
54258 }
54259
54260 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
54261         LDKInitFeatures this_arg_conv;
54262         this_arg_conv.inner = untag_ptr(this_arg);
54263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54265         this_arg_conv.is_owned = false;
54266         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
54267         return ret_conv;
54268 }
54269
54270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54271         LDKNodeFeatures this_arg_conv;
54272         this_arg_conv.inner = untag_ptr(this_arg);
54273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54275         this_arg_conv.is_owned = false;
54276         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
54277 }
54278
54279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54280         LDKNodeFeatures this_arg_conv;
54281         this_arg_conv.inner = untag_ptr(this_arg);
54282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54284         this_arg_conv.is_owned = false;
54285         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
54286 }
54287
54288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
54289         LDKNodeFeatures this_arg_conv;
54290         this_arg_conv.inner = untag_ptr(this_arg);
54291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54293         this_arg_conv.is_owned = false;
54294         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
54295         return ret_conv;
54296 }
54297
54298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
54299         LDKInitFeatures this_arg_conv;
54300         this_arg_conv.inner = untag_ptr(this_arg);
54301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54303         this_arg_conv.is_owned = false;
54304         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
54305         return ret_conv;
54306 }
54307
54308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
54309         LDKNodeFeatures this_arg_conv;
54310         this_arg_conv.inner = untag_ptr(this_arg);
54311         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54313         this_arg_conv.is_owned = false;
54314         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
54315         return ret_conv;
54316 }
54317
54318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54319         LDKInitFeatures this_arg_conv;
54320         this_arg_conv.inner = untag_ptr(this_arg);
54321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54323         this_arg_conv.is_owned = false;
54324         InitFeatures_set_onion_messages_optional(&this_arg_conv);
54325 }
54326
54327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54328         LDKInitFeatures this_arg_conv;
54329         this_arg_conv.inner = untag_ptr(this_arg);
54330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54332         this_arg_conv.is_owned = false;
54333         InitFeatures_set_onion_messages_required(&this_arg_conv);
54334 }
54335
54336 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
54337         LDKInitFeatures this_arg_conv;
54338         this_arg_conv.inner = untag_ptr(this_arg);
54339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54341         this_arg_conv.is_owned = false;
54342         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
54343         return ret_conv;
54344 }
54345
54346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54347         LDKNodeFeatures this_arg_conv;
54348         this_arg_conv.inner = untag_ptr(this_arg);
54349         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54351         this_arg_conv.is_owned = false;
54352         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
54353 }
54354
54355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54356         LDKNodeFeatures this_arg_conv;
54357         this_arg_conv.inner = untag_ptr(this_arg);
54358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54360         this_arg_conv.is_owned = false;
54361         NodeFeatures_set_onion_messages_required(&this_arg_conv);
54362 }
54363
54364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
54365         LDKNodeFeatures this_arg_conv;
54366         this_arg_conv.inner = untag_ptr(this_arg);
54367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54369         this_arg_conv.is_owned = false;
54370         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
54371         return ret_conv;
54372 }
54373
54374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
54375         LDKInitFeatures this_arg_conv;
54376         this_arg_conv.inner = untag_ptr(this_arg);
54377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54379         this_arg_conv.is_owned = false;
54380         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
54381         return ret_conv;
54382 }
54383
54384 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
54385         LDKNodeFeatures this_arg_conv;
54386         this_arg_conv.inner = untag_ptr(this_arg);
54387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54389         this_arg_conv.is_owned = false;
54390         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
54391         return ret_conv;
54392 }
54393
54394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54395         LDKInitFeatures this_arg_conv;
54396         this_arg_conv.inner = untag_ptr(this_arg);
54397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54399         this_arg_conv.is_owned = false;
54400         InitFeatures_set_channel_type_optional(&this_arg_conv);
54401 }
54402
54403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54404         LDKInitFeatures this_arg_conv;
54405         this_arg_conv.inner = untag_ptr(this_arg);
54406         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54408         this_arg_conv.is_owned = false;
54409         InitFeatures_set_channel_type_required(&this_arg_conv);
54410 }
54411
54412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
54413         LDKInitFeatures this_arg_conv;
54414         this_arg_conv.inner = untag_ptr(this_arg);
54415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54417         this_arg_conv.is_owned = false;
54418         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
54419         return ret_conv;
54420 }
54421
54422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54423         LDKNodeFeatures this_arg_conv;
54424         this_arg_conv.inner = untag_ptr(this_arg);
54425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54427         this_arg_conv.is_owned = false;
54428         NodeFeatures_set_channel_type_optional(&this_arg_conv);
54429 }
54430
54431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54432         LDKNodeFeatures this_arg_conv;
54433         this_arg_conv.inner = untag_ptr(this_arg);
54434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54436         this_arg_conv.is_owned = false;
54437         NodeFeatures_set_channel_type_required(&this_arg_conv);
54438 }
54439
54440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
54441         LDKNodeFeatures this_arg_conv;
54442         this_arg_conv.inner = untag_ptr(this_arg);
54443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54445         this_arg_conv.is_owned = false;
54446         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
54447         return ret_conv;
54448 }
54449
54450 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
54451         LDKInitFeatures this_arg_conv;
54452         this_arg_conv.inner = untag_ptr(this_arg);
54453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54455         this_arg_conv.is_owned = false;
54456         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
54457         return ret_conv;
54458 }
54459
54460 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
54461         LDKNodeFeatures this_arg_conv;
54462         this_arg_conv.inner = untag_ptr(this_arg);
54463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54465         this_arg_conv.is_owned = false;
54466         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
54467         return ret_conv;
54468 }
54469
54470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54471         LDKInitFeatures this_arg_conv;
54472         this_arg_conv.inner = untag_ptr(this_arg);
54473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54475         this_arg_conv.is_owned = false;
54476         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
54477 }
54478
54479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54480         LDKInitFeatures this_arg_conv;
54481         this_arg_conv.inner = untag_ptr(this_arg);
54482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54484         this_arg_conv.is_owned = false;
54485         InitFeatures_set_scid_privacy_required(&this_arg_conv);
54486 }
54487
54488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54489         LDKInitFeatures this_arg_conv;
54490         this_arg_conv.inner = untag_ptr(this_arg);
54491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54493         this_arg_conv.is_owned = false;
54494         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
54495         return ret_conv;
54496 }
54497
54498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54499         LDKNodeFeatures this_arg_conv;
54500         this_arg_conv.inner = untag_ptr(this_arg);
54501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54503         this_arg_conv.is_owned = false;
54504         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
54505 }
54506
54507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54508         LDKNodeFeatures this_arg_conv;
54509         this_arg_conv.inner = untag_ptr(this_arg);
54510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54512         this_arg_conv.is_owned = false;
54513         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
54514 }
54515
54516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54517         LDKNodeFeatures this_arg_conv;
54518         this_arg_conv.inner = untag_ptr(this_arg);
54519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54521         this_arg_conv.is_owned = false;
54522         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
54523         return ret_conv;
54524 }
54525
54526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54527         LDKChannelTypeFeatures this_arg_conv;
54528         this_arg_conv.inner = untag_ptr(this_arg);
54529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54531         this_arg_conv.is_owned = false;
54532         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
54533 }
54534
54535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54536         LDKChannelTypeFeatures this_arg_conv;
54537         this_arg_conv.inner = untag_ptr(this_arg);
54538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54540         this_arg_conv.is_owned = false;
54541         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
54542 }
54543
54544 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54545         LDKChannelTypeFeatures this_arg_conv;
54546         this_arg_conv.inner = untag_ptr(this_arg);
54547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54549         this_arg_conv.is_owned = false;
54550         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
54551         return ret_conv;
54552 }
54553
54554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54555         LDKInitFeatures this_arg_conv;
54556         this_arg_conv.inner = untag_ptr(this_arg);
54557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54559         this_arg_conv.is_owned = false;
54560         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
54561         return ret_conv;
54562 }
54563
54564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54565         LDKNodeFeatures this_arg_conv;
54566         this_arg_conv.inner = untag_ptr(this_arg);
54567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54569         this_arg_conv.is_owned = false;
54570         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
54571         return ret_conv;
54572 }
54573
54574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
54575         LDKChannelTypeFeatures this_arg_conv;
54576         this_arg_conv.inner = untag_ptr(this_arg);
54577         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54579         this_arg_conv.is_owned = false;
54580         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
54581         return ret_conv;
54582 }
54583
54584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54585         LDKBolt11InvoiceFeatures this_arg_conv;
54586         this_arg_conv.inner = untag_ptr(this_arg);
54587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54589         this_arg_conv.is_owned = false;
54590         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
54591 }
54592
54593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54594         LDKBolt11InvoiceFeatures this_arg_conv;
54595         this_arg_conv.inner = untag_ptr(this_arg);
54596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54598         this_arg_conv.is_owned = false;
54599         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
54600 }
54601
54602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
54603         LDKBolt11InvoiceFeatures this_arg_conv;
54604         this_arg_conv.inner = untag_ptr(this_arg);
54605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54607         this_arg_conv.is_owned = false;
54608         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
54609         return ret_conv;
54610 }
54611
54612 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
54613         LDKBolt11InvoiceFeatures this_arg_conv;
54614         this_arg_conv.inner = untag_ptr(this_arg);
54615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54617         this_arg_conv.is_owned = false;
54618         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
54619         return ret_conv;
54620 }
54621
54622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54623         LDKInitFeatures this_arg_conv;
54624         this_arg_conv.inner = untag_ptr(this_arg);
54625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54627         this_arg_conv.is_owned = false;
54628         InitFeatures_set_zero_conf_optional(&this_arg_conv);
54629 }
54630
54631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54632         LDKInitFeatures this_arg_conv;
54633         this_arg_conv.inner = untag_ptr(this_arg);
54634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54636         this_arg_conv.is_owned = false;
54637         InitFeatures_set_zero_conf_required(&this_arg_conv);
54638 }
54639
54640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54641         LDKInitFeatures this_arg_conv;
54642         this_arg_conv.inner = untag_ptr(this_arg);
54643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54645         this_arg_conv.is_owned = false;
54646         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
54647         return ret_conv;
54648 }
54649
54650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54651         LDKNodeFeatures this_arg_conv;
54652         this_arg_conv.inner = untag_ptr(this_arg);
54653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54655         this_arg_conv.is_owned = false;
54656         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
54657 }
54658
54659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54660         LDKNodeFeatures this_arg_conv;
54661         this_arg_conv.inner = untag_ptr(this_arg);
54662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54664         this_arg_conv.is_owned = false;
54665         NodeFeatures_set_zero_conf_required(&this_arg_conv);
54666 }
54667
54668 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54669         LDKNodeFeatures this_arg_conv;
54670         this_arg_conv.inner = untag_ptr(this_arg);
54671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54673         this_arg_conv.is_owned = false;
54674         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
54675         return ret_conv;
54676 }
54677
54678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54679         LDKChannelTypeFeatures this_arg_conv;
54680         this_arg_conv.inner = untag_ptr(this_arg);
54681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54683         this_arg_conv.is_owned = false;
54684         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
54685 }
54686
54687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54688         LDKChannelTypeFeatures this_arg_conv;
54689         this_arg_conv.inner = untag_ptr(this_arg);
54690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54692         this_arg_conv.is_owned = false;
54693         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
54694 }
54695
54696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54697         LDKChannelTypeFeatures this_arg_conv;
54698         this_arg_conv.inner = untag_ptr(this_arg);
54699         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54701         this_arg_conv.is_owned = false;
54702         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
54703         return ret_conv;
54704 }
54705
54706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54707         LDKInitFeatures this_arg_conv;
54708         this_arg_conv.inner = untag_ptr(this_arg);
54709         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54711         this_arg_conv.is_owned = false;
54712         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
54713         return ret_conv;
54714 }
54715
54716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54717         LDKNodeFeatures this_arg_conv;
54718         this_arg_conv.inner = untag_ptr(this_arg);
54719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54721         this_arg_conv.is_owned = false;
54722         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
54723         return ret_conv;
54724 }
54725
54726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
54727         LDKChannelTypeFeatures this_arg_conv;
54728         this_arg_conv.inner = untag_ptr(this_arg);
54729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54731         this_arg_conv.is_owned = false;
54732         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
54733         return ret_conv;
54734 }
54735
54736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
54737         LDKNodeFeatures this_arg_conv;
54738         this_arg_conv.inner = untag_ptr(this_arg);
54739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54741         this_arg_conv.is_owned = false;
54742         NodeFeatures_set_keysend_optional(&this_arg_conv);
54743 }
54744
54745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
54746         LDKNodeFeatures this_arg_conv;
54747         this_arg_conv.inner = untag_ptr(this_arg);
54748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54750         this_arg_conv.is_owned = false;
54751         NodeFeatures_set_keysend_required(&this_arg_conv);
54752 }
54753
54754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
54755         LDKNodeFeatures this_arg_conv;
54756         this_arg_conv.inner = untag_ptr(this_arg);
54757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54759         this_arg_conv.is_owned = false;
54760         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
54761         return ret_conv;
54762 }
54763
54764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
54765         LDKNodeFeatures this_arg_conv;
54766         this_arg_conv.inner = untag_ptr(this_arg);
54767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54769         this_arg_conv.is_owned = false;
54770         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
54771         return ret_conv;
54772 }
54773
54774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54775         LDKShutdownScript this_obj_conv;
54776         this_obj_conv.inner = untag_ptr(this_obj);
54777         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54779         ShutdownScript_free(this_obj_conv);
54780 }
54781
54782 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
54783         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
54784         int64_t ret_ref = 0;
54785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54787         return ret_ref;
54788 }
54789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54790         LDKShutdownScript arg_conv;
54791         arg_conv.inner = untag_ptr(arg);
54792         arg_conv.is_owned = ptr_is_owned(arg);
54793         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54794         arg_conv.is_owned = false;
54795         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
54796         return ret_conv;
54797 }
54798
54799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54800         LDKShutdownScript orig_conv;
54801         orig_conv.inner = untag_ptr(orig);
54802         orig_conv.is_owned = ptr_is_owned(orig);
54803         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54804         orig_conv.is_owned = false;
54805         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
54806         int64_t ret_ref = 0;
54807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54809         return ret_ref;
54810 }
54811
54812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54813         LDKShutdownScript a_conv;
54814         a_conv.inner = untag_ptr(a);
54815         a_conv.is_owned = ptr_is_owned(a);
54816         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54817         a_conv.is_owned = false;
54818         LDKShutdownScript b_conv;
54819         b_conv.inner = untag_ptr(b);
54820         b_conv.is_owned = ptr_is_owned(b);
54821         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54822         b_conv.is_owned = false;
54823         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
54824         return ret_conv;
54825 }
54826
54827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54828         LDKInvalidShutdownScript this_obj_conv;
54829         this_obj_conv.inner = untag_ptr(this_obj);
54830         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54832         InvalidShutdownScript_free(this_obj_conv);
54833 }
54834
54835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
54836         LDKInvalidShutdownScript this_ptr_conv;
54837         this_ptr_conv.inner = untag_ptr(this_ptr);
54838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54840         this_ptr_conv.is_owned = false;
54841         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
54842         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54843         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54844         return ret_arr;
54845 }
54846
54847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54848         LDKInvalidShutdownScript this_ptr_conv;
54849         this_ptr_conv.inner = untag_ptr(this_ptr);
54850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54852         this_ptr_conv.is_owned = false;
54853         LDKCVec_u8Z val_ref;
54854         val_ref.datalen = (*env)->GetArrayLength(env, val);
54855         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54856         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54857         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
54858 }
54859
54860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
54861         LDKCVec_u8Z script_arg_ref;
54862         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
54863         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54864         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
54865         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
54866         int64_t ret_ref = 0;
54867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54869         return ret_ref;
54870 }
54871
54872 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
54873         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
54874         int64_t ret_ref = 0;
54875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54877         return ret_ref;
54878 }
54879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54880         LDKInvalidShutdownScript arg_conv;
54881         arg_conv.inner = untag_ptr(arg);
54882         arg_conv.is_owned = ptr_is_owned(arg);
54883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54884         arg_conv.is_owned = false;
54885         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
54886         return ret_conv;
54887 }
54888
54889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54890         LDKInvalidShutdownScript orig_conv;
54891         orig_conv.inner = untag_ptr(orig);
54892         orig_conv.is_owned = ptr_is_owned(orig);
54893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54894         orig_conv.is_owned = false;
54895         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
54896         int64_t ret_ref = 0;
54897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54899         return ret_ref;
54900 }
54901
54902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
54903         LDKShutdownScript obj_conv;
54904         obj_conv.inner = untag_ptr(obj);
54905         obj_conv.is_owned = ptr_is_owned(obj);
54906         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54907         obj_conv.is_owned = false;
54908         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
54909         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54910         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54911         CVec_u8Z_free(ret_var);
54912         return ret_arr;
54913 }
54914
54915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
54916         LDKu8slice ser_ref;
54917         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
54918         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
54919         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
54920         *ret_conv = ShutdownScript_read(ser_ref);
54921         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
54922         return tag_ptr(ret_conv, true);
54923 }
54924
54925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
54926         uint8_t pubkey_hash_arr[20];
54927         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
54928         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
54929         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
54930         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
54931         int64_t ret_ref = 0;
54932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54934         return ret_ref;
54935 }
54936
54937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
54938         uint8_t script_hash_arr[32];
54939         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
54940         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
54941         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
54942         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
54943         int64_t ret_ref = 0;
54944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54946         return ret_ref;
54947 }
54948
54949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
54950         
54951         LDKu8slice program_ref;
54952         program_ref.datalen = (*env)->GetArrayLength(env, program);
54953         program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
54954         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
54955         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
54956         (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
54957         return tag_ptr(ret_conv, true);
54958 }
54959
54960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
54961         LDKShutdownScript this_arg_conv;
54962         this_arg_conv.inner = untag_ptr(this_arg);
54963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54965         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
54966         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
54967         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54968         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54969         CVec_u8Z_free(ret_var);
54970         return ret_arr;
54971 }
54972
54973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
54974         LDKShutdownScript this_arg_conv;
54975         this_arg_conv.inner = untag_ptr(this_arg);
54976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54978         this_arg_conv.is_owned = false;
54979         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
54980         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
54981         return ret_arr;
54982 }
54983
54984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
54985         LDKShutdownScript this_arg_conv;
54986         this_arg_conv.inner = untag_ptr(this_arg);
54987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54989         this_arg_conv.is_owned = false;
54990         LDKInitFeatures features_conv;
54991         features_conv.inner = untag_ptr(features);
54992         features_conv.is_owned = ptr_is_owned(features);
54993         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
54994         features_conv.is_owned = false;
54995         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
54996         return ret_conv;
54997 }
54998
54999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55000         if (!ptr_is_owned(this_ptr)) return;
55001         void* this_ptr_ptr = untag_ptr(this_ptr);
55002         CHECK_ACCESS(this_ptr_ptr);
55003         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
55004         FREE(untag_ptr(this_ptr));
55005         Retry_free(this_ptr_conv);
55006 }
55007
55008 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
55009         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
55010         *ret_copy = Retry_clone(arg);
55011         int64_t ret_ref = tag_ptr(ret_copy, true);
55012         return ret_ref;
55013 }
55014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55015         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
55016         int64_t ret_conv = Retry_clone_ptr(arg_conv);
55017         return ret_conv;
55018 }
55019
55020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55021         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
55022         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
55023         *ret_copy = Retry_clone(orig_conv);
55024         int64_t ret_ref = tag_ptr(ret_copy, true);
55025         return ret_ref;
55026 }
55027
55028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int64_t a) {
55029         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
55030         *ret_copy = Retry_attempts(a);
55031         int64_t ret_ref = tag_ptr(ret_copy, true);
55032         return ret_ref;
55033 }
55034
55035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
55036         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
55037         *ret_copy = Retry_timeout(a);
55038         int64_t ret_ref = tag_ptr(ret_copy, true);
55039         return ret_ref;
55040 }
55041
55042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55043         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
55044         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
55045         jboolean ret_conv = Retry_eq(a_conv, b_conv);
55046         return ret_conv;
55047 }
55048
55049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
55050         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
55051         int64_t ret_conv = Retry_hash(o_conv);
55052         return ret_conv;
55053 }
55054
55055 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55056         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
55057         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
55058         return ret_conv;
55059 }
55060
55061 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
55062         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
55063         return ret_conv;
55064 }
55065
55066 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
55067         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
55068         return ret_conv;
55069 }
55070
55071 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
55072         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
55073         return ret_conv;
55074 }
55075
55076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55077         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
55078         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
55079         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
55080         return ret_conv;
55081 }
55082
55083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55084         if (!ptr_is_owned(this_ptr)) return;
55085         void* this_ptr_ptr = untag_ptr(this_ptr);
55086         CHECK_ACCESS(this_ptr_ptr);
55087         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
55088         FREE(untag_ptr(this_ptr));
55089         PaymentSendFailure_free(this_ptr_conv);
55090 }
55091
55092 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
55093         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55094         *ret_copy = PaymentSendFailure_clone(arg);
55095         int64_t ret_ref = tag_ptr(ret_copy, true);
55096         return ret_ref;
55097 }
55098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55099         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
55100         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
55101         return ret_conv;
55102 }
55103
55104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55105         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
55106         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55107         *ret_copy = PaymentSendFailure_clone(orig_conv);
55108         int64_t ret_ref = tag_ptr(ret_copy, true);
55109         return ret_ref;
55110 }
55111
55112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
55113         void* a_ptr = untag_ptr(a);
55114         CHECK_ACCESS(a_ptr);
55115         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
55116         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
55117         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55118         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
55119         int64_t ret_ref = tag_ptr(ret_copy, true);
55120         return ret_ref;
55121 }
55122
55123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
55124         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
55125         a_constr.datalen = (*env)->GetArrayLength(env, a);
55126         if (a_constr.datalen > 0)
55127                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
55128         else
55129                 a_constr.data = NULL;
55130         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
55131         for (size_t w = 0; w < a_constr.datalen; w++) {
55132                 int64_t a_conv_22 = a_vals[w];
55133                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
55134                 CHECK_ACCESS(a_conv_22_ptr);
55135                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
55136                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
55137                 a_constr.data[w] = a_conv_22_conv;
55138         }
55139         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
55140         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55141         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
55142         int64_t ret_ref = tag_ptr(ret_copy, true);
55143         return ret_ref;
55144 }
55145
55146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
55147         LDKCVec_APIErrorZ a_constr;
55148         a_constr.datalen = (*env)->GetArrayLength(env, a);
55149         if (a_constr.datalen > 0)
55150                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
55151         else
55152                 a_constr.data = NULL;
55153         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
55154         for (size_t k = 0; k < a_constr.datalen; k++) {
55155                 int64_t a_conv_10 = a_vals[k];
55156                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
55157                 CHECK_ACCESS(a_conv_10_ptr);
55158                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
55159                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
55160                 a_constr.data[k] = a_conv_10_conv;
55161         }
55162         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
55163         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55164         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
55165         int64_t ret_ref = tag_ptr(ret_copy, true);
55166         return ret_ref;
55167 }
55168
55169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
55170         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55171         *ret_copy = PaymentSendFailure_duplicate_payment();
55172         int64_t ret_ref = tag_ptr(ret_copy, true);
55173         return ret_ref;
55174 }
55175
55176 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) {
55177         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
55178         results_constr.datalen = (*env)->GetArrayLength(env, results);
55179         if (results_constr.datalen > 0)
55180                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
55181         else
55182                 results_constr.data = NULL;
55183         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
55184         for (size_t w = 0; w < results_constr.datalen; w++) {
55185                 int64_t results_conv_22 = results_vals[w];
55186                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
55187                 CHECK_ACCESS(results_conv_22_ptr);
55188                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
55189                 results_constr.data[w] = results_conv_22_conv;
55190         }
55191         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
55192         LDKRouteParameters failed_paths_retry_conv;
55193         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
55194         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
55195         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
55196         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
55197         LDKThirtyTwoBytes payment_id_ref;
55198         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
55199         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
55200         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
55201         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
55202         int64_t ret_ref = tag_ptr(ret_copy, true);
55203         return ret_ref;
55204 }
55205
55206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55207         LDKRecipientOnionFields this_obj_conv;
55208         this_obj_conv.inner = untag_ptr(this_obj);
55209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55211         RecipientOnionFields_free(this_obj_conv);
55212 }
55213
55214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
55215         LDKRecipientOnionFields this_ptr_conv;
55216         this_ptr_conv.inner = untag_ptr(this_ptr);
55217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55219         this_ptr_conv.is_owned = false;
55220         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
55221         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
55222         int64_t ret_ref = tag_ptr(ret_copy, true);
55223         return ret_ref;
55224 }
55225
55226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55227         LDKRecipientOnionFields this_ptr_conv;
55228         this_ptr_conv.inner = untag_ptr(this_ptr);
55229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55231         this_ptr_conv.is_owned = false;
55232         void* val_ptr = untag_ptr(val);
55233         CHECK_ACCESS(val_ptr);
55234         LDKCOption_PaymentSecretZ val_conv = *(LDKCOption_PaymentSecretZ*)(val_ptr);
55235         val_conv = COption_PaymentSecretZ_clone((LDKCOption_PaymentSecretZ*)untag_ptr(val));
55236         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
55237 }
55238
55239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
55240         LDKRecipientOnionFields this_ptr_conv;
55241         this_ptr_conv.inner = untag_ptr(this_ptr);
55242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55244         this_ptr_conv.is_owned = false;
55245         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
55246         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
55247         int64_t ret_ref = tag_ptr(ret_copy, true);
55248         return ret_ref;
55249 }
55250
55251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55252         LDKRecipientOnionFields this_ptr_conv;
55253         this_ptr_conv.inner = untag_ptr(this_ptr);
55254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55256         this_ptr_conv.is_owned = false;
55257         void* val_ptr = untag_ptr(val);
55258         CHECK_ACCESS(val_ptr);
55259         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
55260         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
55261         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
55262 }
55263
55264 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) {
55265         void* payment_secret_arg_ptr = untag_ptr(payment_secret_arg);
55266         CHECK_ACCESS(payment_secret_arg_ptr);
55267         LDKCOption_PaymentSecretZ payment_secret_arg_conv = *(LDKCOption_PaymentSecretZ*)(payment_secret_arg_ptr);
55268         payment_secret_arg_conv = COption_PaymentSecretZ_clone((LDKCOption_PaymentSecretZ*)untag_ptr(payment_secret_arg));
55269         void* payment_metadata_arg_ptr = untag_ptr(payment_metadata_arg);
55270         CHECK_ACCESS(payment_metadata_arg_ptr);
55271         LDKCOption_CVec_u8ZZ payment_metadata_arg_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_arg_ptr);
55272         payment_metadata_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata_arg));
55273         LDKRecipientOnionFields ret_var = RecipientOnionFields_new(payment_secret_arg_conv, payment_metadata_arg_conv);
55274         int64_t ret_ref = 0;
55275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55277         return ret_ref;
55278 }
55279
55280 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
55281         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
55282         int64_t ret_ref = 0;
55283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55285         return ret_ref;
55286 }
55287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55288         LDKRecipientOnionFields arg_conv;
55289         arg_conv.inner = untag_ptr(arg);
55290         arg_conv.is_owned = ptr_is_owned(arg);
55291         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55292         arg_conv.is_owned = false;
55293         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
55294         return ret_conv;
55295 }
55296
55297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55298         LDKRecipientOnionFields orig_conv;
55299         orig_conv.inner = untag_ptr(orig);
55300         orig_conv.is_owned = ptr_is_owned(orig);
55301         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55302         orig_conv.is_owned = false;
55303         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
55304         int64_t ret_ref = 0;
55305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55307         return ret_ref;
55308 }
55309
55310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55311         LDKRecipientOnionFields a_conv;
55312         a_conv.inner = untag_ptr(a);
55313         a_conv.is_owned = ptr_is_owned(a);
55314         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55315         a_conv.is_owned = false;
55316         LDKRecipientOnionFields b_conv;
55317         b_conv.inner = untag_ptr(b);
55318         b_conv.is_owned = ptr_is_owned(b);
55319         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55320         b_conv.is_owned = false;
55321         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
55322         return ret_conv;
55323 }
55324
55325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
55326         LDKRecipientOnionFields obj_conv;
55327         obj_conv.inner = untag_ptr(obj);
55328         obj_conv.is_owned = ptr_is_owned(obj);
55329         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55330         obj_conv.is_owned = false;
55331         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
55332         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55333         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55334         CVec_u8Z_free(ret_var);
55335         return ret_arr;
55336 }
55337
55338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55339         LDKu8slice ser_ref;
55340         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55341         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55342         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
55343         *ret_conv = RecipientOnionFields_read(ser_ref);
55344         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55345         return tag_ptr(ret_conv, true);
55346 }
55347
55348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
55349         LDKThirtyTwoBytes payment_secret_ref;
55350         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
55351         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
55352         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
55353         int64_t ret_ref = 0;
55354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55356         return ret_ref;
55357 }
55358
55359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
55360         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
55361         int64_t ret_ref = 0;
55362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55364         return ret_ref;
55365 }
55366
55367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55368         if (!ptr_is_owned(this_ptr)) return;
55369         void* this_ptr_ptr = untag_ptr(this_ptr);
55370         CHECK_ACCESS(this_ptr_ptr);
55371         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
55372         FREE(untag_ptr(this_ptr));
55373         CustomMessageReader_free(this_ptr_conv);
55374 }
55375
55376 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
55377         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
55378         *ret_ret = Type_clone(arg);
55379         return tag_ptr(ret_ret, true);
55380 }
55381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55382         void* arg_ptr = untag_ptr(arg);
55383         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
55384         LDKType* arg_conv = (LDKType*)arg_ptr;
55385         int64_t ret_conv = Type_clone_ptr(arg_conv);
55386         return ret_conv;
55387 }
55388
55389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55390         void* orig_ptr = untag_ptr(orig);
55391         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
55392         LDKType* orig_conv = (LDKType*)orig_ptr;
55393         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
55394         *ret_ret = Type_clone(orig_conv);
55395         return tag_ptr(ret_ret, true);
55396 }
55397
55398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
55399         if (!ptr_is_owned(this_ptr)) return;
55400         void* this_ptr_ptr = untag_ptr(this_ptr);
55401         CHECK_ACCESS(this_ptr_ptr);
55402         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
55403         FREE(untag_ptr(this_ptr));
55404         Type_free(this_ptr_conv);
55405 }
55406
55407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55408         LDKUnsignedBolt12Invoice this_obj_conv;
55409         this_obj_conv.inner = untag_ptr(this_obj);
55410         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55412         UnsignedBolt12Invoice_free(this_obj_conv);
55413 }
55414
55415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
55416         LDKUnsignedBolt12Invoice this_arg_conv;
55417         this_arg_conv.inner = untag_ptr(this_arg);
55418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55420         this_arg_conv.is_owned = false;
55421         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
55422         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
55423         return ret_arr;
55424 }
55425
55426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55427         LDKBolt12Invoice this_obj_conv;
55428         this_obj_conv.inner = untag_ptr(this_obj);
55429         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55431         Bolt12Invoice_free(this_obj_conv);
55432 }
55433
55434 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
55435         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
55436         int64_t ret_ref = 0;
55437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55439         return ret_ref;
55440 }
55441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55442         LDKBolt12Invoice arg_conv;
55443         arg_conv.inner = untag_ptr(arg);
55444         arg_conv.is_owned = ptr_is_owned(arg);
55445         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55446         arg_conv.is_owned = false;
55447         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
55448         return ret_conv;
55449 }
55450
55451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55452         LDKBolt12Invoice orig_conv;
55453         orig_conv.inner = untag_ptr(orig);
55454         orig_conv.is_owned = ptr_is_owned(orig);
55455         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55456         orig_conv.is_owned = false;
55457         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
55458         int64_t ret_ref = 0;
55459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55461         return ret_ref;
55462 }
55463
55464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
55465         LDKBolt12Invoice this_arg_conv;
55466         this_arg_conv.inner = untag_ptr(this_arg);
55467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55469         this_arg_conv.is_owned = false;
55470         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
55471         int64_t ret_ref = 0;
55472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55474         return ret_ref;
55475 }
55476
55477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
55478         LDKBolt12Invoice this_arg_conv;
55479         this_arg_conv.inner = untag_ptr(this_arg);
55480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55482         this_arg_conv.is_owned = false;
55483         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
55484         return ret_conv;
55485 }
55486
55487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
55488         LDKBolt12Invoice this_arg_conv;
55489         this_arg_conv.inner = untag_ptr(this_arg);
55490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55492         this_arg_conv.is_owned = false;
55493         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
55494         return ret_conv;
55495 }
55496
55497 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
55498         LDKBolt12Invoice this_arg_conv;
55499         this_arg_conv.inner = untag_ptr(this_arg);
55500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55502         this_arg_conv.is_owned = false;
55503         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
55504         return ret_conv;
55505 }
55506
55507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
55508         LDKBolt12Invoice this_arg_conv;
55509         this_arg_conv.inner = untag_ptr(this_arg);
55510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55512         this_arg_conv.is_owned = false;
55513         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55514         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
55515         return ret_arr;
55516 }
55517
55518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
55519         LDKBolt12Invoice this_arg_conv;
55520         this_arg_conv.inner = untag_ptr(this_arg);
55521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55523         this_arg_conv.is_owned = false;
55524         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
55525         return ret_conv;
55526 }
55527
55528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
55529         LDKBolt12Invoice this_arg_conv;
55530         this_arg_conv.inner = untag_ptr(this_arg);
55531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55533         this_arg_conv.is_owned = false;
55534         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_features(&this_arg_conv);
55535         int64_t ret_ref = 0;
55536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55538         return ret_ref;
55539 }
55540
55541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
55542         LDKBolt12Invoice this_arg_conv;
55543         this_arg_conv.inner = untag_ptr(this_arg);
55544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55546         this_arg_conv.is_owned = false;
55547         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
55548         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
55549         return ret_arr;
55550 }
55551
55552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
55553         LDKBolt12Invoice this_arg_conv;
55554         this_arg_conv.inner = untag_ptr(this_arg);
55555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55557         this_arg_conv.is_owned = false;
55558         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55559         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
55560         return ret_arr;
55561 }
55562
55563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
55564         LDKBolt12Invoice this_arg_conv;
55565         this_arg_conv.inner = untag_ptr(this_arg);
55566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55568         this_arg_conv.is_owned = false;
55569         LDKExpandedKey key_conv;
55570         key_conv.inner = untag_ptr(key);
55571         key_conv.is_owned = ptr_is_owned(key);
55572         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
55573         key_conv.is_owned = false;
55574         jboolean ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
55575         return ret_conv;
55576 }
55577
55578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
55579         LDKBolt12Invoice obj_conv;
55580         obj_conv.inner = untag_ptr(obj);
55581         obj_conv.is_owned = ptr_is_owned(obj);
55582         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55583         obj_conv.is_owned = false;
55584         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
55585         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55586         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55587         CVec_u8Z_free(ret_var);
55588         return ret_arr;
55589 }
55590
55591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55592         LDKBlindedPayInfo this_obj_conv;
55593         this_obj_conv.inner = untag_ptr(this_obj);
55594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55596         BlindedPayInfo_free(this_obj_conv);
55597 }
55598
55599 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55600         LDKBlindedPayInfo this_ptr_conv;
55601         this_ptr_conv.inner = untag_ptr(this_ptr);
55602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55604         this_ptr_conv.is_owned = false;
55605         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
55606         return ret_conv;
55607 }
55608
55609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55610         LDKBlindedPayInfo this_ptr_conv;
55611         this_ptr_conv.inner = untag_ptr(this_ptr);
55612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55614         this_ptr_conv.is_owned = false;
55615         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
55616 }
55617
55618 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
55619         LDKBlindedPayInfo this_ptr_conv;
55620         this_ptr_conv.inner = untag_ptr(this_ptr);
55621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55623         this_ptr_conv.is_owned = false;
55624         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
55625         return ret_conv;
55626 }
55627
55628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55629         LDKBlindedPayInfo this_ptr_conv;
55630         this_ptr_conv.inner = untag_ptr(this_ptr);
55631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55633         this_ptr_conv.is_owned = false;
55634         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
55635 }
55636
55637 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
55638         LDKBlindedPayInfo this_ptr_conv;
55639         this_ptr_conv.inner = untag_ptr(this_ptr);
55640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55642         this_ptr_conv.is_owned = false;
55643         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
55644         return ret_conv;
55645 }
55646
55647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
55648         LDKBlindedPayInfo this_ptr_conv;
55649         this_ptr_conv.inner = untag_ptr(this_ptr);
55650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55652         this_ptr_conv.is_owned = false;
55653         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
55654 }
55655
55656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55657         LDKBlindedPayInfo this_ptr_conv;
55658         this_ptr_conv.inner = untag_ptr(this_ptr);
55659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55661         this_ptr_conv.is_owned = false;
55662         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
55663         return ret_conv;
55664 }
55665
55666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55667         LDKBlindedPayInfo this_ptr_conv;
55668         this_ptr_conv.inner = untag_ptr(this_ptr);
55669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55671         this_ptr_conv.is_owned = false;
55672         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
55673 }
55674
55675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55676         LDKBlindedPayInfo this_ptr_conv;
55677         this_ptr_conv.inner = untag_ptr(this_ptr);
55678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55680         this_ptr_conv.is_owned = false;
55681         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
55682         return ret_conv;
55683 }
55684
55685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55686         LDKBlindedPayInfo this_ptr_conv;
55687         this_ptr_conv.inner = untag_ptr(this_ptr);
55688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55690         this_ptr_conv.is_owned = false;
55691         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
55692 }
55693
55694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
55695         LDKBlindedPayInfo this_ptr_conv;
55696         this_ptr_conv.inner = untag_ptr(this_ptr);
55697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55699         this_ptr_conv.is_owned = false;
55700         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
55701         int64_t ret_ref = 0;
55702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55704         return ret_ref;
55705 }
55706
55707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55708         LDKBlindedPayInfo this_ptr_conv;
55709         this_ptr_conv.inner = untag_ptr(this_ptr);
55710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55712         this_ptr_conv.is_owned = false;
55713         LDKBlindedHopFeatures val_conv;
55714         val_conv.inner = untag_ptr(val);
55715         val_conv.is_owned = ptr_is_owned(val);
55716         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55717         val_conv = BlindedHopFeatures_clone(&val_conv);
55718         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
55719 }
55720
55721 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) {
55722         LDKBlindedHopFeatures features_arg_conv;
55723         features_arg_conv.inner = untag_ptr(features_arg);
55724         features_arg_conv.is_owned = ptr_is_owned(features_arg);
55725         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
55726         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
55727         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);
55728         int64_t ret_ref = 0;
55729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55731         return ret_ref;
55732 }
55733
55734 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
55735         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
55736         int64_t ret_ref = 0;
55737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55739         return ret_ref;
55740 }
55741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55742         LDKBlindedPayInfo arg_conv;
55743         arg_conv.inner = untag_ptr(arg);
55744         arg_conv.is_owned = ptr_is_owned(arg);
55745         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55746         arg_conv.is_owned = false;
55747         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
55748         return ret_conv;
55749 }
55750
55751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55752         LDKBlindedPayInfo orig_conv;
55753         orig_conv.inner = untag_ptr(orig);
55754         orig_conv.is_owned = ptr_is_owned(orig);
55755         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55756         orig_conv.is_owned = false;
55757         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
55758         int64_t ret_ref = 0;
55759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55761         return ret_ref;
55762 }
55763
55764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
55765         LDKBlindedPayInfo o_conv;
55766         o_conv.inner = untag_ptr(o);
55767         o_conv.is_owned = ptr_is_owned(o);
55768         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55769         o_conv.is_owned = false;
55770         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
55771         return ret_conv;
55772 }
55773
55774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55775         LDKBlindedPayInfo a_conv;
55776         a_conv.inner = untag_ptr(a);
55777         a_conv.is_owned = ptr_is_owned(a);
55778         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55779         a_conv.is_owned = false;
55780         LDKBlindedPayInfo b_conv;
55781         b_conv.inner = untag_ptr(b);
55782         b_conv.is_owned = ptr_is_owned(b);
55783         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55784         b_conv.is_owned = false;
55785         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
55786         return ret_conv;
55787 }
55788
55789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
55790         LDKBlindedPayInfo obj_conv;
55791         obj_conv.inner = untag_ptr(obj);
55792         obj_conv.is_owned = ptr_is_owned(obj);
55793         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55794         obj_conv.is_owned = false;
55795         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
55796         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55797         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55798         CVec_u8Z_free(ret_var);
55799         return ret_arr;
55800 }
55801
55802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
55803         LDKu8slice ser_ref;
55804         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
55805         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
55806         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
55807         *ret_conv = BlindedPayInfo_read(ser_ref);
55808         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
55809         return tag_ptr(ret_conv, true);
55810 }
55811
55812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55813         LDKInvoiceError this_obj_conv;
55814         this_obj_conv.inner = untag_ptr(this_obj);
55815         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55817         InvoiceError_free(this_obj_conv);
55818 }
55819
55820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
55821         LDKInvoiceError this_ptr_conv;
55822         this_ptr_conv.inner = untag_ptr(this_ptr);
55823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55825         this_ptr_conv.is_owned = false;
55826         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
55827         int64_t ret_ref = 0;
55828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55830         return ret_ref;
55831 }
55832
55833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55834         LDKInvoiceError this_ptr_conv;
55835         this_ptr_conv.inner = untag_ptr(this_ptr);
55836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55838         this_ptr_conv.is_owned = false;
55839         LDKErroneousField val_conv;
55840         val_conv.inner = untag_ptr(val);
55841         val_conv.is_owned = ptr_is_owned(val);
55842         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55843         val_conv = ErroneousField_clone(&val_conv);
55844         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
55845 }
55846
55847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
55848         LDKInvoiceError this_ptr_conv;
55849         this_ptr_conv.inner = untag_ptr(this_ptr);
55850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55852         this_ptr_conv.is_owned = false;
55853         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
55854         int64_t ret_ref = 0;
55855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55857         return ret_ref;
55858 }
55859
55860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55861         LDKInvoiceError this_ptr_conv;
55862         this_ptr_conv.inner = untag_ptr(this_ptr);
55863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55865         this_ptr_conv.is_owned = false;
55866         LDKUntrustedString val_conv;
55867         val_conv.inner = untag_ptr(val);
55868         val_conv.is_owned = ptr_is_owned(val);
55869         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55870         val_conv = UntrustedString_clone(&val_conv);
55871         InvoiceError_set_message(&this_ptr_conv, val_conv);
55872 }
55873
55874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
55875         LDKErroneousField erroneous_field_arg_conv;
55876         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
55877         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
55878         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
55879         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
55880         LDKUntrustedString message_arg_conv;
55881         message_arg_conv.inner = untag_ptr(message_arg);
55882         message_arg_conv.is_owned = ptr_is_owned(message_arg);
55883         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
55884         message_arg_conv = UntrustedString_clone(&message_arg_conv);
55885         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
55886         int64_t ret_ref = 0;
55887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55889         return ret_ref;
55890 }
55891
55892 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
55893         LDKInvoiceError ret_var = InvoiceError_clone(arg);
55894         int64_t ret_ref = 0;
55895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55897         return ret_ref;
55898 }
55899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55900         LDKInvoiceError arg_conv;
55901         arg_conv.inner = untag_ptr(arg);
55902         arg_conv.is_owned = ptr_is_owned(arg);
55903         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55904         arg_conv.is_owned = false;
55905         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
55906         return ret_conv;
55907 }
55908
55909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55910         LDKInvoiceError orig_conv;
55911         orig_conv.inner = untag_ptr(orig);
55912         orig_conv.is_owned = ptr_is_owned(orig);
55913         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55914         orig_conv.is_owned = false;
55915         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
55916         int64_t ret_ref = 0;
55917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55919         return ret_ref;
55920 }
55921
55922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55923         LDKErroneousField this_obj_conv;
55924         this_obj_conv.inner = untag_ptr(this_obj);
55925         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55927         ErroneousField_free(this_obj_conv);
55928 }
55929
55930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
55931         LDKErroneousField this_ptr_conv;
55932         this_ptr_conv.inner = untag_ptr(this_ptr);
55933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55935         this_ptr_conv.is_owned = false;
55936         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
55937         return ret_conv;
55938 }
55939
55940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55941         LDKErroneousField this_ptr_conv;
55942         this_ptr_conv.inner = untag_ptr(this_ptr);
55943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55945         this_ptr_conv.is_owned = false;
55946         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
55947 }
55948
55949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
55950         LDKErroneousField this_ptr_conv;
55951         this_ptr_conv.inner = untag_ptr(this_ptr);
55952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55954         this_ptr_conv.is_owned = false;
55955         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
55956         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
55957         int64_t ret_ref = tag_ptr(ret_copy, true);
55958         return ret_ref;
55959 }
55960
55961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55962         LDKErroneousField this_ptr_conv;
55963         this_ptr_conv.inner = untag_ptr(this_ptr);
55964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55966         this_ptr_conv.is_owned = false;
55967         void* val_ptr = untag_ptr(val);
55968         CHECK_ACCESS(val_ptr);
55969         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
55970         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
55971         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
55972 }
55973
55974 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) {
55975         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
55976         CHECK_ACCESS(suggested_value_arg_ptr);
55977         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
55978         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
55979         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
55980         int64_t ret_ref = 0;
55981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55983         return ret_ref;
55984 }
55985
55986 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
55987         LDKErroneousField ret_var = ErroneousField_clone(arg);
55988         int64_t ret_ref = 0;
55989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55991         return ret_ref;
55992 }
55993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55994         LDKErroneousField arg_conv;
55995         arg_conv.inner = untag_ptr(arg);
55996         arg_conv.is_owned = ptr_is_owned(arg);
55997         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55998         arg_conv.is_owned = false;
55999         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
56000         return ret_conv;
56001 }
56002
56003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56004         LDKErroneousField orig_conv;
56005         orig_conv.inner = untag_ptr(orig);
56006         orig_conv.is_owned = ptr_is_owned(orig);
56007         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56008         orig_conv.is_owned = false;
56009         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
56010         int64_t ret_ref = 0;
56011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56013         return ret_ref;
56014 }
56015
56016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
56017         LDKInvoiceError obj_conv;
56018         obj_conv.inner = untag_ptr(obj);
56019         obj_conv.is_owned = ptr_is_owned(obj);
56020         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56021         obj_conv.is_owned = false;
56022         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
56023         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56024         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56025         CVec_u8Z_free(ret_var);
56026         return ret_arr;
56027 }
56028
56029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
56030         LDKu8slice ser_ref;
56031         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
56032         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
56033         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
56034         *ret_conv = InvoiceError_read(ser_ref);
56035         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
56036         return tag_ptr(ret_conv, true);
56037 }
56038
56039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56040         LDKUnsignedInvoiceRequest this_obj_conv;
56041         this_obj_conv.inner = untag_ptr(this_obj);
56042         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56044         UnsignedInvoiceRequest_free(this_obj_conv);
56045 }
56046
56047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56048         LDKInvoiceRequest this_obj_conv;
56049         this_obj_conv.inner = untag_ptr(this_obj);
56050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56052         InvoiceRequest_free(this_obj_conv);
56053 }
56054
56055 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
56056         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
56057         int64_t ret_ref = 0;
56058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56060         return ret_ref;
56061 }
56062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56063         LDKInvoiceRequest arg_conv;
56064         arg_conv.inner = untag_ptr(arg);
56065         arg_conv.is_owned = ptr_is_owned(arg);
56066         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56067         arg_conv.is_owned = false;
56068         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
56069         return ret_conv;
56070 }
56071
56072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56073         LDKInvoiceRequest orig_conv;
56074         orig_conv.inner = untag_ptr(orig);
56075         orig_conv.is_owned = ptr_is_owned(orig);
56076         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56077         orig_conv.is_owned = false;
56078         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
56079         int64_t ret_ref = 0;
56080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56082         return ret_ref;
56083 }
56084
56085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
56086         LDKInvoiceRequest this_arg_conv;
56087         this_arg_conv.inner = untag_ptr(this_arg);
56088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56090         this_arg_conv.is_owned = false;
56091         LDKu8slice ret_var = InvoiceRequest_metadata(&this_arg_conv);
56092         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56093         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56094         return ret_arr;
56095 }
56096
56097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
56098         LDKInvoiceRequest this_arg_conv;
56099         this_arg_conv.inner = untag_ptr(this_arg);
56100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56102         this_arg_conv.is_owned = false;
56103         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56104         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
56105         return ret_arr;
56106 }
56107
56108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
56109         LDKInvoiceRequest this_arg_conv;
56110         this_arg_conv.inner = untag_ptr(this_arg);
56111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56113         this_arg_conv.is_owned = false;
56114         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56115         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
56116         int64_t ret_ref = tag_ptr(ret_copy, true);
56117         return ret_ref;
56118 }
56119
56120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
56121         LDKInvoiceRequest this_arg_conv;
56122         this_arg_conv.inner = untag_ptr(this_arg);
56123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56125         this_arg_conv.is_owned = false;
56126         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_features(&this_arg_conv);
56127         int64_t ret_ref = 0;
56128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56130         return ret_ref;
56131 }
56132
56133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
56134         LDKInvoiceRequest this_arg_conv;
56135         this_arg_conv.inner = untag_ptr(this_arg);
56136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56138         this_arg_conv.is_owned = false;
56139         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56140         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
56141         int64_t ret_ref = tag_ptr(ret_copy, true);
56142         return ret_ref;
56143 }
56144
56145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
56146         LDKInvoiceRequest this_arg_conv;
56147         this_arg_conv.inner = untag_ptr(this_arg);
56148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56150         this_arg_conv.is_owned = false;
56151         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56152         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
56153         return ret_arr;
56154 }
56155
56156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
56157         LDKInvoiceRequest this_arg_conv;
56158         this_arg_conv.inner = untag_ptr(this_arg);
56159         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56161         this_arg_conv.is_owned = false;
56162         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
56163         int64_t ret_ref = 0;
56164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56166         return ret_ref;
56167 }
56168
56169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
56170         LDKInvoiceRequest this_arg_conv;
56171         this_arg_conv.inner = untag_ptr(this_arg);
56172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56174         this_arg_conv.is_owned = false;
56175         LDKExpandedKey key_conv;
56176         key_conv.inner = untag_ptr(key);
56177         key_conv.is_owned = ptr_is_owned(key);
56178         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
56179         key_conv.is_owned = false;
56180         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
56181         *ret_conv = InvoiceRequest_verify(&this_arg_conv, &key_conv);
56182         return tag_ptr(ret_conv, true);
56183 }
56184
56185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
56186         LDKInvoiceRequest obj_conv;
56187         obj_conv.inner = untag_ptr(obj);
56188         obj_conv.is_owned = ptr_is_owned(obj);
56189         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56190         obj_conv.is_owned = false;
56191         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
56192         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56193         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56194         CVec_u8Z_free(ret_var);
56195         return ret_arr;
56196 }
56197
56198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56199         LDKOffer this_obj_conv;
56200         this_obj_conv.inner = untag_ptr(this_obj);
56201         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56203         Offer_free(this_obj_conv);
56204 }
56205
56206 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
56207         LDKOffer ret_var = Offer_clone(arg);
56208         int64_t ret_ref = 0;
56209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56211         return ret_ref;
56212 }
56213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56214         LDKOffer arg_conv;
56215         arg_conv.inner = untag_ptr(arg);
56216         arg_conv.is_owned = ptr_is_owned(arg);
56217         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56218         arg_conv.is_owned = false;
56219         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
56220         return ret_conv;
56221 }
56222
56223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56224         LDKOffer orig_conv;
56225         orig_conv.inner = untag_ptr(orig);
56226         orig_conv.is_owned = ptr_is_owned(orig);
56227         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56228         orig_conv.is_owned = false;
56229         LDKOffer ret_var = Offer_clone(&orig_conv);
56230         int64_t ret_ref = 0;
56231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56233         return ret_ref;
56234 }
56235
56236 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
56237         LDKOffer this_arg_conv;
56238         this_arg_conv.inner = untag_ptr(this_arg);
56239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56241         this_arg_conv.is_owned = false;
56242         LDKCVec_ChainHashZ ret_var = Offer_chains(&this_arg_conv);
56243         jobjectArray ret_arr = NULL;
56244         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
56245         ;
56246         for (size_t i = 0; i < ret_var.datalen; i++) {
56247                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
56248                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
56249                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
56250         }
56251         
56252         FREE(ret_var.data);
56253         return ret_arr;
56254 }
56255
56256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
56257         LDKOffer this_arg_conv;
56258         this_arg_conv.inner = untag_ptr(this_arg);
56259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56261         this_arg_conv.is_owned = false;
56262         LDKThirtyTwoBytes chain_ref;
56263         CHECK((*env)->GetArrayLength(env, chain) == 32);
56264         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
56265         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
56266         return ret_conv;
56267 }
56268
56269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
56270         LDKOffer this_arg_conv;
56271         this_arg_conv.inner = untag_ptr(this_arg);
56272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56274         this_arg_conv.is_owned = false;
56275         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
56276         *ret_copy = Offer_metadata(&this_arg_conv);
56277         int64_t ret_ref = tag_ptr(ret_copy, true);
56278         return ret_ref;
56279 }
56280
56281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
56282         LDKOffer this_arg_conv;
56283         this_arg_conv.inner = untag_ptr(this_arg);
56284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56286         this_arg_conv.is_owned = false;
56287         LDKAmount ret_var = Offer_amount(&this_arg_conv);
56288         int64_t ret_ref = 0;
56289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56291         return ret_ref;
56292 }
56293
56294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
56295         LDKOffer this_arg_conv;
56296         this_arg_conv.inner = untag_ptr(this_arg);
56297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56299         this_arg_conv.is_owned = false;
56300         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
56301         int64_t ret_ref = 0;
56302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56304         return ret_ref;
56305 }
56306
56307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
56308         LDKOffer this_arg_conv;
56309         this_arg_conv.inner = untag_ptr(this_arg);
56310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56312         this_arg_conv.is_owned = false;
56313         LDKOfferFeatures ret_var = Offer_features(&this_arg_conv);
56314         int64_t ret_ref = 0;
56315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56317         return ret_ref;
56318 }
56319
56320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
56321         LDKOffer this_arg_conv;
56322         this_arg_conv.inner = untag_ptr(this_arg);
56323         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56325         this_arg_conv.is_owned = false;
56326         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
56327         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
56328         int64_t ret_ref = tag_ptr(ret_copy, true);
56329         return ret_ref;
56330 }
56331
56332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
56333         LDKOffer this_arg_conv;
56334         this_arg_conv.inner = untag_ptr(this_arg);
56335         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56337         this_arg_conv.is_owned = false;
56338         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
56339         return ret_conv;
56340 }
56341
56342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
56343         LDKOffer this_arg_conv;
56344         this_arg_conv.inner = untag_ptr(this_arg);
56345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56347         this_arg_conv.is_owned = false;
56348         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
56349         int64_t ret_ref = 0;
56350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56352         return ret_ref;
56353 }
56354
56355 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
56356         LDKOffer this_arg_conv;
56357         this_arg_conv.inner = untag_ptr(this_arg);
56358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56360         this_arg_conv.is_owned = false;
56361         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
56362         int64_tArray ret_arr = NULL;
56363         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
56364         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
56365         for (size_t n = 0; n < ret_var.datalen; n++) {
56366                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
56367                 int64_t ret_conv_13_ref = 0;
56368                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
56369                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
56370                 ret_arr_ptr[n] = ret_conv_13_ref;
56371         }
56372         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
56373         FREE(ret_var.data);
56374         return ret_arr;
56375 }
56376
56377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
56378         LDKOffer this_arg_conv;
56379         this_arg_conv.inner = untag_ptr(this_arg);
56380         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56382         this_arg_conv.is_owned = false;
56383         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
56384         int64_t ret_ref = 0;
56385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56387         return ret_ref;
56388 }
56389
56390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
56391         LDKOffer this_arg_conv;
56392         this_arg_conv.inner = untag_ptr(this_arg);
56393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56395         this_arg_conv.is_owned = false;
56396         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
56397         return ret_conv;
56398 }
56399
56400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
56401         LDKOffer this_arg_conv;
56402         this_arg_conv.inner = untag_ptr(this_arg);
56403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56405         this_arg_conv.is_owned = false;
56406         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
56407         return ret_conv;
56408 }
56409
56410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
56411         LDKOffer this_arg_conv;
56412         this_arg_conv.inner = untag_ptr(this_arg);
56413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56415         this_arg_conv.is_owned = false;
56416         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56417         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
56418         return ret_arr;
56419 }
56420
56421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
56422         LDKOffer obj_conv;
56423         obj_conv.inner = untag_ptr(obj);
56424         obj_conv.is_owned = ptr_is_owned(obj);
56425         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56426         obj_conv.is_owned = false;
56427         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
56428         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56429         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56430         CVec_u8Z_free(ret_var);
56431         return ret_arr;
56432 }
56433
56434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56435         LDKAmount this_obj_conv;
56436         this_obj_conv.inner = untag_ptr(this_obj);
56437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56439         Amount_free(this_obj_conv);
56440 }
56441
56442 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
56443         LDKAmount ret_var = Amount_clone(arg);
56444         int64_t ret_ref = 0;
56445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56447         return ret_ref;
56448 }
56449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56450         LDKAmount arg_conv;
56451         arg_conv.inner = untag_ptr(arg);
56452         arg_conv.is_owned = ptr_is_owned(arg);
56453         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56454         arg_conv.is_owned = false;
56455         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
56456         return ret_conv;
56457 }
56458
56459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56460         LDKAmount orig_conv;
56461         orig_conv.inner = untag_ptr(orig);
56462         orig_conv.is_owned = ptr_is_owned(orig);
56463         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56464         orig_conv.is_owned = false;
56465         LDKAmount ret_var = Amount_clone(&orig_conv);
56466         int64_t ret_ref = 0;
56467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56469         return ret_ref;
56470 }
56471
56472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56473         LDKQuantity this_obj_conv;
56474         this_obj_conv.inner = untag_ptr(this_obj);
56475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56477         Quantity_free(this_obj_conv);
56478 }
56479
56480 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
56481         LDKQuantity ret_var = Quantity_clone(arg);
56482         int64_t ret_ref = 0;
56483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56485         return ret_ref;
56486 }
56487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56488         LDKQuantity arg_conv;
56489         arg_conv.inner = untag_ptr(arg);
56490         arg_conv.is_owned = ptr_is_owned(arg);
56491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56492         arg_conv.is_owned = false;
56493         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
56494         return ret_conv;
56495 }
56496
56497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56498         LDKQuantity orig_conv;
56499         orig_conv.inner = untag_ptr(orig);
56500         orig_conv.is_owned = ptr_is_owned(orig);
56501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56502         orig_conv.is_owned = false;
56503         LDKQuantity ret_var = Quantity_clone(&orig_conv);
56504         int64_t ret_ref = 0;
56505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56507         return ret_ref;
56508 }
56509
56510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
56511         LDKStr s_conv = java_to_owned_str(env, s);
56512         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
56513         *ret_conv = Offer_from_str(s_conv);
56514         return tag_ptr(ret_conv, true);
56515 }
56516
56517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56518         LDKBolt12ParseError this_obj_conv;
56519         this_obj_conv.inner = untag_ptr(this_obj);
56520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56522         Bolt12ParseError_free(this_obj_conv);
56523 }
56524
56525 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
56526         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
56527         int64_t ret_ref = 0;
56528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56530         return ret_ref;
56531 }
56532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56533         LDKBolt12ParseError arg_conv;
56534         arg_conv.inner = untag_ptr(arg);
56535         arg_conv.is_owned = ptr_is_owned(arg);
56536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56537         arg_conv.is_owned = false;
56538         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
56539         return ret_conv;
56540 }
56541
56542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56543         LDKBolt12ParseError orig_conv;
56544         orig_conv.inner = untag_ptr(orig);
56545         orig_conv.is_owned = ptr_is_owned(orig);
56546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56547         orig_conv.is_owned = false;
56548         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
56549         int64_t ret_ref = 0;
56550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56552         return ret_ref;
56553 }
56554
56555 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56556         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
56557         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
56558         return ret_conv;
56559 }
56560
56561 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
56562         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
56563         return ret_conv;
56564 }
56565
56566 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
56567         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
56568         return ret_conv;
56569 }
56570
56571 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
56572         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
56573         return ret_conv;
56574 }
56575
56576 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
56577         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
56578         return ret_conv;
56579 }
56580
56581 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
56582         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
56583         return ret_conv;
56584 }
56585
56586 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
56587         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
56588         return ret_conv;
56589 }
56590
56591 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
56592         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
56593         return ret_conv;
56594 }
56595
56596 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
56597         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
56598         return ret_conv;
56599 }
56600
56601 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
56602         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
56603         return ret_conv;
56604 }
56605
56606 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
56607         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
56608         return ret_conv;
56609 }
56610
56611 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
56612         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
56613         return ret_conv;
56614 }
56615
56616 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
56617         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
56618         return ret_conv;
56619 }
56620
56621 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
56622         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
56623         return ret_conv;
56624 }
56625
56626 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
56627         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
56628         return ret_conv;
56629 }
56630
56631 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
56632         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
56633         return ret_conv;
56634 }
56635
56636 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
56637         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
56638         return ret_conv;
56639 }
56640
56641 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
56642         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
56643         return ret_conv;
56644 }
56645
56646 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
56647         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
56648         return ret_conv;
56649 }
56650
56651 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
56652         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
56653         return ret_conv;
56654 }
56655
56656 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
56657         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
56658         return ret_conv;
56659 }
56660
56661 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
56662         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
56663         return ret_conv;
56664 }
56665
56666 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
56667         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
56668         return ret_conv;
56669 }
56670
56671 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
56672         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
56673         return ret_conv;
56674 }
56675
56676 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
56677         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
56678         return ret_conv;
56679 }
56680
56681 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
56682         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
56683         return ret_conv;
56684 }
56685
56686 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
56687         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
56688         return ret_conv;
56689 }
56690
56691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56692         LDKRefund this_obj_conv;
56693         this_obj_conv.inner = untag_ptr(this_obj);
56694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56696         Refund_free(this_obj_conv);
56697 }
56698
56699 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
56700         LDKRefund ret_var = Refund_clone(arg);
56701         int64_t ret_ref = 0;
56702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56704         return ret_ref;
56705 }
56706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56707         LDKRefund arg_conv;
56708         arg_conv.inner = untag_ptr(arg);
56709         arg_conv.is_owned = ptr_is_owned(arg);
56710         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56711         arg_conv.is_owned = false;
56712         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
56713         return ret_conv;
56714 }
56715
56716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56717         LDKRefund orig_conv;
56718         orig_conv.inner = untag_ptr(orig);
56719         orig_conv.is_owned = ptr_is_owned(orig);
56720         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56721         orig_conv.is_owned = false;
56722         LDKRefund ret_var = Refund_clone(&orig_conv);
56723         int64_t ret_ref = 0;
56724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56726         return ret_ref;
56727 }
56728
56729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
56730         LDKRefund this_arg_conv;
56731         this_arg_conv.inner = untag_ptr(this_arg);
56732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56734         this_arg_conv.is_owned = false;
56735         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
56736         int64_t ret_ref = 0;
56737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56739         return ret_ref;
56740 }
56741
56742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
56743         LDKRefund this_arg_conv;
56744         this_arg_conv.inner = untag_ptr(this_arg);
56745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56747         this_arg_conv.is_owned = false;
56748         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
56749         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
56750         int64_t ret_ref = tag_ptr(ret_copy, true);
56751         return ret_ref;
56752 }
56753
56754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
56755         LDKRefund this_arg_conv;
56756         this_arg_conv.inner = untag_ptr(this_arg);
56757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56759         this_arg_conv.is_owned = false;
56760         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
56761         return ret_conv;
56762 }
56763
56764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
56765         LDKRefund this_arg_conv;
56766         this_arg_conv.inner = untag_ptr(this_arg);
56767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56769         this_arg_conv.is_owned = false;
56770         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
56771         int64_t ret_ref = 0;
56772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56774         return ret_ref;
56775 }
56776
56777 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
56778         LDKRefund this_arg_conv;
56779         this_arg_conv.inner = untag_ptr(this_arg);
56780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56782         this_arg_conv.is_owned = false;
56783         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
56784         int64_tArray ret_arr = NULL;
56785         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
56786         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
56787         for (size_t n = 0; n < ret_var.datalen; n++) {
56788                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
56789                 int64_t ret_conv_13_ref = 0;
56790                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
56791                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
56792                 ret_arr_ptr[n] = ret_conv_13_ref;
56793         }
56794         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
56795         FREE(ret_var.data);
56796         return ret_arr;
56797 }
56798
56799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
56800         LDKRefund this_arg_conv;
56801         this_arg_conv.inner = untag_ptr(this_arg);
56802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56804         this_arg_conv.is_owned = false;
56805         LDKu8slice ret_var = Refund_metadata(&this_arg_conv);
56806         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56807         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56808         return ret_arr;
56809 }
56810
56811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
56812         LDKRefund this_arg_conv;
56813         this_arg_conv.inner = untag_ptr(this_arg);
56814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56816         this_arg_conv.is_owned = false;
56817         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56818         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
56819         return ret_arr;
56820 }
56821
56822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
56823         LDKRefund this_arg_conv;
56824         this_arg_conv.inner = untag_ptr(this_arg);
56825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56827         this_arg_conv.is_owned = false;
56828         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
56829         return ret_conv;
56830 }
56831
56832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
56833         LDKRefund this_arg_conv;
56834         this_arg_conv.inner = untag_ptr(this_arg);
56835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56837         this_arg_conv.is_owned = false;
56838         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
56839         int64_t ret_ref = 0;
56840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56842         return ret_ref;
56843 }
56844
56845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
56846         LDKRefund this_arg_conv;
56847         this_arg_conv.inner = untag_ptr(this_arg);
56848         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56850         this_arg_conv.is_owned = false;
56851         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
56852         *ret_copy = Refund_quantity(&this_arg_conv);
56853         int64_t ret_ref = tag_ptr(ret_copy, true);
56854         return ret_ref;
56855 }
56856
56857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
56858         LDKRefund this_arg_conv;
56859         this_arg_conv.inner = untag_ptr(this_arg);
56860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56862         this_arg_conv.is_owned = false;
56863         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56864         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
56865         return ret_arr;
56866 }
56867
56868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
56869         LDKRefund this_arg_conv;
56870         this_arg_conv.inner = untag_ptr(this_arg);
56871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56873         this_arg_conv.is_owned = false;
56874         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
56875         int64_t ret_ref = 0;
56876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56878         return ret_ref;
56879 }
56880
56881 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
56882         LDKRefund obj_conv;
56883         obj_conv.inner = untag_ptr(obj);
56884         obj_conv.is_owned = ptr_is_owned(obj);
56885         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56886         obj_conv.is_owned = false;
56887         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
56888         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
56889         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
56890         CVec_u8Z_free(ret_var);
56891         return ret_arr;
56892 }
56893
56894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
56895         LDKStr s_conv = java_to_owned_str(env, s);
56896         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
56897         *ret_conv = Refund_from_str(s_conv);
56898         return tag_ptr(ret_conv, true);
56899 }
56900
56901 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56902         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
56903         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
56904         return ret_conv;
56905 }
56906
56907 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
56908         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
56909         return ret_conv;
56910 }
56911
56912 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
56913         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
56914         return ret_conv;
56915 }
56916
56917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56918         if (!ptr_is_owned(this_ptr)) return;
56919         void* this_ptr_ptr = untag_ptr(this_ptr);
56920         CHECK_ACCESS(this_ptr_ptr);
56921         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
56922         FREE(untag_ptr(this_ptr));
56923         UtxoResult_free(this_ptr_conv);
56924 }
56925
56926 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
56927         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56928         *ret_copy = UtxoResult_clone(arg);
56929         int64_t ret_ref = tag_ptr(ret_copy, true);
56930         return ret_ref;
56931 }
56932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56933         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
56934         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
56935         return ret_conv;
56936 }
56937
56938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56939         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
56940         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56941         *ret_copy = UtxoResult_clone(orig_conv);
56942         int64_t ret_ref = tag_ptr(ret_copy, true);
56943         return ret_ref;
56944 }
56945
56946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
56947         void* a_ptr = untag_ptr(a);
56948         CHECK_ACCESS(a_ptr);
56949         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
56950         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
56951         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56952         *ret_copy = UtxoResult_sync(a_conv);
56953         int64_t ret_ref = tag_ptr(ret_copy, true);
56954         return ret_ref;
56955 }
56956
56957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
56958         LDKUtxoFuture a_conv;
56959         a_conv.inner = untag_ptr(a);
56960         a_conv.is_owned = ptr_is_owned(a);
56961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56962         a_conv = UtxoFuture_clone(&a_conv);
56963         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
56964         *ret_copy = UtxoResult_async(a_conv);
56965         int64_t ret_ref = tag_ptr(ret_copy, true);
56966         return ret_ref;
56967 }
56968
56969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
56970         if (!ptr_is_owned(this_ptr)) return;
56971         void* this_ptr_ptr = untag_ptr(this_ptr);
56972         CHECK_ACCESS(this_ptr_ptr);
56973         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
56974         FREE(untag_ptr(this_ptr));
56975         UtxoLookup_free(this_ptr_conv);
56976 }
56977
56978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56979         LDKUtxoFuture this_obj_conv;
56980         this_obj_conv.inner = untag_ptr(this_obj);
56981         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56983         UtxoFuture_free(this_obj_conv);
56984 }
56985
56986 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
56987         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
56988         int64_t ret_ref = 0;
56989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56991         return ret_ref;
56992 }
56993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56994         LDKUtxoFuture arg_conv;
56995         arg_conv.inner = untag_ptr(arg);
56996         arg_conv.is_owned = ptr_is_owned(arg);
56997         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56998         arg_conv.is_owned = false;
56999         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
57000         return ret_conv;
57001 }
57002
57003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57004         LDKUtxoFuture orig_conv;
57005         orig_conv.inner = untag_ptr(orig);
57006         orig_conv.is_owned = ptr_is_owned(orig);
57007         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57008         orig_conv.is_owned = false;
57009         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
57010         int64_t ret_ref = 0;
57011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57013         return ret_ref;
57014 }
57015
57016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
57017         LDKUtxoFuture ret_var = UtxoFuture_new();
57018         int64_t ret_ref = 0;
57019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57021         return ret_ref;
57022 }
57023
57024 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) {
57025         LDKUtxoFuture this_arg_conv;
57026         this_arg_conv.inner = untag_ptr(this_arg);
57027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57029         this_arg_conv.is_owned = false;
57030         LDKNetworkGraph graph_conv;
57031         graph_conv.inner = untag_ptr(graph);
57032         graph_conv.is_owned = ptr_is_owned(graph);
57033         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
57034         graph_conv.is_owned = false;
57035         void* result_ptr = untag_ptr(result);
57036         CHECK_ACCESS(result_ptr);
57037         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
57038         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
57039 }
57040
57041 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) {
57042         LDKUtxoFuture this_arg_conv;
57043         this_arg_conv.inner = untag_ptr(this_arg);
57044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57046         this_arg_conv.is_owned = false;
57047         LDKNetworkGraph graph_conv;
57048         graph_conv.inner = untag_ptr(graph);
57049         graph_conv.is_owned = ptr_is_owned(graph);
57050         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
57051         graph_conv.is_owned = false;
57052         LDKP2PGossipSync gossip_conv;
57053         gossip_conv.inner = untag_ptr(gossip);
57054         gossip_conv.is_owned = ptr_is_owned(gossip);
57055         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
57056         gossip_conv.is_owned = false;
57057         void* result_ptr = untag_ptr(result);
57058         CHECK_ACCESS(result_ptr);
57059         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
57060         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
57061 }
57062
57063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57064         LDKNodeId this_obj_conv;
57065         this_obj_conv.inner = untag_ptr(this_obj);
57066         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57068         NodeId_free(this_obj_conv);
57069 }
57070
57071 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
57072         LDKNodeId ret_var = NodeId_clone(arg);
57073         int64_t ret_ref = 0;
57074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57076         return ret_ref;
57077 }
57078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57079         LDKNodeId arg_conv;
57080         arg_conv.inner = untag_ptr(arg);
57081         arg_conv.is_owned = ptr_is_owned(arg);
57082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57083         arg_conv.is_owned = false;
57084         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
57085         return ret_conv;
57086 }
57087
57088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57089         LDKNodeId orig_conv;
57090         orig_conv.inner = untag_ptr(orig);
57091         orig_conv.is_owned = ptr_is_owned(orig);
57092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57093         orig_conv.is_owned = false;
57094         LDKNodeId ret_var = NodeId_clone(&orig_conv);
57095         int64_t ret_ref = 0;
57096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57098         return ret_ref;
57099 }
57100
57101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
57102         LDKPublicKey pubkey_ref;
57103         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
57104         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
57105         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
57106         int64_t ret_ref = 0;
57107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57109         return ret_ref;
57110 }
57111
57112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
57113         LDKNodeId this_arg_conv;
57114         this_arg_conv.inner = untag_ptr(this_arg);
57115         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57117         this_arg_conv.is_owned = false;
57118         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
57119         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57120         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57121         return ret_arr;
57122 }
57123
57124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
57125         LDKNodeId this_arg_conv;
57126         this_arg_conv.inner = untag_ptr(this_arg);
57127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57129         this_arg_conv.is_owned = false;
57130         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
57131         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
57132         return tag_ptr(ret_conv, true);
57133 }
57134
57135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
57136         LDKNodeId o_conv;
57137         o_conv.inner = untag_ptr(o);
57138         o_conv.is_owned = ptr_is_owned(o);
57139         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57140         o_conv.is_owned = false;
57141         int64_t ret_conv = NodeId_hash(&o_conv);
57142         return ret_conv;
57143 }
57144
57145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
57146         LDKNodeId obj_conv;
57147         obj_conv.inner = untag_ptr(obj);
57148         obj_conv.is_owned = ptr_is_owned(obj);
57149         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57150         obj_conv.is_owned = false;
57151         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
57152         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57153         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57154         CVec_u8Z_free(ret_var);
57155         return ret_arr;
57156 }
57157
57158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57159         LDKu8slice ser_ref;
57160         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57161         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57162         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
57163         *ret_conv = NodeId_read(ser_ref);
57164         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57165         return tag_ptr(ret_conv, true);
57166 }
57167
57168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57169         LDKNetworkGraph this_obj_conv;
57170         this_obj_conv.inner = untag_ptr(this_obj);
57171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57173         NetworkGraph_free(this_obj_conv);
57174 }
57175
57176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57177         LDKReadOnlyNetworkGraph this_obj_conv;
57178         this_obj_conv.inner = untag_ptr(this_obj);
57179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57181         ReadOnlyNetworkGraph_free(this_obj_conv);
57182 }
57183
57184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57185         if (!ptr_is_owned(this_ptr)) return;
57186         void* this_ptr_ptr = untag_ptr(this_ptr);
57187         CHECK_ACCESS(this_ptr_ptr);
57188         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
57189         FREE(untag_ptr(this_ptr));
57190         NetworkUpdate_free(this_ptr_conv);
57191 }
57192
57193 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
57194         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57195         *ret_copy = NetworkUpdate_clone(arg);
57196         int64_t ret_ref = tag_ptr(ret_copy, true);
57197         return ret_ref;
57198 }
57199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57200         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
57201         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
57202         return ret_conv;
57203 }
57204
57205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57206         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
57207         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57208         *ret_copy = NetworkUpdate_clone(orig_conv);
57209         int64_t ret_ref = tag_ptr(ret_copy, true);
57210         return ret_ref;
57211 }
57212
57213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
57214         LDKChannelUpdate msg_conv;
57215         msg_conv.inner = untag_ptr(msg);
57216         msg_conv.is_owned = ptr_is_owned(msg);
57217         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57218         msg_conv = ChannelUpdate_clone(&msg_conv);
57219         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57220         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
57221         int64_t ret_ref = tag_ptr(ret_copy, true);
57222         return ret_ref;
57223 }
57224
57225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
57226         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57227         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
57228         int64_t ret_ref = tag_ptr(ret_copy, true);
57229         return ret_ref;
57230 }
57231
57232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
57233         LDKPublicKey node_id_ref;
57234         CHECK((*env)->GetArrayLength(env, node_id) == 33);
57235         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
57236         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
57237         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
57238         int64_t ret_ref = tag_ptr(ret_copy, true);
57239         return ret_ref;
57240 }
57241
57242 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57243         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
57244         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
57245         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
57246         return ret_conv;
57247 }
57248
57249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
57250         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
57251         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
57252         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57253         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57254         CVec_u8Z_free(ret_var);
57255         return ret_arr;
57256 }
57257
57258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57259         LDKu8slice ser_ref;
57260         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57261         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57262         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
57263         *ret_conv = NetworkUpdate_read(ser_ref);
57264         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57265         return tag_ptr(ret_conv, true);
57266 }
57267
57268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57269         LDKP2PGossipSync this_obj_conv;
57270         this_obj_conv.inner = untag_ptr(this_obj);
57271         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57273         P2PGossipSync_free(this_obj_conv);
57274 }
57275
57276 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) {
57277         LDKNetworkGraph network_graph_conv;
57278         network_graph_conv.inner = untag_ptr(network_graph);
57279         network_graph_conv.is_owned = ptr_is_owned(network_graph);
57280         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
57281         network_graph_conv.is_owned = false;
57282         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
57283         CHECK_ACCESS(utxo_lookup_ptr);
57284         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
57285         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
57286         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
57287                 // Manually implement clone for Java trait instances
57288                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
57289                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57290                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
57291                 }
57292         }
57293         void* logger_ptr = untag_ptr(logger);
57294         CHECK_ACCESS(logger_ptr);
57295         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
57296         if (logger_conv.free == LDKLogger_JCalls_free) {
57297                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57298                 LDKLogger_JCalls_cloned(&logger_conv);
57299         }
57300         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
57301         int64_t ret_ref = 0;
57302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57304         return ret_ref;
57305 }
57306
57307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
57308         LDKP2PGossipSync this_arg_conv;
57309         this_arg_conv.inner = untag_ptr(this_arg);
57310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57312         this_arg_conv.is_owned = false;
57313         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
57314         CHECK_ACCESS(utxo_lookup_ptr);
57315         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
57316         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
57317         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
57318                 // Manually implement clone for Java trait instances
57319                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
57320                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57321                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
57322                 }
57323         }
57324         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
57325 }
57326
57327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
57328         LDKNetworkGraph this_arg_conv;
57329         this_arg_conv.inner = untag_ptr(this_arg);
57330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57332         this_arg_conv.is_owned = false;
57333         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
57334         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
57335 }
57336
57337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1genesis_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
57338         LDKNetworkGraph this_arg_conv;
57339         this_arg_conv.inner = untag_ptr(this_arg);
57340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57342         this_arg_conv.is_owned = false;
57343         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
57344         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_genesis_hash(&this_arg_conv).data);
57345         return ret_arr;
57346 }
57347
57348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
57349         LDKNodeAnnouncement msg_conv;
57350         msg_conv.inner = untag_ptr(msg);
57351         msg_conv.is_owned = ptr_is_owned(msg);
57352         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57353         msg_conv.is_owned = false;
57354         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57355         *ret_conv = verify_node_announcement(&msg_conv);
57356         return tag_ptr(ret_conv, true);
57357 }
57358
57359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
57360         LDKChannelAnnouncement msg_conv;
57361         msg_conv.inner = untag_ptr(msg);
57362         msg_conv.is_owned = ptr_is_owned(msg);
57363         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
57364         msg_conv.is_owned = false;
57365         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
57366         *ret_conv = verify_channel_announcement(&msg_conv);
57367         return tag_ptr(ret_conv, true);
57368 }
57369
57370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
57371         LDKP2PGossipSync this_arg_conv;
57372         this_arg_conv.inner = untag_ptr(this_arg);
57373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57375         this_arg_conv.is_owned = false;
57376         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
57377         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
57378         return tag_ptr(ret_ret, true);
57379 }
57380
57381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
57382         LDKP2PGossipSync this_arg_conv;
57383         this_arg_conv.inner = untag_ptr(this_arg);
57384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57386         this_arg_conv.is_owned = false;
57387         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
57388         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
57389         return tag_ptr(ret_ret, true);
57390 }
57391
57392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57393         LDKChannelUpdateInfo this_obj_conv;
57394         this_obj_conv.inner = untag_ptr(this_obj);
57395         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57397         ChannelUpdateInfo_free(this_obj_conv);
57398 }
57399
57400 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
57401         LDKChannelUpdateInfo this_ptr_conv;
57402         this_ptr_conv.inner = untag_ptr(this_ptr);
57403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57405         this_ptr_conv.is_owned = false;
57406         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
57407         return ret_conv;
57408 }
57409
57410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
57411         LDKChannelUpdateInfo this_ptr_conv;
57412         this_ptr_conv.inner = untag_ptr(this_ptr);
57413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57415         this_ptr_conv.is_owned = false;
57416         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
57417 }
57418
57419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
57420         LDKChannelUpdateInfo this_ptr_conv;
57421         this_ptr_conv.inner = untag_ptr(this_ptr);
57422         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57423         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57424         this_ptr_conv.is_owned = false;
57425         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
57426         return ret_conv;
57427 }
57428
57429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
57430         LDKChannelUpdateInfo this_ptr_conv;
57431         this_ptr_conv.inner = untag_ptr(this_ptr);
57432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57434         this_ptr_conv.is_owned = false;
57435         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
57436 }
57437
57438 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
57439         LDKChannelUpdateInfo this_ptr_conv;
57440         this_ptr_conv.inner = untag_ptr(this_ptr);
57441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57443         this_ptr_conv.is_owned = false;
57444         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
57445         return ret_conv;
57446 }
57447
57448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
57449         LDKChannelUpdateInfo this_ptr_conv;
57450         this_ptr_conv.inner = untag_ptr(this_ptr);
57451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57453         this_ptr_conv.is_owned = false;
57454         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
57455 }
57456
57457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
57458         LDKChannelUpdateInfo this_ptr_conv;
57459         this_ptr_conv.inner = untag_ptr(this_ptr);
57460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57462         this_ptr_conv.is_owned = false;
57463         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
57464         return ret_conv;
57465 }
57466
57467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57468         LDKChannelUpdateInfo this_ptr_conv;
57469         this_ptr_conv.inner = untag_ptr(this_ptr);
57470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57472         this_ptr_conv.is_owned = false;
57473         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
57474 }
57475
57476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
57477         LDKChannelUpdateInfo this_ptr_conv;
57478         this_ptr_conv.inner = untag_ptr(this_ptr);
57479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57481         this_ptr_conv.is_owned = false;
57482         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
57483         return ret_conv;
57484 }
57485
57486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57487         LDKChannelUpdateInfo this_ptr_conv;
57488         this_ptr_conv.inner = untag_ptr(this_ptr);
57489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57491         this_ptr_conv.is_owned = false;
57492         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
57493 }
57494
57495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
57496         LDKChannelUpdateInfo this_ptr_conv;
57497         this_ptr_conv.inner = untag_ptr(this_ptr);
57498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57500         this_ptr_conv.is_owned = false;
57501         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
57502         int64_t ret_ref = 0;
57503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57505         return ret_ref;
57506 }
57507
57508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57509         LDKChannelUpdateInfo this_ptr_conv;
57510         this_ptr_conv.inner = untag_ptr(this_ptr);
57511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57513         this_ptr_conv.is_owned = false;
57514         LDKRoutingFees val_conv;
57515         val_conv.inner = untag_ptr(val);
57516         val_conv.is_owned = ptr_is_owned(val);
57517         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57518         val_conv = RoutingFees_clone(&val_conv);
57519         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
57520 }
57521
57522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
57523         LDKChannelUpdateInfo this_ptr_conv;
57524         this_ptr_conv.inner = untag_ptr(this_ptr);
57525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57527         this_ptr_conv.is_owned = false;
57528         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
57529         int64_t ret_ref = 0;
57530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57532         return ret_ref;
57533 }
57534
57535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57536         LDKChannelUpdateInfo this_ptr_conv;
57537         this_ptr_conv.inner = untag_ptr(this_ptr);
57538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57540         this_ptr_conv.is_owned = false;
57541         LDKChannelUpdate val_conv;
57542         val_conv.inner = untag_ptr(val);
57543         val_conv.is_owned = ptr_is_owned(val);
57544         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57545         val_conv = ChannelUpdate_clone(&val_conv);
57546         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
57547 }
57548
57549 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) {
57550         LDKRoutingFees fees_arg_conv;
57551         fees_arg_conv.inner = untag_ptr(fees_arg);
57552         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
57553         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
57554         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
57555         LDKChannelUpdate last_update_message_arg_conv;
57556         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
57557         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
57558         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
57559         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
57560         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);
57561         int64_t ret_ref = 0;
57562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57564         return ret_ref;
57565 }
57566
57567 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
57568         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
57569         int64_t ret_ref = 0;
57570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57572         return ret_ref;
57573 }
57574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57575         LDKChannelUpdateInfo arg_conv;
57576         arg_conv.inner = untag_ptr(arg);
57577         arg_conv.is_owned = ptr_is_owned(arg);
57578         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57579         arg_conv.is_owned = false;
57580         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
57581         return ret_conv;
57582 }
57583
57584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57585         LDKChannelUpdateInfo orig_conv;
57586         orig_conv.inner = untag_ptr(orig);
57587         orig_conv.is_owned = ptr_is_owned(orig);
57588         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57589         orig_conv.is_owned = false;
57590         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
57591         int64_t ret_ref = 0;
57592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57594         return ret_ref;
57595 }
57596
57597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57598         LDKChannelUpdateInfo a_conv;
57599         a_conv.inner = untag_ptr(a);
57600         a_conv.is_owned = ptr_is_owned(a);
57601         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57602         a_conv.is_owned = false;
57603         LDKChannelUpdateInfo b_conv;
57604         b_conv.inner = untag_ptr(b);
57605         b_conv.is_owned = ptr_is_owned(b);
57606         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57607         b_conv.is_owned = false;
57608         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
57609         return ret_conv;
57610 }
57611
57612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
57613         LDKChannelUpdateInfo obj_conv;
57614         obj_conv.inner = untag_ptr(obj);
57615         obj_conv.is_owned = ptr_is_owned(obj);
57616         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57617         obj_conv.is_owned = false;
57618         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
57619         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57620         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57621         CVec_u8Z_free(ret_var);
57622         return ret_arr;
57623 }
57624
57625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57626         LDKu8slice ser_ref;
57627         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57628         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57629         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
57630         *ret_conv = ChannelUpdateInfo_read(ser_ref);
57631         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57632         return tag_ptr(ret_conv, true);
57633 }
57634
57635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57636         LDKChannelInfo this_obj_conv;
57637         this_obj_conv.inner = untag_ptr(this_obj);
57638         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57640         ChannelInfo_free(this_obj_conv);
57641 }
57642
57643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
57644         LDKChannelInfo this_ptr_conv;
57645         this_ptr_conv.inner = untag_ptr(this_ptr);
57646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57648         this_ptr_conv.is_owned = false;
57649         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
57650         int64_t ret_ref = 0;
57651         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57652         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57653         return ret_ref;
57654 }
57655
57656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57657         LDKChannelInfo this_ptr_conv;
57658         this_ptr_conv.inner = untag_ptr(this_ptr);
57659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57661         this_ptr_conv.is_owned = false;
57662         LDKChannelFeatures val_conv;
57663         val_conv.inner = untag_ptr(val);
57664         val_conv.is_owned = ptr_is_owned(val);
57665         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57666         val_conv = ChannelFeatures_clone(&val_conv);
57667         ChannelInfo_set_features(&this_ptr_conv, val_conv);
57668 }
57669
57670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
57671         LDKChannelInfo this_ptr_conv;
57672         this_ptr_conv.inner = untag_ptr(this_ptr);
57673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57675         this_ptr_conv.is_owned = false;
57676         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
57677         int64_t ret_ref = 0;
57678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57680         return ret_ref;
57681 }
57682
57683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57684         LDKChannelInfo this_ptr_conv;
57685         this_ptr_conv.inner = untag_ptr(this_ptr);
57686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57688         this_ptr_conv.is_owned = false;
57689         LDKNodeId val_conv;
57690         val_conv.inner = untag_ptr(val);
57691         val_conv.is_owned = ptr_is_owned(val);
57692         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57693         val_conv = NodeId_clone(&val_conv);
57694         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
57695 }
57696
57697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
57698         LDKChannelInfo this_ptr_conv;
57699         this_ptr_conv.inner = untag_ptr(this_ptr);
57700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57702         this_ptr_conv.is_owned = false;
57703         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
57704         int64_t ret_ref = 0;
57705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57707         return ret_ref;
57708 }
57709
57710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57711         LDKChannelInfo this_ptr_conv;
57712         this_ptr_conv.inner = untag_ptr(this_ptr);
57713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57715         this_ptr_conv.is_owned = false;
57716         LDKChannelUpdateInfo val_conv;
57717         val_conv.inner = untag_ptr(val);
57718         val_conv.is_owned = ptr_is_owned(val);
57719         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57720         val_conv = ChannelUpdateInfo_clone(&val_conv);
57721         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
57722 }
57723
57724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
57725         LDKChannelInfo this_ptr_conv;
57726         this_ptr_conv.inner = untag_ptr(this_ptr);
57727         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57729         this_ptr_conv.is_owned = false;
57730         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
57731         int64_t ret_ref = 0;
57732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57734         return ret_ref;
57735 }
57736
57737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57738         LDKChannelInfo this_ptr_conv;
57739         this_ptr_conv.inner = untag_ptr(this_ptr);
57740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57742         this_ptr_conv.is_owned = false;
57743         LDKNodeId val_conv;
57744         val_conv.inner = untag_ptr(val);
57745         val_conv.is_owned = ptr_is_owned(val);
57746         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57747         val_conv = NodeId_clone(&val_conv);
57748         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
57749 }
57750
57751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
57752         LDKChannelInfo this_ptr_conv;
57753         this_ptr_conv.inner = untag_ptr(this_ptr);
57754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57756         this_ptr_conv.is_owned = false;
57757         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
57758         int64_t ret_ref = 0;
57759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57761         return ret_ref;
57762 }
57763
57764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57765         LDKChannelInfo this_ptr_conv;
57766         this_ptr_conv.inner = untag_ptr(this_ptr);
57767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57769         this_ptr_conv.is_owned = false;
57770         LDKChannelUpdateInfo val_conv;
57771         val_conv.inner = untag_ptr(val);
57772         val_conv.is_owned = ptr_is_owned(val);
57773         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57774         val_conv = ChannelUpdateInfo_clone(&val_conv);
57775         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
57776 }
57777
57778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
57779         LDKChannelInfo this_ptr_conv;
57780         this_ptr_conv.inner = untag_ptr(this_ptr);
57781         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57783         this_ptr_conv.is_owned = false;
57784         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
57785         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
57786         int64_t ret_ref = tag_ptr(ret_copy, true);
57787         return ret_ref;
57788 }
57789
57790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57791         LDKChannelInfo this_ptr_conv;
57792         this_ptr_conv.inner = untag_ptr(this_ptr);
57793         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57795         this_ptr_conv.is_owned = false;
57796         void* val_ptr = untag_ptr(val);
57797         CHECK_ACCESS(val_ptr);
57798         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
57799         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
57800         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
57801 }
57802
57803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
57804         LDKChannelInfo this_ptr_conv;
57805         this_ptr_conv.inner = untag_ptr(this_ptr);
57806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57808         this_ptr_conv.is_owned = false;
57809         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
57810         int64_t ret_ref = 0;
57811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57813         return ret_ref;
57814 }
57815
57816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57817         LDKChannelInfo this_ptr_conv;
57818         this_ptr_conv.inner = untag_ptr(this_ptr);
57819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57821         this_ptr_conv.is_owned = false;
57822         LDKChannelAnnouncement val_conv;
57823         val_conv.inner = untag_ptr(val);
57824         val_conv.is_owned = ptr_is_owned(val);
57825         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57826         val_conv = ChannelAnnouncement_clone(&val_conv);
57827         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
57828 }
57829
57830 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
57831         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
57832         int64_t ret_ref = 0;
57833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57835         return ret_ref;
57836 }
57837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57838         LDKChannelInfo arg_conv;
57839         arg_conv.inner = untag_ptr(arg);
57840         arg_conv.is_owned = ptr_is_owned(arg);
57841         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57842         arg_conv.is_owned = false;
57843         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
57844         return ret_conv;
57845 }
57846
57847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57848         LDKChannelInfo orig_conv;
57849         orig_conv.inner = untag_ptr(orig);
57850         orig_conv.is_owned = ptr_is_owned(orig);
57851         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57852         orig_conv.is_owned = false;
57853         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
57854         int64_t ret_ref = 0;
57855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57857         return ret_ref;
57858 }
57859
57860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57861         LDKChannelInfo a_conv;
57862         a_conv.inner = untag_ptr(a);
57863         a_conv.is_owned = ptr_is_owned(a);
57864         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57865         a_conv.is_owned = false;
57866         LDKChannelInfo b_conv;
57867         b_conv.inner = untag_ptr(b);
57868         b_conv.is_owned = ptr_is_owned(b);
57869         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57870         b_conv.is_owned = false;
57871         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
57872         return ret_conv;
57873 }
57874
57875 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) {
57876         LDKChannelInfo this_arg_conv;
57877         this_arg_conv.inner = untag_ptr(this_arg);
57878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57880         this_arg_conv.is_owned = false;
57881         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
57882         int64_t ret_ref = 0;
57883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57885         return ret_ref;
57886 }
57887
57888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
57889         LDKChannelInfo obj_conv;
57890         obj_conv.inner = untag_ptr(obj);
57891         obj_conv.is_owned = ptr_is_owned(obj);
57892         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57893         obj_conv.is_owned = false;
57894         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
57895         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57896         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57897         CVec_u8Z_free(ret_var);
57898         return ret_arr;
57899 }
57900
57901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57902         LDKu8slice ser_ref;
57903         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57904         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57905         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
57906         *ret_conv = ChannelInfo_read(ser_ref);
57907         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57908         return tag_ptr(ret_conv, true);
57909 }
57910
57911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57912         LDKDirectedChannelInfo this_obj_conv;
57913         this_obj_conv.inner = untag_ptr(this_obj);
57914         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57916         DirectedChannelInfo_free(this_obj_conv);
57917 }
57918
57919 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
57920         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
57921         int64_t ret_ref = 0;
57922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57924         return ret_ref;
57925 }
57926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57927         LDKDirectedChannelInfo arg_conv;
57928         arg_conv.inner = untag_ptr(arg);
57929         arg_conv.is_owned = ptr_is_owned(arg);
57930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57931         arg_conv.is_owned = false;
57932         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
57933         return ret_conv;
57934 }
57935
57936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57937         LDKDirectedChannelInfo orig_conv;
57938         orig_conv.inner = untag_ptr(orig);
57939         orig_conv.is_owned = ptr_is_owned(orig);
57940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57941         orig_conv.is_owned = false;
57942         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
57943         int64_t ret_ref = 0;
57944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57946         return ret_ref;
57947 }
57948
57949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
57950         LDKDirectedChannelInfo this_arg_conv;
57951         this_arg_conv.inner = untag_ptr(this_arg);
57952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57954         this_arg_conv.is_owned = false;
57955         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
57956         int64_t ret_ref = 0;
57957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57959         return ret_ref;
57960 }
57961
57962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
57963         LDKDirectedChannelInfo this_arg_conv;
57964         this_arg_conv.inner = untag_ptr(this_arg);
57965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57967         this_arg_conv.is_owned = false;
57968         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
57969         return ret_conv;
57970 }
57971
57972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
57973         LDKDirectedChannelInfo this_arg_conv;
57974         this_arg_conv.inner = untag_ptr(this_arg);
57975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57977         this_arg_conv.is_owned = false;
57978         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57979         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
57980         int64_t ret_ref = tag_ptr(ret_copy, true);
57981         return ret_ref;
57982 }
57983
57984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57985         if (!ptr_is_owned(this_ptr)) return;
57986         void* this_ptr_ptr = untag_ptr(this_ptr);
57987         CHECK_ACCESS(this_ptr_ptr);
57988         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
57989         FREE(untag_ptr(this_ptr));
57990         EffectiveCapacity_free(this_ptr_conv);
57991 }
57992
57993 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
57994         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
57995         *ret_copy = EffectiveCapacity_clone(arg);
57996         int64_t ret_ref = tag_ptr(ret_copy, true);
57997         return ret_ref;
57998 }
57999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58000         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
58001         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
58002         return ret_conv;
58003 }
58004
58005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58006         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
58007         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58008         *ret_copy = EffectiveCapacity_clone(orig_conv);
58009         int64_t ret_ref = tag_ptr(ret_copy, true);
58010         return ret_ref;
58011 }
58012
58013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
58014         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58015         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
58016         int64_t ret_ref = tag_ptr(ret_copy, true);
58017         return ret_ref;
58018 }
58019
58020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
58021         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58022         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
58023         int64_t ret_ref = tag_ptr(ret_copy, true);
58024         return ret_ref;
58025 }
58026
58027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
58028         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58029         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
58030         int64_t ret_ref = tag_ptr(ret_copy, true);
58031         return ret_ref;
58032 }
58033
58034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
58035         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58036         *ret_copy = EffectiveCapacity_infinite();
58037         int64_t ret_ref = tag_ptr(ret_copy, true);
58038         return ret_ref;
58039 }
58040
58041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
58042         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58043         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
58044         int64_t ret_ref = tag_ptr(ret_copy, true);
58045         return ret_ref;
58046 }
58047
58048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
58049         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
58050         *ret_copy = EffectiveCapacity_unknown();
58051         int64_t ret_ref = tag_ptr(ret_copy, true);
58052         return ret_ref;
58053 }
58054
58055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
58056         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
58057         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
58058         return ret_conv;
58059 }
58060
58061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58062         LDKRoutingFees this_obj_conv;
58063         this_obj_conv.inner = untag_ptr(this_obj);
58064         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58066         RoutingFees_free(this_obj_conv);
58067 }
58068
58069 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58070         LDKRoutingFees this_ptr_conv;
58071         this_ptr_conv.inner = untag_ptr(this_ptr);
58072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58074         this_ptr_conv.is_owned = false;
58075         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
58076         return ret_conv;
58077 }
58078
58079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58080         LDKRoutingFees this_ptr_conv;
58081         this_ptr_conv.inner = untag_ptr(this_ptr);
58082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58084         this_ptr_conv.is_owned = false;
58085         RoutingFees_set_base_msat(&this_ptr_conv, val);
58086 }
58087
58088 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
58089         LDKRoutingFees this_ptr_conv;
58090         this_ptr_conv.inner = untag_ptr(this_ptr);
58091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58093         this_ptr_conv.is_owned = false;
58094         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
58095         return ret_conv;
58096 }
58097
58098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58099         LDKRoutingFees this_ptr_conv;
58100         this_ptr_conv.inner = untag_ptr(this_ptr);
58101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58103         this_ptr_conv.is_owned = false;
58104         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
58105 }
58106
58107 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) {
58108         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
58109         int64_t ret_ref = 0;
58110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58112         return ret_ref;
58113 }
58114
58115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58116         LDKRoutingFees a_conv;
58117         a_conv.inner = untag_ptr(a);
58118         a_conv.is_owned = ptr_is_owned(a);
58119         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58120         a_conv.is_owned = false;
58121         LDKRoutingFees b_conv;
58122         b_conv.inner = untag_ptr(b);
58123         b_conv.is_owned = ptr_is_owned(b);
58124         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58125         b_conv.is_owned = false;
58126         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
58127         return ret_conv;
58128 }
58129
58130 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
58131         LDKRoutingFees ret_var = RoutingFees_clone(arg);
58132         int64_t ret_ref = 0;
58133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58135         return ret_ref;
58136 }
58137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58138         LDKRoutingFees arg_conv;
58139         arg_conv.inner = untag_ptr(arg);
58140         arg_conv.is_owned = ptr_is_owned(arg);
58141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58142         arg_conv.is_owned = false;
58143         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
58144         return ret_conv;
58145 }
58146
58147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58148         LDKRoutingFees orig_conv;
58149         orig_conv.inner = untag_ptr(orig);
58150         orig_conv.is_owned = ptr_is_owned(orig);
58151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58152         orig_conv.is_owned = false;
58153         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
58154         int64_t ret_ref = 0;
58155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58157         return ret_ref;
58158 }
58159
58160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
58161         LDKRoutingFees o_conv;
58162         o_conv.inner = untag_ptr(o);
58163         o_conv.is_owned = ptr_is_owned(o);
58164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58165         o_conv.is_owned = false;
58166         int64_t ret_conv = RoutingFees_hash(&o_conv);
58167         return ret_conv;
58168 }
58169
58170 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
58171         LDKRoutingFees obj_conv;
58172         obj_conv.inner = untag_ptr(obj);
58173         obj_conv.is_owned = ptr_is_owned(obj);
58174         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58175         obj_conv.is_owned = false;
58176         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
58177         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58178         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58179         CVec_u8Z_free(ret_var);
58180         return ret_arr;
58181 }
58182
58183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58184         LDKu8slice ser_ref;
58185         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58186         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58187         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
58188         *ret_conv = RoutingFees_read(ser_ref);
58189         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58190         return tag_ptr(ret_conv, true);
58191 }
58192
58193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58194         LDKNodeAnnouncementInfo this_obj_conv;
58195         this_obj_conv.inner = untag_ptr(this_obj);
58196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58198         NodeAnnouncementInfo_free(this_obj_conv);
58199 }
58200
58201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
58202         LDKNodeAnnouncementInfo this_ptr_conv;
58203         this_ptr_conv.inner = untag_ptr(this_ptr);
58204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58206         this_ptr_conv.is_owned = false;
58207         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
58208         int64_t ret_ref = 0;
58209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58211         return ret_ref;
58212 }
58213
58214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58215         LDKNodeAnnouncementInfo this_ptr_conv;
58216         this_ptr_conv.inner = untag_ptr(this_ptr);
58217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58219         this_ptr_conv.is_owned = false;
58220         LDKNodeFeatures val_conv;
58221         val_conv.inner = untag_ptr(val);
58222         val_conv.is_owned = ptr_is_owned(val);
58223         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58224         val_conv = NodeFeatures_clone(&val_conv);
58225         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
58226 }
58227
58228 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
58229         LDKNodeAnnouncementInfo this_ptr_conv;
58230         this_ptr_conv.inner = untag_ptr(this_ptr);
58231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58233         this_ptr_conv.is_owned = false;
58234         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
58235         return ret_conv;
58236 }
58237
58238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58239         LDKNodeAnnouncementInfo this_ptr_conv;
58240         this_ptr_conv.inner = untag_ptr(this_ptr);
58241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58243         this_ptr_conv.is_owned = false;
58244         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
58245 }
58246
58247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
58248         LDKNodeAnnouncementInfo this_ptr_conv;
58249         this_ptr_conv.inner = untag_ptr(this_ptr);
58250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58252         this_ptr_conv.is_owned = false;
58253         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
58254         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
58255         return ret_arr;
58256 }
58257
58258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58259         LDKNodeAnnouncementInfo this_ptr_conv;
58260         this_ptr_conv.inner = untag_ptr(this_ptr);
58261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58263         this_ptr_conv.is_owned = false;
58264         LDKThreeBytes val_ref;
58265         CHECK((*env)->GetArrayLength(env, val) == 3);
58266         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
58267         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
58268 }
58269
58270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
58271         LDKNodeAnnouncementInfo this_ptr_conv;
58272         this_ptr_conv.inner = untag_ptr(this_ptr);
58273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58275         this_ptr_conv.is_owned = false;
58276         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
58277         int64_t ret_ref = 0;
58278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58280         return ret_ref;
58281 }
58282
58283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58284         LDKNodeAnnouncementInfo this_ptr_conv;
58285         this_ptr_conv.inner = untag_ptr(this_ptr);
58286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58288         this_ptr_conv.is_owned = false;
58289         LDKNodeAlias val_conv;
58290         val_conv.inner = untag_ptr(val);
58291         val_conv.is_owned = ptr_is_owned(val);
58292         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58293         val_conv = NodeAlias_clone(&val_conv);
58294         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
58295 }
58296
58297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
58298         LDKNodeAnnouncementInfo this_ptr_conv;
58299         this_ptr_conv.inner = untag_ptr(this_ptr);
58300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58302         this_ptr_conv.is_owned = false;
58303         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
58304         int64_t ret_ref = 0;
58305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58307         return ret_ref;
58308 }
58309
58310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58311         LDKNodeAnnouncementInfo this_ptr_conv;
58312         this_ptr_conv.inner = untag_ptr(this_ptr);
58313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58315         this_ptr_conv.is_owned = false;
58316         LDKNodeAnnouncement val_conv;
58317         val_conv.inner = untag_ptr(val);
58318         val_conv.is_owned = ptr_is_owned(val);
58319         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58320         val_conv = NodeAnnouncement_clone(&val_conv);
58321         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
58322 }
58323
58324 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) {
58325         LDKNodeFeatures features_arg_conv;
58326         features_arg_conv.inner = untag_ptr(features_arg);
58327         features_arg_conv.is_owned = ptr_is_owned(features_arg);
58328         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
58329         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
58330         LDKThreeBytes rgb_arg_ref;
58331         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
58332         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
58333         LDKNodeAlias alias_arg_conv;
58334         alias_arg_conv.inner = untag_ptr(alias_arg);
58335         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
58336         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
58337         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
58338         LDKNodeAnnouncement announcement_message_arg_conv;
58339         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
58340         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
58341         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
58342         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
58343         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
58344         int64_t ret_ref = 0;
58345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58347         return ret_ref;
58348 }
58349
58350 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
58351         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
58352         int64_t ret_ref = 0;
58353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58355         return ret_ref;
58356 }
58357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58358         LDKNodeAnnouncementInfo arg_conv;
58359         arg_conv.inner = untag_ptr(arg);
58360         arg_conv.is_owned = ptr_is_owned(arg);
58361         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58362         arg_conv.is_owned = false;
58363         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
58364         return ret_conv;
58365 }
58366
58367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58368         LDKNodeAnnouncementInfo orig_conv;
58369         orig_conv.inner = untag_ptr(orig);
58370         orig_conv.is_owned = ptr_is_owned(orig);
58371         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58372         orig_conv.is_owned = false;
58373         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
58374         int64_t ret_ref = 0;
58375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58377         return ret_ref;
58378 }
58379
58380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58381         LDKNodeAnnouncementInfo a_conv;
58382         a_conv.inner = untag_ptr(a);
58383         a_conv.is_owned = ptr_is_owned(a);
58384         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58385         a_conv.is_owned = false;
58386         LDKNodeAnnouncementInfo b_conv;
58387         b_conv.inner = untag_ptr(b);
58388         b_conv.is_owned = ptr_is_owned(b);
58389         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58390         b_conv.is_owned = false;
58391         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
58392         return ret_conv;
58393 }
58394
58395 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
58396         LDKNodeAnnouncementInfo this_arg_conv;
58397         this_arg_conv.inner = untag_ptr(this_arg);
58398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58400         this_arg_conv.is_owned = false;
58401         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
58402         int64_tArray ret_arr = NULL;
58403         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58404         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58405         for (size_t m = 0; m < ret_var.datalen; m++) {
58406                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
58407                 *ret_conv_12_copy = ret_var.data[m];
58408                 int64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
58409                 ret_arr_ptr[m] = ret_conv_12_ref;
58410         }
58411         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58412         FREE(ret_var.data);
58413         return ret_arr;
58414 }
58415
58416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
58417         LDKNodeAnnouncementInfo obj_conv;
58418         obj_conv.inner = untag_ptr(obj);
58419         obj_conv.is_owned = ptr_is_owned(obj);
58420         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58421         obj_conv.is_owned = false;
58422         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
58423         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58424         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58425         CVec_u8Z_free(ret_var);
58426         return ret_arr;
58427 }
58428
58429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58430         LDKu8slice ser_ref;
58431         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58432         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58433         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
58434         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
58435         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58436         return tag_ptr(ret_conv, true);
58437 }
58438
58439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58440         LDKNodeAlias this_obj_conv;
58441         this_obj_conv.inner = untag_ptr(this_obj);
58442         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58444         NodeAlias_free(this_obj_conv);
58445 }
58446
58447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
58448         LDKNodeAlias this_ptr_conv;
58449         this_ptr_conv.inner = untag_ptr(this_ptr);
58450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58452         this_ptr_conv.is_owned = false;
58453         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58454         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
58455         return ret_arr;
58456 }
58457
58458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58459         LDKNodeAlias this_ptr_conv;
58460         this_ptr_conv.inner = untag_ptr(this_ptr);
58461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58463         this_ptr_conv.is_owned = false;
58464         LDKThirtyTwoBytes val_ref;
58465         CHECK((*env)->GetArrayLength(env, val) == 32);
58466         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58467         NodeAlias_set_a(&this_ptr_conv, val_ref);
58468 }
58469
58470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
58471         LDKThirtyTwoBytes a_arg_ref;
58472         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
58473         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
58474         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
58475         int64_t ret_ref = 0;
58476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58478         return ret_ref;
58479 }
58480
58481 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
58482         LDKNodeAlias ret_var = NodeAlias_clone(arg);
58483         int64_t ret_ref = 0;
58484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58486         return ret_ref;
58487 }
58488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58489         LDKNodeAlias arg_conv;
58490         arg_conv.inner = untag_ptr(arg);
58491         arg_conv.is_owned = ptr_is_owned(arg);
58492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58493         arg_conv.is_owned = false;
58494         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
58495         return ret_conv;
58496 }
58497
58498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58499         LDKNodeAlias orig_conv;
58500         orig_conv.inner = untag_ptr(orig);
58501         orig_conv.is_owned = ptr_is_owned(orig);
58502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58503         orig_conv.is_owned = false;
58504         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
58505         int64_t ret_ref = 0;
58506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58508         return ret_ref;
58509 }
58510
58511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58512         LDKNodeAlias a_conv;
58513         a_conv.inner = untag_ptr(a);
58514         a_conv.is_owned = ptr_is_owned(a);
58515         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58516         a_conv.is_owned = false;
58517         LDKNodeAlias b_conv;
58518         b_conv.inner = untag_ptr(b);
58519         b_conv.is_owned = ptr_is_owned(b);
58520         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58521         b_conv.is_owned = false;
58522         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
58523         return ret_conv;
58524 }
58525
58526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
58527         LDKNodeAlias obj_conv;
58528         obj_conv.inner = untag_ptr(obj);
58529         obj_conv.is_owned = ptr_is_owned(obj);
58530         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58531         obj_conv.is_owned = false;
58532         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
58533         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58534         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58535         CVec_u8Z_free(ret_var);
58536         return ret_arr;
58537 }
58538
58539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58540         LDKu8slice ser_ref;
58541         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58542         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58543         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
58544         *ret_conv = NodeAlias_read(ser_ref);
58545         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58546         return tag_ptr(ret_conv, true);
58547 }
58548
58549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58550         LDKNodeInfo this_obj_conv;
58551         this_obj_conv.inner = untag_ptr(this_obj);
58552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58554         NodeInfo_free(this_obj_conv);
58555 }
58556
58557 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
58558         LDKNodeInfo this_ptr_conv;
58559         this_ptr_conv.inner = untag_ptr(this_ptr);
58560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58562         this_ptr_conv.is_owned = false;
58563         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
58564         int64_tArray ret_arr = NULL;
58565         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
58566         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
58567         for (size_t g = 0; g < ret_var.datalen; g++) {
58568                 int64_t ret_conv_6_conv = ret_var.data[g];
58569                 ret_arr_ptr[g] = ret_conv_6_conv;
58570         }
58571         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
58572         FREE(ret_var.data);
58573         return ret_arr;
58574 }
58575
58576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
58577         LDKNodeInfo this_ptr_conv;
58578         this_ptr_conv.inner = untag_ptr(this_ptr);
58579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58581         this_ptr_conv.is_owned = false;
58582         LDKCVec_u64Z val_constr;
58583         val_constr.datalen = (*env)->GetArrayLength(env, val);
58584         if (val_constr.datalen > 0)
58585                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
58586         else
58587                 val_constr.data = NULL;
58588         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
58589         for (size_t g = 0; g < val_constr.datalen; g++) {
58590                 int64_t val_conv_6 = val_vals[g];
58591                 val_constr.data[g] = val_conv_6;
58592         }
58593         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
58594         NodeInfo_set_channels(&this_ptr_conv, val_constr);
58595 }
58596
58597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
58598         LDKNodeInfo this_ptr_conv;
58599         this_ptr_conv.inner = untag_ptr(this_ptr);
58600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58602         this_ptr_conv.is_owned = false;
58603         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
58604         int64_t ret_ref = 0;
58605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58607         return ret_ref;
58608 }
58609
58610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58611         LDKNodeInfo this_ptr_conv;
58612         this_ptr_conv.inner = untag_ptr(this_ptr);
58613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58615         this_ptr_conv.is_owned = false;
58616         LDKNodeAnnouncementInfo val_conv;
58617         val_conv.inner = untag_ptr(val);
58618         val_conv.is_owned = ptr_is_owned(val);
58619         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58620         val_conv = NodeAnnouncementInfo_clone(&val_conv);
58621         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
58622 }
58623
58624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
58625         LDKCVec_u64Z channels_arg_constr;
58626         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
58627         if (channels_arg_constr.datalen > 0)
58628                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
58629         else
58630                 channels_arg_constr.data = NULL;
58631         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
58632         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
58633                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
58634                 channels_arg_constr.data[g] = channels_arg_conv_6;
58635         }
58636         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
58637         LDKNodeAnnouncementInfo announcement_info_arg_conv;
58638         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
58639         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
58640         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
58641         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
58642         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
58643         int64_t ret_ref = 0;
58644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58646         return ret_ref;
58647 }
58648
58649 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
58650         LDKNodeInfo ret_var = NodeInfo_clone(arg);
58651         int64_t ret_ref = 0;
58652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58654         return ret_ref;
58655 }
58656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58657         LDKNodeInfo arg_conv;
58658         arg_conv.inner = untag_ptr(arg);
58659         arg_conv.is_owned = ptr_is_owned(arg);
58660         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58661         arg_conv.is_owned = false;
58662         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
58663         return ret_conv;
58664 }
58665
58666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58667         LDKNodeInfo orig_conv;
58668         orig_conv.inner = untag_ptr(orig);
58669         orig_conv.is_owned = ptr_is_owned(orig);
58670         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58671         orig_conv.is_owned = false;
58672         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
58673         int64_t ret_ref = 0;
58674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58676         return ret_ref;
58677 }
58678
58679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58680         LDKNodeInfo a_conv;
58681         a_conv.inner = untag_ptr(a);
58682         a_conv.is_owned = ptr_is_owned(a);
58683         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58684         a_conv.is_owned = false;
58685         LDKNodeInfo b_conv;
58686         b_conv.inner = untag_ptr(b);
58687         b_conv.is_owned = ptr_is_owned(b);
58688         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58689         b_conv.is_owned = false;
58690         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
58691         return ret_conv;
58692 }
58693
58694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
58695         LDKNodeInfo obj_conv;
58696         obj_conv.inner = untag_ptr(obj);
58697         obj_conv.is_owned = ptr_is_owned(obj);
58698         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58699         obj_conv.is_owned = false;
58700         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
58701         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58702         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58703         CVec_u8Z_free(ret_var);
58704         return ret_arr;
58705 }
58706
58707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
58708         LDKu8slice ser_ref;
58709         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58710         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58711         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
58712         *ret_conv = NodeInfo_read(ser_ref);
58713         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58714         return tag_ptr(ret_conv, true);
58715 }
58716
58717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
58718         LDKNetworkGraph obj_conv;
58719         obj_conv.inner = untag_ptr(obj);
58720         obj_conv.is_owned = ptr_is_owned(obj);
58721         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58722         obj_conv.is_owned = false;
58723         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
58724         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58725         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58726         CVec_u8Z_free(ret_var);
58727         return ret_arr;
58728 }
58729
58730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
58731         LDKu8slice ser_ref;
58732         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
58733         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
58734         void* arg_ptr = untag_ptr(arg);
58735         CHECK_ACCESS(arg_ptr);
58736         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
58737         if (arg_conv.free == LDKLogger_JCalls_free) {
58738                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58739                 LDKLogger_JCalls_cloned(&arg_conv);
58740         }
58741         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
58742         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
58743         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
58744         return tag_ptr(ret_conv, true);
58745 }
58746
58747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
58748         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
58749         void* logger_ptr = untag_ptr(logger);
58750         CHECK_ACCESS(logger_ptr);
58751         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
58752         if (logger_conv.free == LDKLogger_JCalls_free) {
58753                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58754                 LDKLogger_JCalls_cloned(&logger_conv);
58755         }
58756         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
58757         int64_t ret_ref = 0;
58758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58760         return ret_ref;
58761 }
58762
58763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
58764         LDKNetworkGraph this_arg_conv;
58765         this_arg_conv.inner = untag_ptr(this_arg);
58766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58768         this_arg_conv.is_owned = false;
58769         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
58770         int64_t ret_ref = 0;
58771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58773         return ret_ref;
58774 }
58775
58776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
58777         LDKNetworkGraph this_arg_conv;
58778         this_arg_conv.inner = untag_ptr(this_arg);
58779         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58781         this_arg_conv.is_owned = false;
58782         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
58783         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
58784         int64_t ret_ref = tag_ptr(ret_copy, true);
58785         return ret_ref;
58786 }
58787
58788 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) {
58789         LDKNetworkGraph this_arg_conv;
58790         this_arg_conv.inner = untag_ptr(this_arg);
58791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58793         this_arg_conv.is_owned = false;
58794         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
58795 }
58796
58797 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) {
58798         LDKNetworkGraph this_arg_conv;
58799         this_arg_conv.inner = untag_ptr(this_arg);
58800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58802         this_arg_conv.is_owned = false;
58803         LDKNodeAnnouncement msg_conv;
58804         msg_conv.inner = untag_ptr(msg);
58805         msg_conv.is_owned = ptr_is_owned(msg);
58806         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58807         msg_conv.is_owned = false;
58808         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58809         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
58810         return tag_ptr(ret_conv, true);
58811 }
58812
58813 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) {
58814         LDKNetworkGraph this_arg_conv;
58815         this_arg_conv.inner = untag_ptr(this_arg);
58816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58818         this_arg_conv.is_owned = false;
58819         LDKUnsignedNodeAnnouncement msg_conv;
58820         msg_conv.inner = untag_ptr(msg);
58821         msg_conv.is_owned = ptr_is_owned(msg);
58822         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58823         msg_conv.is_owned = false;
58824         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58825         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
58826         return tag_ptr(ret_conv, true);
58827 }
58828
58829 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) {
58830         LDKNetworkGraph this_arg_conv;
58831         this_arg_conv.inner = untag_ptr(this_arg);
58832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58834         this_arg_conv.is_owned = false;
58835         LDKChannelAnnouncement msg_conv;
58836         msg_conv.inner = untag_ptr(msg);
58837         msg_conv.is_owned = ptr_is_owned(msg);
58838         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58839         msg_conv.is_owned = false;
58840         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
58841         CHECK_ACCESS(utxo_lookup_ptr);
58842         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
58843         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
58844         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
58845                 // Manually implement clone for Java trait instances
58846                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
58847                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58848                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
58849                 }
58850         }
58851         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58852         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
58853         return tag_ptr(ret_conv, true);
58854 }
58855
58856 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) {
58857         LDKNetworkGraph this_arg_conv;
58858         this_arg_conv.inner = untag_ptr(this_arg);
58859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58861         this_arg_conv.is_owned = false;
58862         LDKChannelAnnouncement msg_conv;
58863         msg_conv.inner = untag_ptr(msg);
58864         msg_conv.is_owned = ptr_is_owned(msg);
58865         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58866         msg_conv.is_owned = false;
58867         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58868         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
58869         return tag_ptr(ret_conv, true);
58870 }
58871
58872 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) {
58873         LDKNetworkGraph this_arg_conv;
58874         this_arg_conv.inner = untag_ptr(this_arg);
58875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58877         this_arg_conv.is_owned = false;
58878         LDKUnsignedChannelAnnouncement msg_conv;
58879         msg_conv.inner = untag_ptr(msg);
58880         msg_conv.is_owned = ptr_is_owned(msg);
58881         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58882         msg_conv.is_owned = false;
58883         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
58884         CHECK_ACCESS(utxo_lookup_ptr);
58885         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
58886         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
58887         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
58888                 // Manually implement clone for Java trait instances
58889                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
58890                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58891                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
58892                 }
58893         }
58894         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58895         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
58896         return tag_ptr(ret_conv, true);
58897 }
58898
58899 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) {
58900         LDKNetworkGraph this_arg_conv;
58901         this_arg_conv.inner = untag_ptr(this_arg);
58902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58904         this_arg_conv.is_owned = false;
58905         LDKChannelFeatures features_conv;
58906         features_conv.inner = untag_ptr(features);
58907         features_conv.is_owned = ptr_is_owned(features);
58908         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
58909         features_conv = ChannelFeatures_clone(&features_conv);
58910         LDKPublicKey node_id_1_ref;
58911         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
58912         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
58913         LDKPublicKey node_id_2_ref;
58914         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
58915         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
58916         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58917         *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);
58918         return tag_ptr(ret_conv, true);
58919 }
58920
58921 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) {
58922         LDKNetworkGraph this_arg_conv;
58923         this_arg_conv.inner = untag_ptr(this_arg);
58924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58926         this_arg_conv.is_owned = false;
58927         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
58928 }
58929
58930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
58931         LDKNetworkGraph this_arg_conv;
58932         this_arg_conv.inner = untag_ptr(this_arg);
58933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58935         this_arg_conv.is_owned = false;
58936         LDKPublicKey node_id_ref;
58937         CHECK((*env)->GetArrayLength(env, node_id) == 33);
58938         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
58939         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
58940 }
58941
58942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
58943         LDKNetworkGraph this_arg_conv;
58944         this_arg_conv.inner = untag_ptr(this_arg);
58945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58947         this_arg_conv.is_owned = false;
58948         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
58949 }
58950
58951 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) {
58952         LDKNetworkGraph this_arg_conv;
58953         this_arg_conv.inner = untag_ptr(this_arg);
58954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58956         this_arg_conv.is_owned = false;
58957         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
58958 }
58959
58960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
58961         LDKNetworkGraph this_arg_conv;
58962         this_arg_conv.inner = untag_ptr(this_arg);
58963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58965         this_arg_conv.is_owned = false;
58966         LDKChannelUpdate msg_conv;
58967         msg_conv.inner = untag_ptr(msg);
58968         msg_conv.is_owned = ptr_is_owned(msg);
58969         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58970         msg_conv.is_owned = false;
58971         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58972         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
58973         return tag_ptr(ret_conv, true);
58974 }
58975
58976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
58977         LDKNetworkGraph this_arg_conv;
58978         this_arg_conv.inner = untag_ptr(this_arg);
58979         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58980         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58981         this_arg_conv.is_owned = false;
58982         LDKUnsignedChannelUpdate msg_conv;
58983         msg_conv.inner = untag_ptr(msg);
58984         msg_conv.is_owned = ptr_is_owned(msg);
58985         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
58986         msg_conv.is_owned = false;
58987         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
58988         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
58989         return tag_ptr(ret_conv, true);
58990 }
58991
58992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
58993         LDKReadOnlyNetworkGraph this_arg_conv;
58994         this_arg_conv.inner = untag_ptr(this_arg);
58995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58997         this_arg_conv.is_owned = false;
58998         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
58999         int64_t ret_ref = 0;
59000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59002         return ret_ref;
59003 }
59004
59005 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
59006         LDKReadOnlyNetworkGraph this_arg_conv;
59007         this_arg_conv.inner = untag_ptr(this_arg);
59008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59010         this_arg_conv.is_owned = false;
59011         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
59012         int64_tArray ret_arr = NULL;
59013         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59014         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59015         for (size_t g = 0; g < ret_var.datalen; g++) {
59016                 int64_t ret_conv_6_conv = ret_var.data[g];
59017                 ret_arr_ptr[g] = ret_conv_6_conv;
59018         }
59019         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59020         FREE(ret_var.data);
59021         return ret_arr;
59022 }
59023
59024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
59025         LDKReadOnlyNetworkGraph this_arg_conv;
59026         this_arg_conv.inner = untag_ptr(this_arg);
59027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59029         this_arg_conv.is_owned = false;
59030         LDKNodeId node_id_conv;
59031         node_id_conv.inner = untag_ptr(node_id);
59032         node_id_conv.is_owned = ptr_is_owned(node_id);
59033         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
59034         node_id_conv.is_owned = false;
59035         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
59036         int64_t ret_ref = 0;
59037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59039         return ret_ref;
59040 }
59041
59042 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
59043         LDKReadOnlyNetworkGraph this_arg_conv;
59044         this_arg_conv.inner = untag_ptr(this_arg);
59045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59047         this_arg_conv.is_owned = false;
59048         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
59049         int64_tArray ret_arr = NULL;
59050         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59051         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59052         for (size_t i = 0; i < ret_var.datalen; i++) {
59053                 LDKNodeId ret_conv_8_var = ret_var.data[i];
59054                 int64_t ret_conv_8_ref = 0;
59055                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
59056                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
59057                 ret_arr_ptr[i] = ret_conv_8_ref;
59058         }
59059         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59060         FREE(ret_var.data);
59061         return ret_arr;
59062 }
59063
59064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
59065         LDKReadOnlyNetworkGraph this_arg_conv;
59066         this_arg_conv.inner = untag_ptr(this_arg);
59067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59069         this_arg_conv.is_owned = false;
59070         LDKPublicKey pubkey_ref;
59071         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
59072         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
59073         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
59074         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
59075         int64_t ret_ref = tag_ptr(ret_copy, true);
59076         return ret_ref;
59077 }
59078
59079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59080         LDKDefaultRouter this_obj_conv;
59081         this_obj_conv.inner = untag_ptr(this_obj);
59082         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59084         DefaultRouter_free(this_obj_conv);
59085 }
59086
59087 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) {
59088         LDKNetworkGraph network_graph_conv;
59089         network_graph_conv.inner = untag_ptr(network_graph);
59090         network_graph_conv.is_owned = ptr_is_owned(network_graph);
59091         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
59092         network_graph_conv.is_owned = false;
59093         void* logger_ptr = untag_ptr(logger);
59094         CHECK_ACCESS(logger_ptr);
59095         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
59096         if (logger_conv.free == LDKLogger_JCalls_free) {
59097                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59098                 LDKLogger_JCalls_cloned(&logger_conv);
59099         }
59100         LDKThirtyTwoBytes random_seed_bytes_ref;
59101         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
59102         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
59103         void* scorer_ptr = untag_ptr(scorer);
59104         CHECK_ACCESS(scorer_ptr);
59105         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
59106         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
59107                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59108                 LDKLockableScore_JCalls_cloned(&scorer_conv);
59109         }
59110         LDKProbabilisticScoringFeeParameters score_params_conv;
59111         score_params_conv.inner = untag_ptr(score_params);
59112         score_params_conv.is_owned = ptr_is_owned(score_params);
59113         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
59114         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
59115         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
59116         int64_t ret_ref = 0;
59117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59119         return ret_ref;
59120 }
59121
59122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
59123         LDKDefaultRouter this_arg_conv;
59124         this_arg_conv.inner = untag_ptr(this_arg);
59125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59127         this_arg_conv.is_owned = false;
59128         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
59129         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
59130         return tag_ptr(ret_ret, true);
59131 }
59132
59133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
59134         if (!ptr_is_owned(this_ptr)) return;
59135         void* this_ptr_ptr = untag_ptr(this_ptr);
59136         CHECK_ACCESS(this_ptr_ptr);
59137         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
59138         FREE(untag_ptr(this_ptr));
59139         Router_free(this_ptr_conv);
59140 }
59141
59142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59143         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
59144         this_obj_conv.inner = untag_ptr(this_obj);
59145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59147         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
59148 }
59149
59150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
59151         void* scorer_ptr = untag_ptr(scorer);
59152         CHECK_ACCESS(scorer_ptr);
59153         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
59154         if (scorer_conv.free == LDKScore_JCalls_free) {
59155                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
59156                 LDKScore_JCalls_cloned(&scorer_conv);
59157         }
59158         LDKInFlightHtlcs inflight_htlcs_conv;
59159         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
59160         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
59161         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
59162         inflight_htlcs_conv.is_owned = false;
59163         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
59164         int64_t ret_ref = 0;
59165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59167         return ret_ref;
59168 }
59169
59170 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
59171         LDKScorerAccountingForInFlightHtlcs obj_conv;
59172         obj_conv.inner = untag_ptr(obj);
59173         obj_conv.is_owned = ptr_is_owned(obj);
59174         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59175         obj_conv.is_owned = false;
59176         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
59177         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59178         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59179         CVec_u8Z_free(ret_var);
59180         return ret_arr;
59181 }
59182
59183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
59184         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
59185         this_arg_conv.inner = untag_ptr(this_arg);
59186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59188         this_arg_conv.is_owned = false;
59189         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
59190         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
59191         return tag_ptr(ret_ret, true);
59192 }
59193
59194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59195         LDKInFlightHtlcs this_obj_conv;
59196         this_obj_conv.inner = untag_ptr(this_obj);
59197         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59199         InFlightHtlcs_free(this_obj_conv);
59200 }
59201
59202 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
59203         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
59204         int64_t ret_ref = 0;
59205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59207         return ret_ref;
59208 }
59209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59210         LDKInFlightHtlcs arg_conv;
59211         arg_conv.inner = untag_ptr(arg);
59212         arg_conv.is_owned = ptr_is_owned(arg);
59213         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59214         arg_conv.is_owned = false;
59215         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
59216         return ret_conv;
59217 }
59218
59219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59220         LDKInFlightHtlcs orig_conv;
59221         orig_conv.inner = untag_ptr(orig);
59222         orig_conv.is_owned = ptr_is_owned(orig);
59223         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59224         orig_conv.is_owned = false;
59225         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
59226         int64_t ret_ref = 0;
59227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59229         return ret_ref;
59230 }
59231
59232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
59233         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
59234         int64_t ret_ref = 0;
59235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59237         return ret_ref;
59238 }
59239
59240 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) {
59241         LDKInFlightHtlcs this_arg_conv;
59242         this_arg_conv.inner = untag_ptr(this_arg);
59243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59245         this_arg_conv.is_owned = false;
59246         LDKPath path_conv;
59247         path_conv.inner = untag_ptr(path);
59248         path_conv.is_owned = ptr_is_owned(path);
59249         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59250         path_conv.is_owned = false;
59251         LDKPublicKey payer_node_id_ref;
59252         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
59253         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
59254         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
59255 }
59256
59257 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) {
59258         LDKInFlightHtlcs this_arg_conv;
59259         this_arg_conv.inner = untag_ptr(this_arg);
59260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59262         this_arg_conv.is_owned = false;
59263         LDKNodeId source_conv;
59264         source_conv.inner = untag_ptr(source);
59265         source_conv.is_owned = ptr_is_owned(source);
59266         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
59267         source_conv.is_owned = false;
59268         LDKNodeId target_conv;
59269         target_conv.inner = untag_ptr(target);
59270         target_conv.is_owned = ptr_is_owned(target);
59271         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
59272         target_conv.is_owned = false;
59273         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
59274 }
59275
59276 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) {
59277         LDKInFlightHtlcs this_arg_conv;
59278         this_arg_conv.inner = untag_ptr(this_arg);
59279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59281         this_arg_conv.is_owned = false;
59282         LDKNodeId source_conv;
59283         source_conv.inner = untag_ptr(source);
59284         source_conv.is_owned = ptr_is_owned(source);
59285         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
59286         source_conv.is_owned = false;
59287         LDKNodeId target_conv;
59288         target_conv.inner = untag_ptr(target);
59289         target_conv.is_owned = ptr_is_owned(target);
59290         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
59291         target_conv.is_owned = false;
59292         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
59293         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
59294         int64_t ret_ref = tag_ptr(ret_copy, true);
59295         return ret_ref;
59296 }
59297
59298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
59299         LDKInFlightHtlcs obj_conv;
59300         obj_conv.inner = untag_ptr(obj);
59301         obj_conv.is_owned = ptr_is_owned(obj);
59302         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59303         obj_conv.is_owned = false;
59304         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
59305         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59306         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59307         CVec_u8Z_free(ret_var);
59308         return ret_arr;
59309 }
59310
59311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59312         LDKu8slice ser_ref;
59313         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59314         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59315         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
59316         *ret_conv = InFlightHtlcs_read(ser_ref);
59317         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59318         return tag_ptr(ret_conv, true);
59319 }
59320
59321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59322         LDKRouteHop this_obj_conv;
59323         this_obj_conv.inner = untag_ptr(this_obj);
59324         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59326         RouteHop_free(this_obj_conv);
59327 }
59328
59329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
59330         LDKRouteHop this_ptr_conv;
59331         this_ptr_conv.inner = untag_ptr(this_ptr);
59332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59334         this_ptr_conv.is_owned = false;
59335         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59336         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
59337         return ret_arr;
59338 }
59339
59340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59341         LDKRouteHop this_ptr_conv;
59342         this_ptr_conv.inner = untag_ptr(this_ptr);
59343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59345         this_ptr_conv.is_owned = false;
59346         LDKPublicKey val_ref;
59347         CHECK((*env)->GetArrayLength(env, val) == 33);
59348         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
59349         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
59350 }
59351
59352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59353         LDKRouteHop this_ptr_conv;
59354         this_ptr_conv.inner = untag_ptr(this_ptr);
59355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59357         this_ptr_conv.is_owned = false;
59358         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
59359         int64_t ret_ref = 0;
59360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59362         return ret_ref;
59363 }
59364
59365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59366         LDKRouteHop this_ptr_conv;
59367         this_ptr_conv.inner = untag_ptr(this_ptr);
59368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59370         this_ptr_conv.is_owned = false;
59371         LDKNodeFeatures val_conv;
59372         val_conv.inner = untag_ptr(val);
59373         val_conv.is_owned = ptr_is_owned(val);
59374         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59375         val_conv = NodeFeatures_clone(&val_conv);
59376         RouteHop_set_node_features(&this_ptr_conv, val_conv);
59377 }
59378
59379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
59380         LDKRouteHop this_ptr_conv;
59381         this_ptr_conv.inner = untag_ptr(this_ptr);
59382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59384         this_ptr_conv.is_owned = false;
59385         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
59386         return ret_conv;
59387 }
59388
59389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59390         LDKRouteHop this_ptr_conv;
59391         this_ptr_conv.inner = untag_ptr(this_ptr);
59392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59394         this_ptr_conv.is_owned = false;
59395         RouteHop_set_short_channel_id(&this_ptr_conv, val);
59396 }
59397
59398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
59399         LDKRouteHop this_ptr_conv;
59400         this_ptr_conv.inner = untag_ptr(this_ptr);
59401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59403         this_ptr_conv.is_owned = false;
59404         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
59405         int64_t ret_ref = 0;
59406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59408         return ret_ref;
59409 }
59410
59411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59412         LDKRouteHop this_ptr_conv;
59413         this_ptr_conv.inner = untag_ptr(this_ptr);
59414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59416         this_ptr_conv.is_owned = false;
59417         LDKChannelFeatures val_conv;
59418         val_conv.inner = untag_ptr(val);
59419         val_conv.is_owned = ptr_is_owned(val);
59420         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59421         val_conv = ChannelFeatures_clone(&val_conv);
59422         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
59423 }
59424
59425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59426         LDKRouteHop this_ptr_conv;
59427         this_ptr_conv.inner = untag_ptr(this_ptr);
59428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59430         this_ptr_conv.is_owned = false;
59431         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
59432         return ret_conv;
59433 }
59434
59435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59436         LDKRouteHop this_ptr_conv;
59437         this_ptr_conv.inner = untag_ptr(this_ptr);
59438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59440         this_ptr_conv.is_owned = false;
59441         RouteHop_set_fee_msat(&this_ptr_conv, val);
59442 }
59443
59444 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
59445         LDKRouteHop this_ptr_conv;
59446         this_ptr_conv.inner = untag_ptr(this_ptr);
59447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59449         this_ptr_conv.is_owned = false;
59450         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
59451         return ret_conv;
59452 }
59453
59454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59455         LDKRouteHop this_ptr_conv;
59456         this_ptr_conv.inner = untag_ptr(this_ptr);
59457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59459         this_ptr_conv.is_owned = false;
59460         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
59461 }
59462
59463 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) {
59464         LDKPublicKey pubkey_arg_ref;
59465         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
59466         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
59467         LDKNodeFeatures node_features_arg_conv;
59468         node_features_arg_conv.inner = untag_ptr(node_features_arg);
59469         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
59470         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
59471         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
59472         LDKChannelFeatures channel_features_arg_conv;
59473         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
59474         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
59475         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
59476         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
59477         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);
59478         int64_t ret_ref = 0;
59479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59481         return ret_ref;
59482 }
59483
59484 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
59485         LDKRouteHop ret_var = RouteHop_clone(arg);
59486         int64_t ret_ref = 0;
59487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59489         return ret_ref;
59490 }
59491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59492         LDKRouteHop arg_conv;
59493         arg_conv.inner = untag_ptr(arg);
59494         arg_conv.is_owned = ptr_is_owned(arg);
59495         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59496         arg_conv.is_owned = false;
59497         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
59498         return ret_conv;
59499 }
59500
59501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59502         LDKRouteHop orig_conv;
59503         orig_conv.inner = untag_ptr(orig);
59504         orig_conv.is_owned = ptr_is_owned(orig);
59505         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59506         orig_conv.is_owned = false;
59507         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
59508         int64_t ret_ref = 0;
59509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59511         return ret_ref;
59512 }
59513
59514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
59515         LDKRouteHop o_conv;
59516         o_conv.inner = untag_ptr(o);
59517         o_conv.is_owned = ptr_is_owned(o);
59518         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59519         o_conv.is_owned = false;
59520         int64_t ret_conv = RouteHop_hash(&o_conv);
59521         return ret_conv;
59522 }
59523
59524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59525         LDKRouteHop a_conv;
59526         a_conv.inner = untag_ptr(a);
59527         a_conv.is_owned = ptr_is_owned(a);
59528         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59529         a_conv.is_owned = false;
59530         LDKRouteHop b_conv;
59531         b_conv.inner = untag_ptr(b);
59532         b_conv.is_owned = ptr_is_owned(b);
59533         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59534         b_conv.is_owned = false;
59535         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
59536         return ret_conv;
59537 }
59538
59539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
59540         LDKRouteHop obj_conv;
59541         obj_conv.inner = untag_ptr(obj);
59542         obj_conv.is_owned = ptr_is_owned(obj);
59543         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59544         obj_conv.is_owned = false;
59545         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
59546         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59547         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59548         CVec_u8Z_free(ret_var);
59549         return ret_arr;
59550 }
59551
59552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59553         LDKu8slice ser_ref;
59554         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59555         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59556         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
59557         *ret_conv = RouteHop_read(ser_ref);
59558         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59559         return tag_ptr(ret_conv, true);
59560 }
59561
59562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59563         LDKBlindedTail this_obj_conv;
59564         this_obj_conv.inner = untag_ptr(this_obj);
59565         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59567         BlindedTail_free(this_obj_conv);
59568 }
59569
59570 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
59571         LDKBlindedTail this_ptr_conv;
59572         this_ptr_conv.inner = untag_ptr(this_ptr);
59573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59575         this_ptr_conv.is_owned = false;
59576         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
59577         int64_tArray ret_arr = NULL;
59578         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59579         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59580         for (size_t m = 0; m < ret_var.datalen; m++) {
59581                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
59582                 int64_t ret_conv_12_ref = 0;
59583                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
59584                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
59585                 ret_arr_ptr[m] = ret_conv_12_ref;
59586         }
59587         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59588         FREE(ret_var.data);
59589         return ret_arr;
59590 }
59591
59592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59593         LDKBlindedTail this_ptr_conv;
59594         this_ptr_conv.inner = untag_ptr(this_ptr);
59595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59597         this_ptr_conv.is_owned = false;
59598         LDKCVec_BlindedHopZ val_constr;
59599         val_constr.datalen = (*env)->GetArrayLength(env, val);
59600         if (val_constr.datalen > 0)
59601                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
59602         else
59603                 val_constr.data = NULL;
59604         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59605         for (size_t m = 0; m < val_constr.datalen; m++) {
59606                 int64_t val_conv_12 = val_vals[m];
59607                 LDKBlindedHop val_conv_12_conv;
59608                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
59609                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
59610                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
59611                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
59612                 val_constr.data[m] = val_conv_12_conv;
59613         }
59614         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59615         BlindedTail_set_hops(&this_ptr_conv, val_constr);
59616 }
59617
59618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
59619         LDKBlindedTail this_ptr_conv;
59620         this_ptr_conv.inner = untag_ptr(this_ptr);
59621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59623         this_ptr_conv.is_owned = false;
59624         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
59625         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
59626         return ret_arr;
59627 }
59628
59629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59630         LDKBlindedTail this_ptr_conv;
59631         this_ptr_conv.inner = untag_ptr(this_ptr);
59632         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59634         this_ptr_conv.is_owned = false;
59635         LDKPublicKey val_ref;
59636         CHECK((*env)->GetArrayLength(env, val) == 33);
59637         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
59638         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
59639 }
59640
59641 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
59642         LDKBlindedTail this_ptr_conv;
59643         this_ptr_conv.inner = untag_ptr(this_ptr);
59644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59646         this_ptr_conv.is_owned = false;
59647         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
59648         return ret_conv;
59649 }
59650
59651 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) {
59652         LDKBlindedTail this_ptr_conv;
59653         this_ptr_conv.inner = untag_ptr(this_ptr);
59654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59656         this_ptr_conv.is_owned = false;
59657         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
59658 }
59659
59660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
59661         LDKBlindedTail this_ptr_conv;
59662         this_ptr_conv.inner = untag_ptr(this_ptr);
59663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59665         this_ptr_conv.is_owned = false;
59666         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
59667         return ret_conv;
59668 }
59669
59670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59671         LDKBlindedTail this_ptr_conv;
59672         this_ptr_conv.inner = untag_ptr(this_ptr);
59673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59675         this_ptr_conv.is_owned = false;
59676         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
59677 }
59678
59679 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) {
59680         LDKCVec_BlindedHopZ hops_arg_constr;
59681         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
59682         if (hops_arg_constr.datalen > 0)
59683                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
59684         else
59685                 hops_arg_constr.data = NULL;
59686         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
59687         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
59688                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
59689                 LDKBlindedHop hops_arg_conv_12_conv;
59690                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
59691                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
59692                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
59693                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
59694                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
59695         }
59696         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
59697         LDKPublicKey blinding_point_arg_ref;
59698         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
59699         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
59700         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
59701         int64_t ret_ref = 0;
59702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59704         return ret_ref;
59705 }
59706
59707 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
59708         LDKBlindedTail ret_var = BlindedTail_clone(arg);
59709         int64_t ret_ref = 0;
59710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59712         return ret_ref;
59713 }
59714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59715         LDKBlindedTail arg_conv;
59716         arg_conv.inner = untag_ptr(arg);
59717         arg_conv.is_owned = ptr_is_owned(arg);
59718         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59719         arg_conv.is_owned = false;
59720         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
59721         return ret_conv;
59722 }
59723
59724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59725         LDKBlindedTail orig_conv;
59726         orig_conv.inner = untag_ptr(orig);
59727         orig_conv.is_owned = ptr_is_owned(orig);
59728         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59729         orig_conv.is_owned = false;
59730         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
59731         int64_t ret_ref = 0;
59732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59734         return ret_ref;
59735 }
59736
59737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
59738         LDKBlindedTail o_conv;
59739         o_conv.inner = untag_ptr(o);
59740         o_conv.is_owned = ptr_is_owned(o);
59741         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59742         o_conv.is_owned = false;
59743         int64_t ret_conv = BlindedTail_hash(&o_conv);
59744         return ret_conv;
59745 }
59746
59747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59748         LDKBlindedTail a_conv;
59749         a_conv.inner = untag_ptr(a);
59750         a_conv.is_owned = ptr_is_owned(a);
59751         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59752         a_conv.is_owned = false;
59753         LDKBlindedTail b_conv;
59754         b_conv.inner = untag_ptr(b);
59755         b_conv.is_owned = ptr_is_owned(b);
59756         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59757         b_conv.is_owned = false;
59758         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
59759         return ret_conv;
59760 }
59761
59762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
59763         LDKBlindedTail obj_conv;
59764         obj_conv.inner = untag_ptr(obj);
59765         obj_conv.is_owned = ptr_is_owned(obj);
59766         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
59767         obj_conv.is_owned = false;
59768         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
59769         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
59770         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
59771         CVec_u8Z_free(ret_var);
59772         return ret_arr;
59773 }
59774
59775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
59776         LDKu8slice ser_ref;
59777         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
59778         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
59779         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
59780         *ret_conv = BlindedTail_read(ser_ref);
59781         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
59782         return tag_ptr(ret_conv, true);
59783 }
59784
59785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59786         LDKPath this_obj_conv;
59787         this_obj_conv.inner = untag_ptr(this_obj);
59788         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59790         Path_free(this_obj_conv);
59791 }
59792
59793 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
59794         LDKPath this_ptr_conv;
59795         this_ptr_conv.inner = untag_ptr(this_ptr);
59796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59798         this_ptr_conv.is_owned = false;
59799         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
59800         int64_tArray ret_arr = NULL;
59801         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59802         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59803         for (size_t k = 0; k < ret_var.datalen; k++) {
59804                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
59805                 int64_t ret_conv_10_ref = 0;
59806                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
59807                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
59808                 ret_arr_ptr[k] = ret_conv_10_ref;
59809         }
59810         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59811         FREE(ret_var.data);
59812         return ret_arr;
59813 }
59814
59815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59816         LDKPath this_ptr_conv;
59817         this_ptr_conv.inner = untag_ptr(this_ptr);
59818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59820         this_ptr_conv.is_owned = false;
59821         LDKCVec_RouteHopZ val_constr;
59822         val_constr.datalen = (*env)->GetArrayLength(env, val);
59823         if (val_constr.datalen > 0)
59824                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
59825         else
59826                 val_constr.data = NULL;
59827         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59828         for (size_t k = 0; k < val_constr.datalen; k++) {
59829                 int64_t val_conv_10 = val_vals[k];
59830                 LDKRouteHop val_conv_10_conv;
59831                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
59832                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
59833                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
59834                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
59835                 val_constr.data[k] = val_conv_10_conv;
59836         }
59837         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59838         Path_set_hops(&this_ptr_conv, val_constr);
59839 }
59840
59841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
59842         LDKPath this_ptr_conv;
59843         this_ptr_conv.inner = untag_ptr(this_ptr);
59844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59846         this_ptr_conv.is_owned = false;
59847         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
59848         int64_t ret_ref = 0;
59849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59851         return ret_ref;
59852 }
59853
59854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59855         LDKPath this_ptr_conv;
59856         this_ptr_conv.inner = untag_ptr(this_ptr);
59857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59859         this_ptr_conv.is_owned = false;
59860         LDKBlindedTail val_conv;
59861         val_conv.inner = untag_ptr(val);
59862         val_conv.is_owned = ptr_is_owned(val);
59863         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59864         val_conv = BlindedTail_clone(&val_conv);
59865         Path_set_blinded_tail(&this_ptr_conv, val_conv);
59866 }
59867
59868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
59869         LDKCVec_RouteHopZ hops_arg_constr;
59870         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
59871         if (hops_arg_constr.datalen > 0)
59872                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
59873         else
59874                 hops_arg_constr.data = NULL;
59875         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
59876         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
59877                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
59878                 LDKRouteHop hops_arg_conv_10_conv;
59879                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
59880                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
59881                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
59882                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
59883                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
59884         }
59885         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
59886         LDKBlindedTail blinded_tail_arg_conv;
59887         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
59888         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
59889         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
59890         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
59891         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
59892         int64_t ret_ref = 0;
59893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59895         return ret_ref;
59896 }
59897
59898 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
59899         LDKPath ret_var = Path_clone(arg);
59900         int64_t ret_ref = 0;
59901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59903         return ret_ref;
59904 }
59905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59906         LDKPath arg_conv;
59907         arg_conv.inner = untag_ptr(arg);
59908         arg_conv.is_owned = ptr_is_owned(arg);
59909         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59910         arg_conv.is_owned = false;
59911         int64_t ret_conv = Path_clone_ptr(&arg_conv);
59912         return ret_conv;
59913 }
59914
59915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59916         LDKPath orig_conv;
59917         orig_conv.inner = untag_ptr(orig);
59918         orig_conv.is_owned = ptr_is_owned(orig);
59919         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59920         orig_conv.is_owned = false;
59921         LDKPath ret_var = Path_clone(&orig_conv);
59922         int64_t ret_ref = 0;
59923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59925         return ret_ref;
59926 }
59927
59928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
59929         LDKPath o_conv;
59930         o_conv.inner = untag_ptr(o);
59931         o_conv.is_owned = ptr_is_owned(o);
59932         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59933         o_conv.is_owned = false;
59934         int64_t ret_conv = Path_hash(&o_conv);
59935         return ret_conv;
59936 }
59937
59938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59939         LDKPath a_conv;
59940         a_conv.inner = untag_ptr(a);
59941         a_conv.is_owned = ptr_is_owned(a);
59942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59943         a_conv.is_owned = false;
59944         LDKPath b_conv;
59945         b_conv.inner = untag_ptr(b);
59946         b_conv.is_owned = ptr_is_owned(b);
59947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59948         b_conv.is_owned = false;
59949         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
59950         return ret_conv;
59951 }
59952
59953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
59954         LDKPath this_arg_conv;
59955         this_arg_conv.inner = untag_ptr(this_arg);
59956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59958         this_arg_conv.is_owned = false;
59959         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
59960         return ret_conv;
59961 }
59962
59963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
59964         LDKPath this_arg_conv;
59965         this_arg_conv.inner = untag_ptr(this_arg);
59966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59968         this_arg_conv.is_owned = false;
59969         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
59970         return ret_conv;
59971 }
59972
59973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
59974         LDKPath this_arg_conv;
59975         this_arg_conv.inner = untag_ptr(this_arg);
59976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
59977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
59978         this_arg_conv.is_owned = false;
59979         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
59980         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
59981         int64_t ret_ref = tag_ptr(ret_copy, true);
59982         return ret_ref;
59983 }
59984
59985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59986         LDKRoute this_obj_conv;
59987         this_obj_conv.inner = untag_ptr(this_obj);
59988         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59990         Route_free(this_obj_conv);
59991 }
59992
59993 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
59994         LDKRoute this_ptr_conv;
59995         this_ptr_conv.inner = untag_ptr(this_ptr);
59996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59998         this_ptr_conv.is_owned = false;
59999         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
60000         int64_tArray ret_arr = NULL;
60001         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60002         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60003         for (size_t g = 0; g < ret_var.datalen; g++) {
60004                 LDKPath ret_conv_6_var = ret_var.data[g];
60005                 int64_t ret_conv_6_ref = 0;
60006                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
60007                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
60008                 ret_arr_ptr[g] = ret_conv_6_ref;
60009         }
60010         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60011         FREE(ret_var.data);
60012         return ret_arr;
60013 }
60014
60015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
60016         LDKRoute this_ptr_conv;
60017         this_ptr_conv.inner = untag_ptr(this_ptr);
60018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60020         this_ptr_conv.is_owned = false;
60021         LDKCVec_PathZ val_constr;
60022         val_constr.datalen = (*env)->GetArrayLength(env, val);
60023         if (val_constr.datalen > 0)
60024                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
60025         else
60026                 val_constr.data = NULL;
60027         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
60028         for (size_t g = 0; g < val_constr.datalen; g++) {
60029                 int64_t val_conv_6 = val_vals[g];
60030                 LDKPath val_conv_6_conv;
60031                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
60032                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
60033                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
60034                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
60035                 val_constr.data[g] = val_conv_6_conv;
60036         }
60037         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
60038         Route_set_paths(&this_ptr_conv, val_constr);
60039 }
60040
60041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
60042         LDKRoute this_ptr_conv;
60043         this_ptr_conv.inner = untag_ptr(this_ptr);
60044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60046         this_ptr_conv.is_owned = false;
60047         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
60048         int64_t ret_ref = 0;
60049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60051         return ret_ref;
60052 }
60053
60054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60055         LDKRoute this_ptr_conv;
60056         this_ptr_conv.inner = untag_ptr(this_ptr);
60057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60059         this_ptr_conv.is_owned = false;
60060         LDKPaymentParameters val_conv;
60061         val_conv.inner = untag_ptr(val);
60062         val_conv.is_owned = ptr_is_owned(val);
60063         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60064         val_conv = PaymentParameters_clone(&val_conv);
60065         Route_set_payment_params(&this_ptr_conv, val_conv);
60066 }
60067
60068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t payment_params_arg) {
60069         LDKCVec_PathZ paths_arg_constr;
60070         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
60071         if (paths_arg_constr.datalen > 0)
60072                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
60073         else
60074                 paths_arg_constr.data = NULL;
60075         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
60076         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
60077                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
60078                 LDKPath paths_arg_conv_6_conv;
60079                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
60080                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
60081                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
60082                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
60083                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
60084         }
60085         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
60086         LDKPaymentParameters payment_params_arg_conv;
60087         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
60088         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
60089         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
60090         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
60091         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
60092         int64_t ret_ref = 0;
60093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60095         return ret_ref;
60096 }
60097
60098 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
60099         LDKRoute ret_var = Route_clone(arg);
60100         int64_t ret_ref = 0;
60101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60103         return ret_ref;
60104 }
60105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60106         LDKRoute arg_conv;
60107         arg_conv.inner = untag_ptr(arg);
60108         arg_conv.is_owned = ptr_is_owned(arg);
60109         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60110         arg_conv.is_owned = false;
60111         int64_t ret_conv = Route_clone_ptr(&arg_conv);
60112         return ret_conv;
60113 }
60114
60115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60116         LDKRoute orig_conv;
60117         orig_conv.inner = untag_ptr(orig);
60118         orig_conv.is_owned = ptr_is_owned(orig);
60119         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60120         orig_conv.is_owned = false;
60121         LDKRoute ret_var = Route_clone(&orig_conv);
60122         int64_t ret_ref = 0;
60123         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60124         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60125         return ret_ref;
60126 }
60127
60128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
60129         LDKRoute o_conv;
60130         o_conv.inner = untag_ptr(o);
60131         o_conv.is_owned = ptr_is_owned(o);
60132         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60133         o_conv.is_owned = false;
60134         int64_t ret_conv = Route_hash(&o_conv);
60135         return ret_conv;
60136 }
60137
60138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60139         LDKRoute a_conv;
60140         a_conv.inner = untag_ptr(a);
60141         a_conv.is_owned = ptr_is_owned(a);
60142         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60143         a_conv.is_owned = false;
60144         LDKRoute b_conv;
60145         b_conv.inner = untag_ptr(b);
60146         b_conv.is_owned = ptr_is_owned(b);
60147         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60148         b_conv.is_owned = false;
60149         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
60150         return ret_conv;
60151 }
60152
60153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
60154         LDKRoute this_arg_conv;
60155         this_arg_conv.inner = untag_ptr(this_arg);
60156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60158         this_arg_conv.is_owned = false;
60159         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
60160         return ret_conv;
60161 }
60162
60163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
60164         LDKRoute this_arg_conv;
60165         this_arg_conv.inner = untag_ptr(this_arg);
60166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60168         this_arg_conv.is_owned = false;
60169         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
60170         return ret_conv;
60171 }
60172
60173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
60174         LDKRoute obj_conv;
60175         obj_conv.inner = untag_ptr(obj);
60176         obj_conv.is_owned = ptr_is_owned(obj);
60177         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60178         obj_conv.is_owned = false;
60179         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
60180         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60181         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60182         CVec_u8Z_free(ret_var);
60183         return ret_arr;
60184 }
60185
60186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60187         LDKu8slice ser_ref;
60188         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60189         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60190         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
60191         *ret_conv = Route_read(ser_ref);
60192         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60193         return tag_ptr(ret_conv, true);
60194 }
60195
60196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60197         LDKRouteParameters this_obj_conv;
60198         this_obj_conv.inner = untag_ptr(this_obj);
60199         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60201         RouteParameters_free(this_obj_conv);
60202 }
60203
60204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
60205         LDKRouteParameters this_ptr_conv;
60206         this_ptr_conv.inner = untag_ptr(this_ptr);
60207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60209         this_ptr_conv.is_owned = false;
60210         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
60211         int64_t ret_ref = 0;
60212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60213         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60214         return ret_ref;
60215 }
60216
60217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60218         LDKRouteParameters this_ptr_conv;
60219         this_ptr_conv.inner = untag_ptr(this_ptr);
60220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60222         this_ptr_conv.is_owned = false;
60223         LDKPaymentParameters val_conv;
60224         val_conv.inner = untag_ptr(val);
60225         val_conv.is_owned = ptr_is_owned(val);
60226         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60227         val_conv = PaymentParameters_clone(&val_conv);
60228         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
60229 }
60230
60231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
60232         LDKRouteParameters this_ptr_conv;
60233         this_ptr_conv.inner = untag_ptr(this_ptr);
60234         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60236         this_ptr_conv.is_owned = false;
60237         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
60238         return ret_conv;
60239 }
60240
60241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60242         LDKRouteParameters this_ptr_conv;
60243         this_ptr_conv.inner = untag_ptr(this_ptr);
60244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60246         this_ptr_conv.is_owned = false;
60247         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
60248 }
60249
60250 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) {
60251         LDKPaymentParameters payment_params_arg_conv;
60252         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
60253         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
60254         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
60255         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
60256         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
60257         int64_t ret_ref = 0;
60258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60260         return ret_ref;
60261 }
60262
60263 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
60264         LDKRouteParameters ret_var = RouteParameters_clone(arg);
60265         int64_t ret_ref = 0;
60266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60268         return ret_ref;
60269 }
60270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60271         LDKRouteParameters arg_conv;
60272         arg_conv.inner = untag_ptr(arg);
60273         arg_conv.is_owned = ptr_is_owned(arg);
60274         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60275         arg_conv.is_owned = false;
60276         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
60277         return ret_conv;
60278 }
60279
60280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60281         LDKRouteParameters orig_conv;
60282         orig_conv.inner = untag_ptr(orig);
60283         orig_conv.is_owned = ptr_is_owned(orig);
60284         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60285         orig_conv.is_owned = false;
60286         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
60287         int64_t ret_ref = 0;
60288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60290         return ret_ref;
60291 }
60292
60293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60294         LDKRouteParameters a_conv;
60295         a_conv.inner = untag_ptr(a);
60296         a_conv.is_owned = ptr_is_owned(a);
60297         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60298         a_conv.is_owned = false;
60299         LDKRouteParameters b_conv;
60300         b_conv.inner = untag_ptr(b);
60301         b_conv.is_owned = ptr_is_owned(b);
60302         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60303         b_conv.is_owned = false;
60304         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
60305         return ret_conv;
60306 }
60307
60308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
60309         LDKRouteParameters obj_conv;
60310         obj_conv.inner = untag_ptr(obj);
60311         obj_conv.is_owned = ptr_is_owned(obj);
60312         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60313         obj_conv.is_owned = false;
60314         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
60315         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60316         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60317         CVec_u8Z_free(ret_var);
60318         return ret_arr;
60319 }
60320
60321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60322         LDKu8slice ser_ref;
60323         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60324         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60325         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
60326         *ret_conv = RouteParameters_read(ser_ref);
60327         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60328         return tag_ptr(ret_conv, true);
60329 }
60330
60331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60332         LDKPaymentParameters this_obj_conv;
60333         this_obj_conv.inner = untag_ptr(this_obj);
60334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60336         PaymentParameters_free(this_obj_conv);
60337 }
60338
60339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
60340         LDKPaymentParameters this_ptr_conv;
60341         this_ptr_conv.inner = untag_ptr(this_ptr);
60342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60344         this_ptr_conv.is_owned = false;
60345         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60346         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
60347         int64_t ret_ref = tag_ptr(ret_copy, true);
60348         return ret_ref;
60349 }
60350
60351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60352         LDKPaymentParameters this_ptr_conv;
60353         this_ptr_conv.inner = untag_ptr(this_ptr);
60354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60356         this_ptr_conv.is_owned = false;
60357         void* val_ptr = untag_ptr(val);
60358         CHECK_ACCESS(val_ptr);
60359         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
60360         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
60361         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
60362 }
60363
60364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
60365         LDKPaymentParameters this_ptr_conv;
60366         this_ptr_conv.inner = untag_ptr(this_ptr);
60367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60369         this_ptr_conv.is_owned = false;
60370         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60371         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
60372         int64_t ret_ref = tag_ptr(ret_copy, true);
60373         return ret_ref;
60374 }
60375
60376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60377         LDKPaymentParameters this_ptr_conv;
60378         this_ptr_conv.inner = untag_ptr(this_ptr);
60379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60381         this_ptr_conv.is_owned = false;
60382         void* val_ptr = untag_ptr(val);
60383         CHECK_ACCESS(val_ptr);
60384         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
60385         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
60386         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
60387 }
60388
60389 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
60390         LDKPaymentParameters this_ptr_conv;
60391         this_ptr_conv.inner = untag_ptr(this_ptr);
60392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60394         this_ptr_conv.is_owned = false;
60395         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
60396         return ret_conv;
60397 }
60398
60399 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) {
60400         LDKPaymentParameters this_ptr_conv;
60401         this_ptr_conv.inner = untag_ptr(this_ptr);
60402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60404         this_ptr_conv.is_owned = false;
60405         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
60406 }
60407
60408 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
60409         LDKPaymentParameters this_ptr_conv;
60410         this_ptr_conv.inner = untag_ptr(this_ptr);
60411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60413         this_ptr_conv.is_owned = false;
60414         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
60415         return ret_conv;
60416 }
60417
60418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
60419         LDKPaymentParameters this_ptr_conv;
60420         this_ptr_conv.inner = untag_ptr(this_ptr);
60421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60423         this_ptr_conv.is_owned = false;
60424         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
60425 }
60426
60427 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) {
60428         LDKPaymentParameters this_ptr_conv;
60429         this_ptr_conv.inner = untag_ptr(this_ptr);
60430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60432         this_ptr_conv.is_owned = false;
60433         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
60434         return ret_conv;
60435 }
60436
60437 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) {
60438         LDKPaymentParameters this_ptr_conv;
60439         this_ptr_conv.inner = untag_ptr(this_ptr);
60440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60442         this_ptr_conv.is_owned = false;
60443         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
60444 }
60445
60446 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
60447         LDKPaymentParameters this_ptr_conv;
60448         this_ptr_conv.inner = untag_ptr(this_ptr);
60449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60451         this_ptr_conv.is_owned = false;
60452         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
60453         int64_tArray ret_arr = NULL;
60454         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60455         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60456         for (size_t g = 0; g < ret_var.datalen; g++) {
60457                 int64_t ret_conv_6_conv = ret_var.data[g];
60458                 ret_arr_ptr[g] = ret_conv_6_conv;
60459         }
60460         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60461         FREE(ret_var.data);
60462         return ret_arr;
60463 }
60464
60465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
60466         LDKPaymentParameters this_ptr_conv;
60467         this_ptr_conv.inner = untag_ptr(this_ptr);
60468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60470         this_ptr_conv.is_owned = false;
60471         LDKCVec_u64Z val_constr;
60472         val_constr.datalen = (*env)->GetArrayLength(env, val);
60473         if (val_constr.datalen > 0)
60474                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
60475         else
60476                 val_constr.data = NULL;
60477         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
60478         for (size_t g = 0; g < val_constr.datalen; g++) {
60479                 int64_t val_conv_6 = val_vals[g];
60480                 val_constr.data[g] = val_conv_6;
60481         }
60482         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
60483         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
60484 }
60485
60486 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) {
60487         void* payee_arg_ptr = untag_ptr(payee_arg);
60488         CHECK_ACCESS(payee_arg_ptr);
60489         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
60490         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
60491         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
60492         CHECK_ACCESS(expiry_time_arg_ptr);
60493         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
60494         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
60495         LDKCVec_u64Z previously_failed_channels_arg_constr;
60496         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
60497         if (previously_failed_channels_arg_constr.datalen > 0)
60498                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
60499         else
60500                 previously_failed_channels_arg_constr.data = NULL;
60501         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
60502         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
60503                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
60504                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
60505         }
60506         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
60507         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);
60508         int64_t ret_ref = 0;
60509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60511         return ret_ref;
60512 }
60513
60514 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
60515         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
60516         int64_t ret_ref = 0;
60517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60519         return ret_ref;
60520 }
60521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60522         LDKPaymentParameters arg_conv;
60523         arg_conv.inner = untag_ptr(arg);
60524         arg_conv.is_owned = ptr_is_owned(arg);
60525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60526         arg_conv.is_owned = false;
60527         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
60528         return ret_conv;
60529 }
60530
60531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60532         LDKPaymentParameters orig_conv;
60533         orig_conv.inner = untag_ptr(orig);
60534         orig_conv.is_owned = ptr_is_owned(orig);
60535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60536         orig_conv.is_owned = false;
60537         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
60538         int64_t ret_ref = 0;
60539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60541         return ret_ref;
60542 }
60543
60544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
60545         LDKPaymentParameters o_conv;
60546         o_conv.inner = untag_ptr(o);
60547         o_conv.is_owned = ptr_is_owned(o);
60548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60549         o_conv.is_owned = false;
60550         int64_t ret_conv = PaymentParameters_hash(&o_conv);
60551         return ret_conv;
60552 }
60553
60554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60555         LDKPaymentParameters a_conv;
60556         a_conv.inner = untag_ptr(a);
60557         a_conv.is_owned = ptr_is_owned(a);
60558         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60559         a_conv.is_owned = false;
60560         LDKPaymentParameters b_conv;
60561         b_conv.inner = untag_ptr(b);
60562         b_conv.is_owned = ptr_is_owned(b);
60563         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60564         b_conv.is_owned = false;
60565         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
60566         return ret_conv;
60567 }
60568
60569 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
60570         LDKPaymentParameters obj_conv;
60571         obj_conv.inner = untag_ptr(obj);
60572         obj_conv.is_owned = ptr_is_owned(obj);
60573         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60574         obj_conv.is_owned = false;
60575         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
60576         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60577         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60578         CVec_u8Z_free(ret_var);
60579         return ret_arr;
60580 }
60581
60582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
60583         LDKu8slice ser_ref;
60584         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60585         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60586         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
60587         *ret_conv = PaymentParameters_read(ser_ref, arg);
60588         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60589         return tag_ptr(ret_conv, true);
60590 }
60591
60592 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) {
60593         LDKPublicKey payee_pubkey_ref;
60594         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
60595         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
60596         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
60597         int64_t ret_ref = 0;
60598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60600         return ret_ref;
60601 }
60602
60603 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) {
60604         LDKPublicKey payee_pubkey_ref;
60605         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
60606         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
60607         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
60608         int64_t ret_ref = 0;
60609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60611         return ret_ref;
60612 }
60613
60614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
60615         LDKBolt12Invoice invoice_conv;
60616         invoice_conv.inner = untag_ptr(invoice);
60617         invoice_conv.is_owned = ptr_is_owned(invoice);
60618         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
60619         invoice_conv.is_owned = false;
60620         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
60621         int64_t ret_ref = 0;
60622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60624         return ret_ref;
60625 }
60626
60627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60628         if (!ptr_is_owned(this_ptr)) return;
60629         void* this_ptr_ptr = untag_ptr(this_ptr);
60630         CHECK_ACCESS(this_ptr_ptr);
60631         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
60632         FREE(untag_ptr(this_ptr));
60633         Payee_free(this_ptr_conv);
60634 }
60635
60636 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
60637         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60638         *ret_copy = Payee_clone(arg);
60639         int64_t ret_ref = tag_ptr(ret_copy, true);
60640         return ret_ref;
60641 }
60642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60643         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
60644         int64_t ret_conv = Payee_clone_ptr(arg_conv);
60645         return ret_conv;
60646 }
60647
60648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60649         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
60650         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60651         *ret_copy = Payee_clone(orig_conv);
60652         int64_t ret_ref = tag_ptr(ret_copy, true);
60653         return ret_ref;
60654 }
60655
60656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
60657         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
60658         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
60659         if (route_hints_constr.datalen > 0)
60660                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
60661         else
60662                 route_hints_constr.data = NULL;
60663         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
60664         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
60665                 int64_t route_hints_conv_37 = route_hints_vals[l];
60666                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
60667                 CHECK_ACCESS(route_hints_conv_37_ptr);
60668                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
60669                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
60670                 route_hints_constr.data[l] = route_hints_conv_37_conv;
60671         }
60672         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
60673         LDKBolt12InvoiceFeatures features_conv;
60674         features_conv.inner = untag_ptr(features);
60675         features_conv.is_owned = ptr_is_owned(features);
60676         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
60677         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
60678         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60679         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
60680         int64_t ret_ref = tag_ptr(ret_copy, true);
60681         return ret_ref;
60682 }
60683
60684 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) {
60685         LDKPublicKey node_id_ref;
60686         CHECK((*env)->GetArrayLength(env, node_id) == 33);
60687         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
60688         LDKCVec_RouteHintZ route_hints_constr;
60689         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
60690         if (route_hints_constr.datalen > 0)
60691                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
60692         else
60693                 route_hints_constr.data = NULL;
60694         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
60695         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
60696                 int64_t route_hints_conv_11 = route_hints_vals[l];
60697                 LDKRouteHint route_hints_conv_11_conv;
60698                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
60699                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
60700                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
60701                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
60702                 route_hints_constr.data[l] = route_hints_conv_11_conv;
60703         }
60704         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
60705         LDKBolt11InvoiceFeatures features_conv;
60706         features_conv.inner = untag_ptr(features);
60707         features_conv.is_owned = ptr_is_owned(features);
60708         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
60709         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
60710         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
60711         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
60712         int64_t ret_ref = tag_ptr(ret_copy, true);
60713         return ret_ref;
60714 }
60715
60716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
60717         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
60718         int64_t ret_conv = Payee_hash(o_conv);
60719         return ret_conv;
60720 }
60721
60722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60723         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
60724         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
60725         jboolean ret_conv = Payee_eq(a_conv, b_conv);
60726         return ret_conv;
60727 }
60728
60729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60730         LDKRouteHint this_obj_conv;
60731         this_obj_conv.inner = untag_ptr(this_obj);
60732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60734         RouteHint_free(this_obj_conv);
60735 }
60736
60737 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
60738         LDKRouteHint this_ptr_conv;
60739         this_ptr_conv.inner = untag_ptr(this_ptr);
60740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60742         this_ptr_conv.is_owned = false;
60743         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
60744         int64_tArray ret_arr = NULL;
60745         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
60746         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
60747         for (size_t o = 0; o < ret_var.datalen; o++) {
60748                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
60749                 int64_t ret_conv_14_ref = 0;
60750                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
60751                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
60752                 ret_arr_ptr[o] = ret_conv_14_ref;
60753         }
60754         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
60755         FREE(ret_var.data);
60756         return ret_arr;
60757 }
60758
60759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
60760         LDKRouteHint this_ptr_conv;
60761         this_ptr_conv.inner = untag_ptr(this_ptr);
60762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60764         this_ptr_conv.is_owned = false;
60765         LDKCVec_RouteHintHopZ val_constr;
60766         val_constr.datalen = (*env)->GetArrayLength(env, val);
60767         if (val_constr.datalen > 0)
60768                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
60769         else
60770                 val_constr.data = NULL;
60771         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
60772         for (size_t o = 0; o < val_constr.datalen; o++) {
60773                 int64_t val_conv_14 = val_vals[o];
60774                 LDKRouteHintHop val_conv_14_conv;
60775                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
60776                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
60777                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
60778                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
60779                 val_constr.data[o] = val_conv_14_conv;
60780         }
60781         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
60782         RouteHint_set_a(&this_ptr_conv, val_constr);
60783 }
60784
60785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
60786         LDKCVec_RouteHintHopZ a_arg_constr;
60787         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
60788         if (a_arg_constr.datalen > 0)
60789                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
60790         else
60791                 a_arg_constr.data = NULL;
60792         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
60793         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
60794                 int64_t a_arg_conv_14 = a_arg_vals[o];
60795                 LDKRouteHintHop a_arg_conv_14_conv;
60796                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
60797                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
60798                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
60799                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
60800                 a_arg_constr.data[o] = a_arg_conv_14_conv;
60801         }
60802         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
60803         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
60804         int64_t ret_ref = 0;
60805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60807         return ret_ref;
60808 }
60809
60810 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
60811         LDKRouteHint ret_var = RouteHint_clone(arg);
60812         int64_t ret_ref = 0;
60813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60815         return ret_ref;
60816 }
60817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60818         LDKRouteHint arg_conv;
60819         arg_conv.inner = untag_ptr(arg);
60820         arg_conv.is_owned = ptr_is_owned(arg);
60821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60822         arg_conv.is_owned = false;
60823         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
60824         return ret_conv;
60825 }
60826
60827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60828         LDKRouteHint orig_conv;
60829         orig_conv.inner = untag_ptr(orig);
60830         orig_conv.is_owned = ptr_is_owned(orig);
60831         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60832         orig_conv.is_owned = false;
60833         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
60834         int64_t ret_ref = 0;
60835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60837         return ret_ref;
60838 }
60839
60840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
60841         LDKRouteHint o_conv;
60842         o_conv.inner = untag_ptr(o);
60843         o_conv.is_owned = ptr_is_owned(o);
60844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60845         o_conv.is_owned = false;
60846         int64_t ret_conv = RouteHint_hash(&o_conv);
60847         return ret_conv;
60848 }
60849
60850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60851         LDKRouteHint a_conv;
60852         a_conv.inner = untag_ptr(a);
60853         a_conv.is_owned = ptr_is_owned(a);
60854         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60855         a_conv.is_owned = false;
60856         LDKRouteHint b_conv;
60857         b_conv.inner = untag_ptr(b);
60858         b_conv.is_owned = ptr_is_owned(b);
60859         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60860         b_conv.is_owned = false;
60861         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
60862         return ret_conv;
60863 }
60864
60865 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
60866         LDKRouteHint obj_conv;
60867         obj_conv.inner = untag_ptr(obj);
60868         obj_conv.is_owned = ptr_is_owned(obj);
60869         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60870         obj_conv.is_owned = false;
60871         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
60872         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60873         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60874         CVec_u8Z_free(ret_var);
60875         return ret_arr;
60876 }
60877
60878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60879         LDKu8slice ser_ref;
60880         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60881         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60882         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
60883         *ret_conv = RouteHint_read(ser_ref);
60884         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60885         return tag_ptr(ret_conv, true);
60886 }
60887
60888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60889         LDKRouteHintHop this_obj_conv;
60890         this_obj_conv.inner = untag_ptr(this_obj);
60891         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60893         RouteHintHop_free(this_obj_conv);
60894 }
60895
60896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
60897         LDKRouteHintHop this_ptr_conv;
60898         this_ptr_conv.inner = untag_ptr(this_ptr);
60899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60901         this_ptr_conv.is_owned = false;
60902         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60903         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
60904         return ret_arr;
60905 }
60906
60907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60908         LDKRouteHintHop this_ptr_conv;
60909         this_ptr_conv.inner = untag_ptr(this_ptr);
60910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60912         this_ptr_conv.is_owned = false;
60913         LDKPublicKey val_ref;
60914         CHECK((*env)->GetArrayLength(env, val) == 33);
60915         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
60916         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
60917 }
60918
60919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
60920         LDKRouteHintHop this_ptr_conv;
60921         this_ptr_conv.inner = untag_ptr(this_ptr);
60922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60924         this_ptr_conv.is_owned = false;
60925         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
60926         return ret_conv;
60927 }
60928
60929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60930         LDKRouteHintHop this_ptr_conv;
60931         this_ptr_conv.inner = untag_ptr(this_ptr);
60932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60934         this_ptr_conv.is_owned = false;
60935         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
60936 }
60937
60938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
60939         LDKRouteHintHop this_ptr_conv;
60940         this_ptr_conv.inner = untag_ptr(this_ptr);
60941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60943         this_ptr_conv.is_owned = false;
60944         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
60945         int64_t ret_ref = 0;
60946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60948         return ret_ref;
60949 }
60950
60951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60952         LDKRouteHintHop this_ptr_conv;
60953         this_ptr_conv.inner = untag_ptr(this_ptr);
60954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60956         this_ptr_conv.is_owned = false;
60957         LDKRoutingFees val_conv;
60958         val_conv.inner = untag_ptr(val);
60959         val_conv.is_owned = ptr_is_owned(val);
60960         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60961         val_conv = RoutingFees_clone(&val_conv);
60962         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
60963 }
60964
60965 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
60966         LDKRouteHintHop this_ptr_conv;
60967         this_ptr_conv.inner = untag_ptr(this_ptr);
60968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60970         this_ptr_conv.is_owned = false;
60971         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
60972         return ret_conv;
60973 }
60974
60975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
60976         LDKRouteHintHop this_ptr_conv;
60977         this_ptr_conv.inner = untag_ptr(this_ptr);
60978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60980         this_ptr_conv.is_owned = false;
60981         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
60982 }
60983
60984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
60985         LDKRouteHintHop this_ptr_conv;
60986         this_ptr_conv.inner = untag_ptr(this_ptr);
60987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60989         this_ptr_conv.is_owned = false;
60990         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
60991         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
60992         int64_t ret_ref = tag_ptr(ret_copy, true);
60993         return ret_ref;
60994 }
60995
60996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60997         LDKRouteHintHop this_ptr_conv;
60998         this_ptr_conv.inner = untag_ptr(this_ptr);
60999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61001         this_ptr_conv.is_owned = false;
61002         void* val_ptr = untag_ptr(val);
61003         CHECK_ACCESS(val_ptr);
61004         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
61005         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
61006         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
61007 }
61008
61009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61010         LDKRouteHintHop this_ptr_conv;
61011         this_ptr_conv.inner = untag_ptr(this_ptr);
61012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61014         this_ptr_conv.is_owned = false;
61015         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
61016         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
61017         int64_t ret_ref = tag_ptr(ret_copy, true);
61018         return ret_ref;
61019 }
61020
61021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61022         LDKRouteHintHop this_ptr_conv;
61023         this_ptr_conv.inner = untag_ptr(this_ptr);
61024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61026         this_ptr_conv.is_owned = false;
61027         void* val_ptr = untag_ptr(val);
61028         CHECK_ACCESS(val_ptr);
61029         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
61030         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
61031         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
61032 }
61033
61034 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) {
61035         LDKPublicKey src_node_id_arg_ref;
61036         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
61037         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
61038         LDKRoutingFees fees_arg_conv;
61039         fees_arg_conv.inner = untag_ptr(fees_arg);
61040         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
61041         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
61042         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
61043         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
61044         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
61045         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
61046         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
61047         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
61048         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
61049         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
61050         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
61051         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);
61052         int64_t ret_ref = 0;
61053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61055         return ret_ref;
61056 }
61057
61058 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
61059         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
61060         int64_t ret_ref = 0;
61061         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61062         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61063         return ret_ref;
61064 }
61065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61066         LDKRouteHintHop arg_conv;
61067         arg_conv.inner = untag_ptr(arg);
61068         arg_conv.is_owned = ptr_is_owned(arg);
61069         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61070         arg_conv.is_owned = false;
61071         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
61072         return ret_conv;
61073 }
61074
61075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61076         LDKRouteHintHop orig_conv;
61077         orig_conv.inner = untag_ptr(orig);
61078         orig_conv.is_owned = ptr_is_owned(orig);
61079         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61080         orig_conv.is_owned = false;
61081         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
61082         int64_t ret_ref = 0;
61083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61085         return ret_ref;
61086 }
61087
61088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
61089         LDKRouteHintHop o_conv;
61090         o_conv.inner = untag_ptr(o);
61091         o_conv.is_owned = ptr_is_owned(o);
61092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61093         o_conv.is_owned = false;
61094         int64_t ret_conv = RouteHintHop_hash(&o_conv);
61095         return ret_conv;
61096 }
61097
61098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
61099         LDKRouteHintHop a_conv;
61100         a_conv.inner = untag_ptr(a);
61101         a_conv.is_owned = ptr_is_owned(a);
61102         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61103         a_conv.is_owned = false;
61104         LDKRouteHintHop b_conv;
61105         b_conv.inner = untag_ptr(b);
61106         b_conv.is_owned = ptr_is_owned(b);
61107         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61108         b_conv.is_owned = false;
61109         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
61110         return ret_conv;
61111 }
61112
61113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
61114         LDKRouteHintHop obj_conv;
61115         obj_conv.inner = untag_ptr(obj);
61116         obj_conv.is_owned = ptr_is_owned(obj);
61117         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61118         obj_conv.is_owned = false;
61119         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
61120         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61121         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61122         CVec_u8Z_free(ret_var);
61123         return ret_arr;
61124 }
61125
61126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61127         LDKu8slice ser_ref;
61128         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61129         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61130         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
61131         *ret_conv = RouteHintHop_read(ser_ref);
61132         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61133         return tag_ptr(ret_conv, true);
61134 }
61135
61136 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) {
61137         LDKPublicKey our_node_pubkey_ref;
61138         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
61139         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
61140         LDKRouteParameters route_params_conv;
61141         route_params_conv.inner = untag_ptr(route_params);
61142         route_params_conv.is_owned = ptr_is_owned(route_params);
61143         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
61144         route_params_conv.is_owned = false;
61145         LDKNetworkGraph network_graph_conv;
61146         network_graph_conv.inner = untag_ptr(network_graph);
61147         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61148         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61149         network_graph_conv.is_owned = false;
61150         LDKCVec_ChannelDetailsZ first_hops_constr;
61151         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
61152         if (first_hops != NULL) {
61153                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
61154                 if (first_hops_constr.datalen > 0)
61155                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
61156                 else
61157                         first_hops_constr.data = NULL;
61158                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
61159                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
61160                         int64_t first_hops_conv_16 = first_hops_vals[q];
61161                         LDKChannelDetails first_hops_conv_16_conv;
61162                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
61163                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
61164                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
61165                         first_hops_conv_16_conv.is_owned = false;
61166                         first_hops_constr.data[q] = first_hops_conv_16_conv;
61167                 }
61168                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
61169                 first_hops_ptr = &first_hops_constr;
61170         }
61171         void* logger_ptr = untag_ptr(logger);
61172         CHECK_ACCESS(logger_ptr);
61173         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61174         if (logger_conv.free == LDKLogger_JCalls_free) {
61175                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61176                 LDKLogger_JCalls_cloned(&logger_conv);
61177         }
61178         void* scorer_ptr = untag_ptr(scorer);
61179         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
61180         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
61181         LDKProbabilisticScoringFeeParameters score_params_conv;
61182         score_params_conv.inner = untag_ptr(score_params);
61183         score_params_conv.is_owned = ptr_is_owned(score_params);
61184         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
61185         score_params_conv.is_owned = false;
61186         uint8_t random_seed_bytes_arr[32];
61187         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
61188         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
61189         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
61190         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
61191         *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);
61192         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
61193         return tag_ptr(ret_conv, true);
61194 }
61195
61196 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) {
61197         LDKPublicKey our_node_pubkey_ref;
61198         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
61199         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
61200         LDKCVec_PublicKeyZ hops_constr;
61201         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
61202         if (hops_constr.datalen > 0)
61203                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
61204         else
61205                 hops_constr.data = NULL;
61206         for (size_t i = 0; i < hops_constr.datalen; i++) {
61207                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
61208                 LDKPublicKey hops_conv_8_ref;
61209                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
61210                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
61211                 hops_constr.data[i] = hops_conv_8_ref;
61212         }
61213         LDKRouteParameters route_params_conv;
61214         route_params_conv.inner = untag_ptr(route_params);
61215         route_params_conv.is_owned = ptr_is_owned(route_params);
61216         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
61217         route_params_conv.is_owned = false;
61218         LDKNetworkGraph network_graph_conv;
61219         network_graph_conv.inner = untag_ptr(network_graph);
61220         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61221         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61222         network_graph_conv.is_owned = false;
61223         void* logger_ptr = untag_ptr(logger);
61224         CHECK_ACCESS(logger_ptr);
61225         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61226         if (logger_conv.free == LDKLogger_JCalls_free) {
61227                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61228                 LDKLogger_JCalls_cloned(&logger_conv);
61229         }
61230         uint8_t random_seed_bytes_arr[32];
61231         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
61232         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
61233         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
61234         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
61235         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
61236         return tag_ptr(ret_conv, true);
61237 }
61238
61239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61240         if (!ptr_is_owned(this_ptr)) return;
61241         void* this_ptr_ptr = untag_ptr(this_ptr);
61242         CHECK_ACCESS(this_ptr_ptr);
61243         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
61244         FREE(untag_ptr(this_ptr));
61245         Score_free(this_ptr_conv);
61246 }
61247
61248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61249         if (!ptr_is_owned(this_ptr)) return;
61250         void* this_ptr_ptr = untag_ptr(this_ptr);
61251         CHECK_ACCESS(this_ptr_ptr);
61252         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
61253         FREE(untag_ptr(this_ptr));
61254         LockableScore_free(this_ptr_conv);
61255 }
61256
61257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61258         if (!ptr_is_owned(this_ptr)) return;
61259         void* this_ptr_ptr = untag_ptr(this_ptr);
61260         CHECK_ACCESS(this_ptr_ptr);
61261         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
61262         FREE(untag_ptr(this_ptr));
61263         WriteableScore_free(this_ptr_conv);
61264 }
61265
61266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61267         LDKMultiThreadedLockableScore this_obj_conv;
61268         this_obj_conv.inner = untag_ptr(this_obj);
61269         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61271         MultiThreadedLockableScore_free(this_obj_conv);
61272 }
61273
61274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
61275         LDKMultiThreadedLockableScore this_arg_conv;
61276         this_arg_conv.inner = untag_ptr(this_arg);
61277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61279         this_arg_conv.is_owned = false;
61280         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
61281         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
61282         return tag_ptr(ret_ret, true);
61283 }
61284
61285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
61286         LDKMultiThreadedLockableScore obj_conv;
61287         obj_conv.inner = untag_ptr(obj);
61288         obj_conv.is_owned = ptr_is_owned(obj);
61289         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61290         obj_conv.is_owned = false;
61291         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
61292         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61293         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61294         CVec_u8Z_free(ret_var);
61295         return ret_arr;
61296 }
61297
61298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
61299         LDKMultiThreadedLockableScore this_arg_conv;
61300         this_arg_conv.inner = untag_ptr(this_arg);
61301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61303         this_arg_conv.is_owned = false;
61304         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
61305         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
61306         return tag_ptr(ret_ret, true);
61307 }
61308
61309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
61310         void* score_ptr = untag_ptr(score);
61311         CHECK_ACCESS(score_ptr);
61312         LDKScore score_conv = *(LDKScore*)(score_ptr);
61313         if (score_conv.free == LDKScore_JCalls_free) {
61314                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61315                 LDKScore_JCalls_cloned(&score_conv);
61316         }
61317         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
61318         int64_t ret_ref = 0;
61319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61321         return ret_ref;
61322 }
61323
61324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61325         LDKMultiThreadedScoreLock this_obj_conv;
61326         this_obj_conv.inner = untag_ptr(this_obj);
61327         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61329         MultiThreadedScoreLock_free(this_obj_conv);
61330 }
61331
61332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1write(JNIEnv *env, jclass clz, int64_t obj) {
61333         LDKMultiThreadedScoreLock obj_conv;
61334         obj_conv.inner = untag_ptr(obj);
61335         obj_conv.is_owned = ptr_is_owned(obj);
61336         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61337         obj_conv.is_owned = false;
61338         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
61339         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61340         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61341         CVec_u8Z_free(ret_var);
61342         return ret_arr;
61343 }
61344
61345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLock_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
61346         LDKMultiThreadedScoreLock this_arg_conv;
61347         this_arg_conv.inner = untag_ptr(this_arg);
61348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61350         this_arg_conv.is_owned = false;
61351         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
61352         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
61353         return tag_ptr(ret_ret, true);
61354 }
61355
61356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61357         LDKChannelUsage this_obj_conv;
61358         this_obj_conv.inner = untag_ptr(this_obj);
61359         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61361         ChannelUsage_free(this_obj_conv);
61362 }
61363
61364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61365         LDKChannelUsage this_ptr_conv;
61366         this_ptr_conv.inner = untag_ptr(this_ptr);
61367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61369         this_ptr_conv.is_owned = false;
61370         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
61371         return ret_conv;
61372 }
61373
61374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61375         LDKChannelUsage this_ptr_conv;
61376         this_ptr_conv.inner = untag_ptr(this_ptr);
61377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61379         this_ptr_conv.is_owned = false;
61380         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
61381 }
61382
61383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61384         LDKChannelUsage this_ptr_conv;
61385         this_ptr_conv.inner = untag_ptr(this_ptr);
61386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61388         this_ptr_conv.is_owned = false;
61389         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
61390         return ret_conv;
61391 }
61392
61393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61394         LDKChannelUsage this_ptr_conv;
61395         this_ptr_conv.inner = untag_ptr(this_ptr);
61396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61398         this_ptr_conv.is_owned = false;
61399         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
61400 }
61401
61402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
61403         LDKChannelUsage this_ptr_conv;
61404         this_ptr_conv.inner = untag_ptr(this_ptr);
61405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61407         this_ptr_conv.is_owned = false;
61408         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
61409         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
61410         int64_t ret_ref = tag_ptr(ret_copy, true);
61411         return ret_ref;
61412 }
61413
61414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61415         LDKChannelUsage this_ptr_conv;
61416         this_ptr_conv.inner = untag_ptr(this_ptr);
61417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61419         this_ptr_conv.is_owned = false;
61420         void* val_ptr = untag_ptr(val);
61421         CHECK_ACCESS(val_ptr);
61422         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
61423         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
61424         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
61425 }
61426
61427 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) {
61428         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
61429         CHECK_ACCESS(effective_capacity_arg_ptr);
61430         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
61431         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
61432         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
61433         int64_t ret_ref = 0;
61434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61436         return ret_ref;
61437 }
61438
61439 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
61440         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
61441         int64_t ret_ref = 0;
61442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61444         return ret_ref;
61445 }
61446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61447         LDKChannelUsage arg_conv;
61448         arg_conv.inner = untag_ptr(arg);
61449         arg_conv.is_owned = ptr_is_owned(arg);
61450         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61451         arg_conv.is_owned = false;
61452         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
61453         return ret_conv;
61454 }
61455
61456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61457         LDKChannelUsage orig_conv;
61458         orig_conv.inner = untag_ptr(orig);
61459         orig_conv.is_owned = ptr_is_owned(orig);
61460         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61461         orig_conv.is_owned = false;
61462         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
61463         int64_t ret_ref = 0;
61464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61466         return ret_ref;
61467 }
61468
61469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61470         LDKFixedPenaltyScorer this_obj_conv;
61471         this_obj_conv.inner = untag_ptr(this_obj);
61472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61474         FixedPenaltyScorer_free(this_obj_conv);
61475 }
61476
61477 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
61478         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
61479         int64_t ret_ref = 0;
61480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61482         return ret_ref;
61483 }
61484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61485         LDKFixedPenaltyScorer arg_conv;
61486         arg_conv.inner = untag_ptr(arg);
61487         arg_conv.is_owned = ptr_is_owned(arg);
61488         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61489         arg_conv.is_owned = false;
61490         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
61491         return ret_conv;
61492 }
61493
61494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61495         LDKFixedPenaltyScorer orig_conv;
61496         orig_conv.inner = untag_ptr(orig);
61497         orig_conv.is_owned = ptr_is_owned(orig);
61498         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61499         orig_conv.is_owned = false;
61500         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
61501         int64_t ret_ref = 0;
61502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61504         return ret_ref;
61505 }
61506
61507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
61508         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
61509         int64_t ret_ref = 0;
61510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61512         return ret_ref;
61513 }
61514
61515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
61516         LDKFixedPenaltyScorer this_arg_conv;
61517         this_arg_conv.inner = untag_ptr(this_arg);
61518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61520         this_arg_conv.is_owned = false;
61521         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
61522         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
61523         return tag_ptr(ret_ret, true);
61524 }
61525
61526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
61527         LDKFixedPenaltyScorer obj_conv;
61528         obj_conv.inner = untag_ptr(obj);
61529         obj_conv.is_owned = ptr_is_owned(obj);
61530         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61531         obj_conv.is_owned = false;
61532         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
61533         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61534         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61535         CVec_u8Z_free(ret_var);
61536         return ret_arr;
61537 }
61538
61539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
61540         LDKu8slice ser_ref;
61541         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61542         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61543         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
61544         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
61545         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61546         return tag_ptr(ret_conv, true);
61547 }
61548
61549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61550         LDKProbabilisticScorer this_obj_conv;
61551         this_obj_conv.inner = untag_ptr(this_obj);
61552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61554         ProbabilisticScorer_free(this_obj_conv);
61555 }
61556
61557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61558         LDKProbabilisticScoringFeeParameters this_obj_conv;
61559         this_obj_conv.inner = untag_ptr(this_obj);
61560         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61562         ProbabilisticScoringFeeParameters_free(this_obj_conv);
61563 }
61564
61565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61566         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61567         this_ptr_conv.inner = untag_ptr(this_ptr);
61568         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61570         this_ptr_conv.is_owned = false;
61571         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
61572         return ret_conv;
61573 }
61574
61575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61576         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61577         this_ptr_conv.inner = untag_ptr(this_ptr);
61578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61580         this_ptr_conv.is_owned = false;
61581         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
61582 }
61583
61584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61585         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61586         this_ptr_conv.inner = untag_ptr(this_ptr);
61587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61589         this_ptr_conv.is_owned = false;
61590         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
61591         return ret_conv;
61592 }
61593
61594 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) {
61595         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61596         this_ptr_conv.inner = untag_ptr(this_ptr);
61597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61599         this_ptr_conv.is_owned = false;
61600         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
61601 }
61602
61603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61604         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61605         this_ptr_conv.inner = untag_ptr(this_ptr);
61606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61608         this_ptr_conv.is_owned = false;
61609         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
61610         return ret_conv;
61611 }
61612
61613 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) {
61614         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61615         this_ptr_conv.inner = untag_ptr(this_ptr);
61616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61618         this_ptr_conv.is_owned = false;
61619         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
61620 }
61621
61622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61623         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61624         this_ptr_conv.inner = untag_ptr(this_ptr);
61625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61627         this_ptr_conv.is_owned = false;
61628         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
61629         return ret_conv;
61630 }
61631
61632 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) {
61633         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61634         this_ptr_conv.inner = untag_ptr(this_ptr);
61635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61637         this_ptr_conv.is_owned = false;
61638         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
61639 }
61640
61641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61642         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61643         this_ptr_conv.inner = untag_ptr(this_ptr);
61644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61646         this_ptr_conv.is_owned = false;
61647         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
61648         return ret_conv;
61649 }
61650
61651 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) {
61652         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61653         this_ptr_conv.inner = untag_ptr(this_ptr);
61654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61656         this_ptr_conv.is_owned = false;
61657         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
61658 }
61659
61660 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) {
61661         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61662         this_ptr_conv.inner = untag_ptr(this_ptr);
61663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61665         this_ptr_conv.is_owned = false;
61666         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
61667         return ret_conv;
61668 }
61669
61670 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) {
61671         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61672         this_ptr_conv.inner = untag_ptr(this_ptr);
61673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61675         this_ptr_conv.is_owned = false;
61676         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
61677 }
61678
61679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61680         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61681         this_ptr_conv.inner = untag_ptr(this_ptr);
61682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61684         this_ptr_conv.is_owned = false;
61685         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
61686         return ret_conv;
61687 }
61688
61689 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) {
61690         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61691         this_ptr_conv.inner = untag_ptr(this_ptr);
61692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61694         this_ptr_conv.is_owned = false;
61695         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
61696 }
61697
61698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
61699         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61700         this_ptr_conv.inner = untag_ptr(this_ptr);
61701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61703         this_ptr_conv.is_owned = false;
61704         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
61705         return ret_conv;
61706 }
61707
61708 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) {
61709         LDKProbabilisticScoringFeeParameters this_ptr_conv;
61710         this_ptr_conv.inner = untag_ptr(this_ptr);
61711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61713         this_ptr_conv.is_owned = false;
61714         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
61715 }
61716
61717 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
61718         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
61719         int64_t ret_ref = 0;
61720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61722         return ret_ref;
61723 }
61724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61725         LDKProbabilisticScoringFeeParameters arg_conv;
61726         arg_conv.inner = untag_ptr(arg);
61727         arg_conv.is_owned = ptr_is_owned(arg);
61728         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61729         arg_conv.is_owned = false;
61730         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
61731         return ret_conv;
61732 }
61733
61734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61735         LDKProbabilisticScoringFeeParameters orig_conv;
61736         orig_conv.inner = untag_ptr(orig);
61737         orig_conv.is_owned = ptr_is_owned(orig);
61738         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61739         orig_conv.is_owned = false;
61740         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
61741         int64_t ret_ref = 0;
61742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61744         return ret_ref;
61745 }
61746
61747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
61748         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
61749         int64_t ret_ref = 0;
61750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61752         return ret_ref;
61753 }
61754
61755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
61756         LDKProbabilisticScoringFeeParameters this_arg_conv;
61757         this_arg_conv.inner = untag_ptr(this_arg);
61758         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61760         this_arg_conv.is_owned = false;
61761         LDKNodeId node_id_conv;
61762         node_id_conv.inner = untag_ptr(node_id);
61763         node_id_conv.is_owned = ptr_is_owned(node_id);
61764         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61765         node_id_conv.is_owned = false;
61766         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
61767 }
61768
61769 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) {
61770         LDKProbabilisticScoringFeeParameters this_arg_conv;
61771         this_arg_conv.inner = untag_ptr(this_arg);
61772         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61774         this_arg_conv.is_owned = false;
61775         LDKCVec_NodeIdZ node_ids_constr;
61776         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
61777         if (node_ids_constr.datalen > 0)
61778                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
61779         else
61780                 node_ids_constr.data = NULL;
61781         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
61782         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
61783                 int64_t node_ids_conv_8 = node_ids_vals[i];
61784                 LDKNodeId node_ids_conv_8_conv;
61785                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
61786                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
61787                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
61788                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
61789                 node_ids_constr.data[i] = node_ids_conv_8_conv;
61790         }
61791         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
61792         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
61793 }
61794
61795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
61796         LDKProbabilisticScoringFeeParameters this_arg_conv;
61797         this_arg_conv.inner = untag_ptr(this_arg);
61798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61800         this_arg_conv.is_owned = false;
61801         LDKNodeId node_id_conv;
61802         node_id_conv.inner = untag_ptr(node_id);
61803         node_id_conv.is_owned = ptr_is_owned(node_id);
61804         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61805         node_id_conv.is_owned = false;
61806         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
61807 }
61808
61809 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) {
61810         LDKProbabilisticScoringFeeParameters this_arg_conv;
61811         this_arg_conv.inner = untag_ptr(this_arg);
61812         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61814         this_arg_conv.is_owned = false;
61815         LDKNodeId node_id_conv;
61816         node_id_conv.inner = untag_ptr(node_id);
61817         node_id_conv.is_owned = ptr_is_owned(node_id);
61818         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61819         node_id_conv.is_owned = false;
61820         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
61821 }
61822
61823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
61824         LDKProbabilisticScoringFeeParameters this_arg_conv;
61825         this_arg_conv.inner = untag_ptr(this_arg);
61826         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61828         this_arg_conv.is_owned = false;
61829         LDKNodeId node_id_conv;
61830         node_id_conv.inner = untag_ptr(node_id);
61831         node_id_conv.is_owned = ptr_is_owned(node_id);
61832         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
61833         node_id_conv.is_owned = false;
61834         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
61835 }
61836
61837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
61838         LDKProbabilisticScoringFeeParameters this_arg_conv;
61839         this_arg_conv.inner = untag_ptr(this_arg);
61840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61842         this_arg_conv.is_owned = false;
61843         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
61844 }
61845
61846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61847         LDKProbabilisticScoringDecayParameters this_obj_conv;
61848         this_obj_conv.inner = untag_ptr(this_obj);
61849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61851         ProbabilisticScoringDecayParameters_free(this_obj_conv);
61852 }
61853
61854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
61855         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61856         this_ptr_conv.inner = untag_ptr(this_ptr);
61857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61859         this_ptr_conv.is_owned = false;
61860         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
61861         return ret_conv;
61862 }
61863
61864 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) {
61865         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61866         this_ptr_conv.inner = untag_ptr(this_ptr);
61867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61869         this_ptr_conv.is_owned = false;
61870         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
61871 }
61872
61873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
61874         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61875         this_ptr_conv.inner = untag_ptr(this_ptr);
61876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61878         this_ptr_conv.is_owned = false;
61879         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
61880         return ret_conv;
61881 }
61882
61883 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) {
61884         LDKProbabilisticScoringDecayParameters this_ptr_conv;
61885         this_ptr_conv.inner = untag_ptr(this_ptr);
61886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61888         this_ptr_conv.is_owned = false;
61889         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
61890 }
61891
61892 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) {
61893         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
61894         int64_t ret_ref = 0;
61895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61897         return ret_ref;
61898 }
61899
61900 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
61901         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
61902         int64_t ret_ref = 0;
61903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61905         return ret_ref;
61906 }
61907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
61908         LDKProbabilisticScoringDecayParameters arg_conv;
61909         arg_conv.inner = untag_ptr(arg);
61910         arg_conv.is_owned = ptr_is_owned(arg);
61911         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61912         arg_conv.is_owned = false;
61913         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
61914         return ret_conv;
61915 }
61916
61917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
61918         LDKProbabilisticScoringDecayParameters orig_conv;
61919         orig_conv.inner = untag_ptr(orig);
61920         orig_conv.is_owned = ptr_is_owned(orig);
61921         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61922         orig_conv.is_owned = false;
61923         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
61924         int64_t ret_ref = 0;
61925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61927         return ret_ref;
61928 }
61929
61930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
61931         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
61932         int64_t ret_ref = 0;
61933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61935         return ret_ref;
61936 }
61937
61938 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) {
61939         LDKProbabilisticScoringDecayParameters decay_params_conv;
61940         decay_params_conv.inner = untag_ptr(decay_params);
61941         decay_params_conv.is_owned = ptr_is_owned(decay_params);
61942         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
61943         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
61944         LDKNetworkGraph network_graph_conv;
61945         network_graph_conv.inner = untag_ptr(network_graph);
61946         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61947         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61948         network_graph_conv.is_owned = false;
61949         void* logger_ptr = untag_ptr(logger);
61950         CHECK_ACCESS(logger_ptr);
61951         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61952         if (logger_conv.free == LDKLogger_JCalls_free) {
61953                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61954                 LDKLogger_JCalls_cloned(&logger_conv);
61955         }
61956         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
61957         int64_t ret_ref = 0;
61958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61960         return ret_ref;
61961 }
61962
61963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
61964         LDKProbabilisticScorer this_arg_conv;
61965         this_arg_conv.inner = untag_ptr(this_arg);
61966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61968         this_arg_conv.is_owned = false;
61969         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
61970 }
61971
61972 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) {
61973         LDKProbabilisticScorer this_arg_conv;
61974         this_arg_conv.inner = untag_ptr(this_arg);
61975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61977         this_arg_conv.is_owned = false;
61978         LDKNodeId target_conv;
61979         target_conv.inner = untag_ptr(target);
61980         target_conv.is_owned = ptr_is_owned(target);
61981         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
61982         target_conv.is_owned = false;
61983         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
61984         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
61985         int64_t ret_ref = tag_ptr(ret_copy, true);
61986         return ret_ref;
61987 }
61988
61989 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) {
61990         LDKProbabilisticScorer this_arg_conv;
61991         this_arg_conv.inner = untag_ptr(this_arg);
61992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61994         this_arg_conv.is_owned = false;
61995         LDKNodeId target_conv;
61996         target_conv.inner = untag_ptr(target);
61997         target_conv.is_owned = ptr_is_owned(target);
61998         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
61999         target_conv.is_owned = false;
62000         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
62001         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
62002         int64_t ret_ref = tag_ptr(ret_copy, true);
62003         return ret_ref;
62004 }
62005
62006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
62007         LDKProbabilisticScorer this_arg_conv;
62008         this_arg_conv.inner = untag_ptr(this_arg);
62009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62011         this_arg_conv.is_owned = false;
62012         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
62013         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
62014         return tag_ptr(ret_ret, true);
62015 }
62016
62017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
62018         LDKProbabilisticScorer obj_conv;
62019         obj_conv.inner = untag_ptr(obj);
62020         obj_conv.is_owned = ptr_is_owned(obj);
62021         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62022         obj_conv.is_owned = false;
62023         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
62024         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62025         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62026         CVec_u8Z_free(ret_var);
62027         return ret_arr;
62028 }
62029
62030 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) {
62031         LDKu8slice ser_ref;
62032         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62033         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62034         LDKProbabilisticScoringDecayParameters arg_a_conv;
62035         arg_a_conv.inner = untag_ptr(arg_a);
62036         arg_a_conv.is_owned = ptr_is_owned(arg_a);
62037         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
62038         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
62039         LDKNetworkGraph arg_b_conv;
62040         arg_b_conv.inner = untag_ptr(arg_b);
62041         arg_b_conv.is_owned = ptr_is_owned(arg_b);
62042         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
62043         arg_b_conv.is_owned = false;
62044         void* arg_c_ptr = untag_ptr(arg_c);
62045         CHECK_ACCESS(arg_c_ptr);
62046         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
62047         if (arg_c_conv.free == LDKLogger_JCalls_free) {
62048                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62049                 LDKLogger_JCalls_cloned(&arg_c_conv);
62050         }
62051         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
62052         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
62053         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62054         return tag_ptr(ret_conv, true);
62055 }
62056
62057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62058         LDKDelayedPaymentOutputDescriptor this_obj_conv;
62059         this_obj_conv.inner = untag_ptr(this_obj);
62060         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62062         DelayedPaymentOutputDescriptor_free(this_obj_conv);
62063 }
62064
62065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
62066         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62067         this_ptr_conv.inner = untag_ptr(this_ptr);
62068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62070         this_ptr_conv.is_owned = false;
62071         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
62072         int64_t ret_ref = 0;
62073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62075         return ret_ref;
62076 }
62077
62078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62079         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62080         this_ptr_conv.inner = untag_ptr(this_ptr);
62081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62083         this_ptr_conv.is_owned = false;
62084         LDKOutPoint val_conv;
62085         val_conv.inner = untag_ptr(val);
62086         val_conv.is_owned = ptr_is_owned(val);
62087         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62088         val_conv = OutPoint_clone(&val_conv);
62089         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
62090 }
62091
62092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
62093         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62094         this_ptr_conv.inner = untag_ptr(this_ptr);
62095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62097         this_ptr_conv.is_owned = false;
62098         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62099         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
62100         return ret_arr;
62101 }
62102
62103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62104         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62105         this_ptr_conv.inner = untag_ptr(this_ptr);
62106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62108         this_ptr_conv.is_owned = false;
62109         LDKPublicKey val_ref;
62110         CHECK((*env)->GetArrayLength(env, val) == 33);
62111         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62112         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
62113 }
62114
62115 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
62116         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62117         this_ptr_conv.inner = untag_ptr(this_ptr);
62118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62120         this_ptr_conv.is_owned = false;
62121         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
62122         return ret_conv;
62123 }
62124
62125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
62126         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62127         this_ptr_conv.inner = untag_ptr(this_ptr);
62128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62130         this_ptr_conv.is_owned = false;
62131         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
62132 }
62133
62134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
62135         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62136         this_ptr_conv.inner = untag_ptr(this_ptr);
62137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62139         this_ptr_conv.is_owned = false;
62140         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
62141         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
62142         return tag_ptr(ret_ref, true);
62143 }
62144
62145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62146         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62147         this_ptr_conv.inner = untag_ptr(this_ptr);
62148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62150         this_ptr_conv.is_owned = false;
62151         void* val_ptr = untag_ptr(val);
62152         CHECK_ACCESS(val_ptr);
62153         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
62154         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
62155         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
62156 }
62157
62158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
62159         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62160         this_ptr_conv.inner = untag_ptr(this_ptr);
62161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62163         this_ptr_conv.is_owned = false;
62164         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62165         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
62166         return ret_arr;
62167 }
62168
62169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62170         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62171         this_ptr_conv.inner = untag_ptr(this_ptr);
62172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62174         this_ptr_conv.is_owned = false;
62175         LDKPublicKey val_ref;
62176         CHECK((*env)->GetArrayLength(env, val) == 33);
62177         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62178         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
62179 }
62180
62181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
62182         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62183         this_ptr_conv.inner = untag_ptr(this_ptr);
62184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62186         this_ptr_conv.is_owned = false;
62187         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62188         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
62189         return ret_arr;
62190 }
62191
62192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62193         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62194         this_ptr_conv.inner = untag_ptr(this_ptr);
62195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62197         this_ptr_conv.is_owned = false;
62198         LDKThirtyTwoBytes val_ref;
62199         CHECK((*env)->GetArrayLength(env, val) == 32);
62200         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
62201         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
62202 }
62203
62204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
62205         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62206         this_ptr_conv.inner = untag_ptr(this_ptr);
62207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62209         this_ptr_conv.is_owned = false;
62210         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
62211         return ret_conv;
62212 }
62213
62214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62215         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
62216         this_ptr_conv.inner = untag_ptr(this_ptr);
62217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62219         this_ptr_conv.is_owned = false;
62220         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
62221 }
62222
62223 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) {
62224         LDKOutPoint outpoint_arg_conv;
62225         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
62226         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
62227         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
62228         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
62229         LDKPublicKey per_commitment_point_arg_ref;
62230         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
62231         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
62232         void* output_arg_ptr = untag_ptr(output_arg);
62233         CHECK_ACCESS(output_arg_ptr);
62234         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
62235         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
62236         LDKPublicKey revocation_pubkey_arg_ref;
62237         CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
62238         (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
62239         LDKThirtyTwoBytes channel_keys_id_arg_ref;
62240         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
62241         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
62242         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);
62243         int64_t ret_ref = 0;
62244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62246         return ret_ref;
62247 }
62248
62249 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
62250         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
62251         int64_t ret_ref = 0;
62252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62254         return ret_ref;
62255 }
62256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62257         LDKDelayedPaymentOutputDescriptor arg_conv;
62258         arg_conv.inner = untag_ptr(arg);
62259         arg_conv.is_owned = ptr_is_owned(arg);
62260         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62261         arg_conv.is_owned = false;
62262         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
62263         return ret_conv;
62264 }
62265
62266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62267         LDKDelayedPaymentOutputDescriptor orig_conv;
62268         orig_conv.inner = untag_ptr(orig);
62269         orig_conv.is_owned = ptr_is_owned(orig);
62270         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62271         orig_conv.is_owned = false;
62272         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
62273         int64_t ret_ref = 0;
62274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62276         return ret_ref;
62277 }
62278
62279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62280         LDKDelayedPaymentOutputDescriptor a_conv;
62281         a_conv.inner = untag_ptr(a);
62282         a_conv.is_owned = ptr_is_owned(a);
62283         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62284         a_conv.is_owned = false;
62285         LDKDelayedPaymentOutputDescriptor b_conv;
62286         b_conv.inner = untag_ptr(b);
62287         b_conv.is_owned = ptr_is_owned(b);
62288         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62289         b_conv.is_owned = false;
62290         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
62291         return ret_conv;
62292 }
62293
62294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
62295         LDKDelayedPaymentOutputDescriptor obj_conv;
62296         obj_conv.inner = untag_ptr(obj);
62297         obj_conv.is_owned = ptr_is_owned(obj);
62298         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62299         obj_conv.is_owned = false;
62300         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
62301         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62302         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62303         CVec_u8Z_free(ret_var);
62304         return ret_arr;
62305 }
62306
62307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62308         LDKu8slice ser_ref;
62309         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62310         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62311         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
62312         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
62313         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62314         return tag_ptr(ret_conv, true);
62315 }
62316
62317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62318         LDKStaticPaymentOutputDescriptor this_obj_conv;
62319         this_obj_conv.inner = untag_ptr(this_obj);
62320         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62322         StaticPaymentOutputDescriptor_free(this_obj_conv);
62323 }
62324
62325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
62326         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62327         this_ptr_conv.inner = untag_ptr(this_ptr);
62328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62330         this_ptr_conv.is_owned = false;
62331         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
62332         int64_t ret_ref = 0;
62333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62335         return ret_ref;
62336 }
62337
62338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62339         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62340         this_ptr_conv.inner = untag_ptr(this_ptr);
62341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62343         this_ptr_conv.is_owned = false;
62344         LDKOutPoint val_conv;
62345         val_conv.inner = untag_ptr(val);
62346         val_conv.is_owned = ptr_is_owned(val);
62347         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62348         val_conv = OutPoint_clone(&val_conv);
62349         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
62350 }
62351
62352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
62353         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62354         this_ptr_conv.inner = untag_ptr(this_ptr);
62355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62357         this_ptr_conv.is_owned = false;
62358         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
62359         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
62360         return tag_ptr(ret_ref, true);
62361 }
62362
62363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62364         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62365         this_ptr_conv.inner = untag_ptr(this_ptr);
62366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62368         this_ptr_conv.is_owned = false;
62369         void* val_ptr = untag_ptr(val);
62370         CHECK_ACCESS(val_ptr);
62371         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
62372         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
62373         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
62374 }
62375
62376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
62377         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62378         this_ptr_conv.inner = untag_ptr(this_ptr);
62379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62381         this_ptr_conv.is_owned = false;
62382         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62383         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
62384         return ret_arr;
62385 }
62386
62387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62388         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62389         this_ptr_conv.inner = untag_ptr(this_ptr);
62390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62392         this_ptr_conv.is_owned = false;
62393         LDKThirtyTwoBytes val_ref;
62394         CHECK((*env)->GetArrayLength(env, val) == 32);
62395         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
62396         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
62397 }
62398
62399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
62400         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62401         this_ptr_conv.inner = untag_ptr(this_ptr);
62402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62404         this_ptr_conv.is_owned = false;
62405         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
62406         return ret_conv;
62407 }
62408
62409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62410         LDKStaticPaymentOutputDescriptor this_ptr_conv;
62411         this_ptr_conv.inner = untag_ptr(this_ptr);
62412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62414         this_ptr_conv.is_owned = false;
62415         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
62416 }
62417
62418 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) {
62419         LDKOutPoint outpoint_arg_conv;
62420         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
62421         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
62422         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
62423         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
62424         void* output_arg_ptr = untag_ptr(output_arg);
62425         CHECK_ACCESS(output_arg_ptr);
62426         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
62427         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
62428         LDKThirtyTwoBytes channel_keys_id_arg_ref;
62429         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
62430         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
62431         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
62432         int64_t ret_ref = 0;
62433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62435         return ret_ref;
62436 }
62437
62438 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
62439         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
62440         int64_t ret_ref = 0;
62441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62443         return ret_ref;
62444 }
62445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62446         LDKStaticPaymentOutputDescriptor arg_conv;
62447         arg_conv.inner = untag_ptr(arg);
62448         arg_conv.is_owned = ptr_is_owned(arg);
62449         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62450         arg_conv.is_owned = false;
62451         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
62452         return ret_conv;
62453 }
62454
62455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62456         LDKStaticPaymentOutputDescriptor orig_conv;
62457         orig_conv.inner = untag_ptr(orig);
62458         orig_conv.is_owned = ptr_is_owned(orig);
62459         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62460         orig_conv.is_owned = false;
62461         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
62462         int64_t ret_ref = 0;
62463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62465         return ret_ref;
62466 }
62467
62468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62469         LDKStaticPaymentOutputDescriptor a_conv;
62470         a_conv.inner = untag_ptr(a);
62471         a_conv.is_owned = ptr_is_owned(a);
62472         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62473         a_conv.is_owned = false;
62474         LDKStaticPaymentOutputDescriptor b_conv;
62475         b_conv.inner = untag_ptr(b);
62476         b_conv.is_owned = ptr_is_owned(b);
62477         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62478         b_conv.is_owned = false;
62479         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
62480         return ret_conv;
62481 }
62482
62483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
62484         LDKStaticPaymentOutputDescriptor obj_conv;
62485         obj_conv.inner = untag_ptr(obj);
62486         obj_conv.is_owned = ptr_is_owned(obj);
62487         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62488         obj_conv.is_owned = false;
62489         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
62490         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62491         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62492         CVec_u8Z_free(ret_var);
62493         return ret_arr;
62494 }
62495
62496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62497         LDKu8slice ser_ref;
62498         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62499         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62500         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
62501         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
62502         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62503         return tag_ptr(ret_conv, true);
62504 }
62505
62506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62507         if (!ptr_is_owned(this_ptr)) return;
62508         void* this_ptr_ptr = untag_ptr(this_ptr);
62509         CHECK_ACCESS(this_ptr_ptr);
62510         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
62511         FREE(untag_ptr(this_ptr));
62512         SpendableOutputDescriptor_free(this_ptr_conv);
62513 }
62514
62515 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
62516         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62517         *ret_copy = SpendableOutputDescriptor_clone(arg);
62518         int64_t ret_ref = tag_ptr(ret_copy, true);
62519         return ret_ref;
62520 }
62521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62522         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
62523         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
62524         return ret_conv;
62525 }
62526
62527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62528         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
62529         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62530         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
62531         int64_t ret_ref = tag_ptr(ret_copy, true);
62532         return ret_ref;
62533 }
62534
62535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
62536         LDKOutPoint outpoint_conv;
62537         outpoint_conv.inner = untag_ptr(outpoint);
62538         outpoint_conv.is_owned = ptr_is_owned(outpoint);
62539         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
62540         outpoint_conv = OutPoint_clone(&outpoint_conv);
62541         void* output_ptr = untag_ptr(output);
62542         CHECK_ACCESS(output_ptr);
62543         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
62544         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
62545         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62546         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
62547         int64_t ret_ref = tag_ptr(ret_copy, true);
62548         return ret_ref;
62549 }
62550
62551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
62552         LDKDelayedPaymentOutputDescriptor a_conv;
62553         a_conv.inner = untag_ptr(a);
62554         a_conv.is_owned = ptr_is_owned(a);
62555         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62556         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
62557         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62558         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
62559         int64_t ret_ref = tag_ptr(ret_copy, true);
62560         return ret_ref;
62561 }
62562
62563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
62564         LDKStaticPaymentOutputDescriptor a_conv;
62565         a_conv.inner = untag_ptr(a);
62566         a_conv.is_owned = ptr_is_owned(a);
62567         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62568         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
62569         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
62570         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
62571         int64_t ret_ref = tag_ptr(ret_copy, true);
62572         return ret_ref;
62573 }
62574
62575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62576         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
62577         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
62578         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
62579         return ret_conv;
62580 }
62581
62582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
62583         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
62584         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
62585         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62586         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62587         CVec_u8Z_free(ret_var);
62588         return ret_arr;
62589 }
62590
62591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62592         LDKu8slice ser_ref;
62593         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62594         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62595         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
62596         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
62597         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62598         return tag_ptr(ret_conv, true);
62599 }
62600
62601 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) {
62602         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
62603         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
62604         if (descriptors_constr.datalen > 0)
62605                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
62606         else
62607                 descriptors_constr.data = NULL;
62608         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
62609         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
62610                 int64_t descriptors_conv_27 = descriptors_vals[b];
62611                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
62612                 CHECK_ACCESS(descriptors_conv_27_ptr);
62613                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
62614                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
62615                 descriptors_constr.data[b] = descriptors_conv_27_conv;
62616         }
62617         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
62618         LDKCVec_TxOutZ outputs_constr;
62619         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
62620         if (outputs_constr.datalen > 0)
62621                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
62622         else
62623                 outputs_constr.data = NULL;
62624         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
62625         for (size_t h = 0; h < outputs_constr.datalen; h++) {
62626                 int64_t outputs_conv_7 = outputs_vals[h];
62627                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
62628                 CHECK_ACCESS(outputs_conv_7_ptr);
62629                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
62630                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
62631                 outputs_constr.data[h] = outputs_conv_7_conv;
62632         }
62633         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
62634         LDKCVec_u8Z change_destination_script_ref;
62635         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
62636         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
62637         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
62638         void* locktime_ptr = untag_ptr(locktime);
62639         CHECK_ACCESS(locktime_ptr);
62640         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
62641         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
62642         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
62643         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
62644         return tag_ptr(ret_conv, true);
62645 }
62646
62647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62648         if (!ptr_is_owned(this_ptr)) return;
62649         void* this_ptr_ptr = untag_ptr(this_ptr);
62650         CHECK_ACCESS(this_ptr_ptr);
62651         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
62652         FREE(untag_ptr(this_ptr));
62653         ChannelSigner_free(this_ptr_conv);
62654 }
62655
62656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62657         if (!ptr_is_owned(this_ptr)) return;
62658         void* this_ptr_ptr = untag_ptr(this_ptr);
62659         CHECK_ACCESS(this_ptr_ptr);
62660         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
62661         FREE(untag_ptr(this_ptr));
62662         EcdsaChannelSigner_free(this_ptr_conv);
62663 }
62664
62665 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
62666         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62667         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
62668         return tag_ptr(ret_ret, true);
62669 }
62670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62671         void* arg_ptr = untag_ptr(arg);
62672         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
62673         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
62674         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
62675         return ret_conv;
62676 }
62677
62678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62679         void* orig_ptr = untag_ptr(orig);
62680         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
62681         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
62682         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
62683         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
62684         return tag_ptr(ret_ret, true);
62685 }
62686
62687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62688         if (!ptr_is_owned(this_ptr)) return;
62689         void* this_ptr_ptr = untag_ptr(this_ptr);
62690         CHECK_ACCESS(this_ptr_ptr);
62691         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
62692         FREE(untag_ptr(this_ptr));
62693         WriteableEcdsaChannelSigner_free(this_ptr_conv);
62694 }
62695
62696 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62697         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
62698         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
62699         return ret_conv;
62700 }
62701
62702 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
62703         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
62704         return ret_conv;
62705 }
62706
62707 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
62708         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
62709         return ret_conv;
62710 }
62711
62712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62713         if (!ptr_is_owned(this_ptr)) return;
62714         void* this_ptr_ptr = untag_ptr(this_ptr);
62715         CHECK_ACCESS(this_ptr_ptr);
62716         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
62717         FREE(untag_ptr(this_ptr));
62718         EntropySource_free(this_ptr_conv);
62719 }
62720
62721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62722         if (!ptr_is_owned(this_ptr)) return;
62723         void* this_ptr_ptr = untag_ptr(this_ptr);
62724         CHECK_ACCESS(this_ptr_ptr);
62725         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
62726         FREE(untag_ptr(this_ptr));
62727         NodeSigner_free(this_ptr_conv);
62728 }
62729
62730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62731         if (!ptr_is_owned(this_ptr)) return;
62732         void* this_ptr_ptr = untag_ptr(this_ptr);
62733         CHECK_ACCESS(this_ptr_ptr);
62734         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
62735         FREE(untag_ptr(this_ptr));
62736         SignerProvider_free(this_ptr_conv);
62737 }
62738
62739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62740         LDKInMemorySigner this_obj_conv;
62741         this_obj_conv.inner = untag_ptr(this_obj);
62742         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62744         InMemorySigner_free(this_obj_conv);
62745 }
62746
62747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62748         LDKInMemorySigner this_ptr_conv;
62749         this_ptr_conv.inner = untag_ptr(this_ptr);
62750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62752         this_ptr_conv.is_owned = false;
62753         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62754         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
62755         return ret_arr;
62756 }
62757
62758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62759         LDKInMemorySigner this_ptr_conv;
62760         this_ptr_conv.inner = untag_ptr(this_ptr);
62761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62763         this_ptr_conv.is_owned = false;
62764         LDKSecretKey val_ref;
62765         CHECK((*env)->GetArrayLength(env, val) == 32);
62766         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62767         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
62768 }
62769
62770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62771         LDKInMemorySigner this_ptr_conv;
62772         this_ptr_conv.inner = untag_ptr(this_ptr);
62773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62775         this_ptr_conv.is_owned = false;
62776         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62777         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
62778         return ret_arr;
62779 }
62780
62781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62782         LDKInMemorySigner this_ptr_conv;
62783         this_ptr_conv.inner = untag_ptr(this_ptr);
62784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62786         this_ptr_conv.is_owned = false;
62787         LDKSecretKey val_ref;
62788         CHECK((*env)->GetArrayLength(env, val) == 32);
62789         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62790         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
62791 }
62792
62793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62794         LDKInMemorySigner this_ptr_conv;
62795         this_ptr_conv.inner = untag_ptr(this_ptr);
62796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62798         this_ptr_conv.is_owned = false;
62799         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62800         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
62801         return ret_arr;
62802 }
62803
62804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62805         LDKInMemorySigner this_ptr_conv;
62806         this_ptr_conv.inner = untag_ptr(this_ptr);
62807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62809         this_ptr_conv.is_owned = false;
62810         LDKSecretKey val_ref;
62811         CHECK((*env)->GetArrayLength(env, val) == 32);
62812         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62813         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
62814 }
62815
62816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62817         LDKInMemorySigner this_ptr_conv;
62818         this_ptr_conv.inner = untag_ptr(this_ptr);
62819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62821         this_ptr_conv.is_owned = false;
62822         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62823         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
62824         return ret_arr;
62825 }
62826
62827 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) {
62828         LDKInMemorySigner this_ptr_conv;
62829         this_ptr_conv.inner = untag_ptr(this_ptr);
62830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62832         this_ptr_conv.is_owned = false;
62833         LDKSecretKey val_ref;
62834         CHECK((*env)->GetArrayLength(env, val) == 32);
62835         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62836         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
62837 }
62838
62839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62840         LDKInMemorySigner this_ptr_conv;
62841         this_ptr_conv.inner = untag_ptr(this_ptr);
62842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62844         this_ptr_conv.is_owned = false;
62845         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62846         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
62847         return ret_arr;
62848 }
62849
62850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62851         LDKInMemorySigner this_ptr_conv;
62852         this_ptr_conv.inner = untag_ptr(this_ptr);
62853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62855         this_ptr_conv.is_owned = false;
62856         LDKSecretKey val_ref;
62857         CHECK((*env)->GetArrayLength(env, val) == 32);
62858         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
62859         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
62860 }
62861
62862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
62863         LDKInMemorySigner this_ptr_conv;
62864         this_ptr_conv.inner = untag_ptr(this_ptr);
62865         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62867         this_ptr_conv.is_owned = false;
62868         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62869         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
62870         return ret_arr;
62871 }
62872
62873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62874         LDKInMemorySigner this_ptr_conv;
62875         this_ptr_conv.inner = untag_ptr(this_ptr);
62876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62878         this_ptr_conv.is_owned = false;
62879         LDKThirtyTwoBytes val_ref;
62880         CHECK((*env)->GetArrayLength(env, val) == 32);
62881         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
62882         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
62883 }
62884
62885 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
62886         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
62887         int64_t ret_ref = 0;
62888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62890         return ret_ref;
62891 }
62892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62893         LDKInMemorySigner arg_conv;
62894         arg_conv.inner = untag_ptr(arg);
62895         arg_conv.is_owned = ptr_is_owned(arg);
62896         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62897         arg_conv.is_owned = false;
62898         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
62899         return ret_conv;
62900 }
62901
62902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62903         LDKInMemorySigner orig_conv;
62904         orig_conv.inner = untag_ptr(orig);
62905         orig_conv.is_owned = ptr_is_owned(orig);
62906         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62907         orig_conv.is_owned = false;
62908         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
62909         int64_t ret_ref = 0;
62910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62912         return ret_ref;
62913 }
62914
62915 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) {
62916         LDKSecretKey funding_key_ref;
62917         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
62918         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
62919         LDKSecretKey revocation_base_key_ref;
62920         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
62921         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
62922         LDKSecretKey payment_key_ref;
62923         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
62924         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
62925         LDKSecretKey delayed_payment_base_key_ref;
62926         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
62927         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
62928         LDKSecretKey htlc_base_key_ref;
62929         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
62930         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
62931         LDKThirtyTwoBytes commitment_seed_ref;
62932         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
62933         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
62934         LDKThirtyTwoBytes channel_keys_id_ref;
62935         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
62936         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
62937         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
62938         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
62939         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
62940         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);
62941         int64_t ret_ref = 0;
62942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62944         return ret_ref;
62945 }
62946
62947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
62948         LDKInMemorySigner this_arg_conv;
62949         this_arg_conv.inner = untag_ptr(this_arg);
62950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62952         this_arg_conv.is_owned = false;
62953         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
62954         int64_t ret_ref = 0;
62955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62957         return ret_ref;
62958 }
62959
62960 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
62961         LDKInMemorySigner this_arg_conv;
62962         this_arg_conv.inner = untag_ptr(this_arg);
62963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62965         this_arg_conv.is_owned = false;
62966         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
62967         return ret_conv;
62968 }
62969
62970 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
62971         LDKInMemorySigner this_arg_conv;
62972         this_arg_conv.inner = untag_ptr(this_arg);
62973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62975         this_arg_conv.is_owned = false;
62976         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
62977         return ret_conv;
62978 }
62979
62980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
62981         LDKInMemorySigner this_arg_conv;
62982         this_arg_conv.inner = untag_ptr(this_arg);
62983         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62985         this_arg_conv.is_owned = false;
62986         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
62987         return ret_conv;
62988 }
62989
62990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
62991         LDKInMemorySigner this_arg_conv;
62992         this_arg_conv.inner = untag_ptr(this_arg);
62993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62995         this_arg_conv.is_owned = false;
62996         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
62997         int64_t ret_ref = 0;
62998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63000         return ret_ref;
63001 }
63002
63003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
63004         LDKInMemorySigner this_arg_conv;
63005         this_arg_conv.inner = untag_ptr(this_arg);
63006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63008         this_arg_conv.is_owned = false;
63009         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
63010         int64_t ret_ref = 0;
63011         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63012         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63013         return ret_ref;
63014 }
63015
63016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
63017         LDKInMemorySigner this_arg_conv;
63018         this_arg_conv.inner = untag_ptr(this_arg);
63019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63021         this_arg_conv.is_owned = false;
63022         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
63023         int64_t ret_ref = 0;
63024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63026         return ret_ref;
63027 }
63028
63029 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) {
63030         LDKInMemorySigner this_arg_conv;
63031         this_arg_conv.inner = untag_ptr(this_arg);
63032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63034         this_arg_conv.is_owned = false;
63035         LDKTransaction spend_tx_ref;
63036         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
63037         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
63038         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
63039         spend_tx_ref.data_is_owned = true;
63040         LDKStaticPaymentOutputDescriptor descriptor_conv;
63041         descriptor_conv.inner = untag_ptr(descriptor);
63042         descriptor_conv.is_owned = ptr_is_owned(descriptor);
63043         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
63044         descriptor_conv.is_owned = false;
63045         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
63046         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
63047         return tag_ptr(ret_conv, true);
63048 }
63049
63050 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) {
63051         LDKInMemorySigner this_arg_conv;
63052         this_arg_conv.inner = untag_ptr(this_arg);
63053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63055         this_arg_conv.is_owned = false;
63056         LDKTransaction spend_tx_ref;
63057         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
63058         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
63059         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
63060         spend_tx_ref.data_is_owned = true;
63061         LDKDelayedPaymentOutputDescriptor descriptor_conv;
63062         descriptor_conv.inner = untag_ptr(descriptor);
63063         descriptor_conv.is_owned = ptr_is_owned(descriptor);
63064         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
63065         descriptor_conv.is_owned = false;
63066         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
63067         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
63068         return tag_ptr(ret_conv, true);
63069 }
63070
63071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
63072         LDKInMemorySigner this_arg_conv;
63073         this_arg_conv.inner = untag_ptr(this_arg);
63074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63076         this_arg_conv.is_owned = false;
63077         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63078         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
63079         return tag_ptr(ret_ret, true);
63080 }
63081
63082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63083         LDKInMemorySigner this_arg_conv;
63084         this_arg_conv.inner = untag_ptr(this_arg);
63085         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63087         this_arg_conv.is_owned = false;
63088         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
63089         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
63090         return tag_ptr(ret_ret, true);
63091 }
63092
63093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63094         LDKInMemorySigner this_arg_conv;
63095         this_arg_conv.inner = untag_ptr(this_arg);
63096         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63098         this_arg_conv.is_owned = false;
63099         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
63100         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
63101         return tag_ptr(ret_ret, true);
63102 }
63103
63104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63105         LDKInMemorySigner this_arg_conv;
63106         this_arg_conv.inner = untag_ptr(this_arg);
63107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63109         this_arg_conv.is_owned = false;
63110         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
63111         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
63112         return tag_ptr(ret_ret, true);
63113 }
63114
63115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
63116         LDKInMemorySigner obj_conv;
63117         obj_conv.inner = untag_ptr(obj);
63118         obj_conv.is_owned = ptr_is_owned(obj);
63119         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63120         obj_conv.is_owned = false;
63121         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
63122         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63123         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63124         CVec_u8Z_free(ret_var);
63125         return ret_arr;
63126 }
63127
63128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
63129         LDKu8slice ser_ref;
63130         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63131         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63132         void* arg_ptr = untag_ptr(arg);
63133         CHECK_ACCESS(arg_ptr);
63134         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
63135         if (arg_conv.free == LDKEntropySource_JCalls_free) {
63136                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63137                 LDKEntropySource_JCalls_cloned(&arg_conv);
63138         }
63139         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
63140         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
63141         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63142         return tag_ptr(ret_conv, true);
63143 }
63144
63145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63146         LDKKeysManager this_obj_conv;
63147         this_obj_conv.inner = untag_ptr(this_obj);
63148         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63150         KeysManager_free(this_obj_conv);
63151 }
63152
63153 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) {
63154         uint8_t seed_arr[32];
63155         CHECK((*env)->GetArrayLength(env, seed) == 32);
63156         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
63157         uint8_t (*seed_ref)[32] = &seed_arr;
63158         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
63159         int64_t ret_ref = 0;
63160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63162         return ret_ref;
63163 }
63164
63165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
63166         LDKKeysManager this_arg_conv;
63167         this_arg_conv.inner = untag_ptr(this_arg);
63168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63170         this_arg_conv.is_owned = false;
63171         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63172         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
63173         return ret_arr;
63174 }
63175
63176 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) {
63177         LDKKeysManager this_arg_conv;
63178         this_arg_conv.inner = untag_ptr(this_arg);
63179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63181         this_arg_conv.is_owned = false;
63182         uint8_t params_arr[32];
63183         CHECK((*env)->GetArrayLength(env, params) == 32);
63184         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
63185         uint8_t (*params_ref)[32] = &params_arr;
63186         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
63187         int64_t ret_ref = 0;
63188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63190         return ret_ref;
63191 }
63192
63193 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) {
63194         LDKKeysManager this_arg_conv;
63195         this_arg_conv.inner = untag_ptr(this_arg);
63196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63198         this_arg_conv.is_owned = false;
63199         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63200         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
63201         if (descriptors_constr.datalen > 0)
63202                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63203         else
63204                 descriptors_constr.data = NULL;
63205         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
63206         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63207                 int64_t descriptors_conv_27 = descriptors_vals[b];
63208                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63209                 CHECK_ACCESS(descriptors_conv_27_ptr);
63210                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63211                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63212                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63213         }
63214         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
63215         LDKCVec_u8Z psbt_ref;
63216         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
63217         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
63218         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
63219         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
63220         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
63221         return tag_ptr(ret_conv, true);
63222 }
63223
63224 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) {
63225         LDKKeysManager this_arg_conv;
63226         this_arg_conv.inner = untag_ptr(this_arg);
63227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63229         this_arg_conv.is_owned = false;
63230         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63231         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
63232         if (descriptors_constr.datalen > 0)
63233                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63234         else
63235                 descriptors_constr.data = NULL;
63236         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
63237         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63238                 int64_t descriptors_conv_27 = descriptors_vals[b];
63239                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63240                 CHECK_ACCESS(descriptors_conv_27_ptr);
63241                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63242                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63243                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63244         }
63245         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
63246         LDKCVec_TxOutZ outputs_constr;
63247         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
63248         if (outputs_constr.datalen > 0)
63249                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
63250         else
63251                 outputs_constr.data = NULL;
63252         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
63253         for (size_t h = 0; h < outputs_constr.datalen; h++) {
63254                 int64_t outputs_conv_7 = outputs_vals[h];
63255                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
63256                 CHECK_ACCESS(outputs_conv_7_ptr);
63257                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
63258                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
63259                 outputs_constr.data[h] = outputs_conv_7_conv;
63260         }
63261         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
63262         LDKCVec_u8Z change_destination_script_ref;
63263         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
63264         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
63265         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
63266         void* locktime_ptr = untag_ptr(locktime);
63267         CHECK_ACCESS(locktime_ptr);
63268         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
63269         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
63270         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
63271         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
63272         return tag_ptr(ret_conv, true);
63273 }
63274
63275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
63276         LDKKeysManager this_arg_conv;
63277         this_arg_conv.inner = untag_ptr(this_arg);
63278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63280         this_arg_conv.is_owned = false;
63281         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63282         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
63283         return tag_ptr(ret_ret, true);
63284 }
63285
63286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63287         LDKKeysManager this_arg_conv;
63288         this_arg_conv.inner = untag_ptr(this_arg);
63289         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63291         this_arg_conv.is_owned = false;
63292         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
63293         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
63294         return tag_ptr(ret_ret, true);
63295 }
63296
63297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
63298         LDKKeysManager this_arg_conv;
63299         this_arg_conv.inner = untag_ptr(this_arg);
63300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63302         this_arg_conv.is_owned = false;
63303         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
63304         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
63305         return tag_ptr(ret_ret, true);
63306 }
63307
63308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63309         LDKPhantomKeysManager this_obj_conv;
63310         this_obj_conv.inner = untag_ptr(this_obj);
63311         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63313         PhantomKeysManager_free(this_obj_conv);
63314 }
63315
63316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
63317         LDKPhantomKeysManager this_arg_conv;
63318         this_arg_conv.inner = untag_ptr(this_arg);
63319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63321         this_arg_conv.is_owned = false;
63322         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
63323         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
63324         return tag_ptr(ret_ret, true);
63325 }
63326
63327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
63328         LDKPhantomKeysManager this_arg_conv;
63329         this_arg_conv.inner = untag_ptr(this_arg);
63330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63332         this_arg_conv.is_owned = false;
63333         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
63334         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
63335         return tag_ptr(ret_ret, true);
63336 }
63337
63338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
63339         LDKPhantomKeysManager this_arg_conv;
63340         this_arg_conv.inner = untag_ptr(this_arg);
63341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63343         this_arg_conv.is_owned = false;
63344         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
63345         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
63346         return tag_ptr(ret_ret, true);
63347 }
63348
63349 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) {
63350         uint8_t seed_arr[32];
63351         CHECK((*env)->GetArrayLength(env, seed) == 32);
63352         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
63353         uint8_t (*seed_ref)[32] = &seed_arr;
63354         uint8_t cross_node_seed_arr[32];
63355         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
63356         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
63357         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
63358         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
63359         int64_t ret_ref = 0;
63360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63362         return ret_ref;
63363 }
63364
63365 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) {
63366         LDKPhantomKeysManager this_arg_conv;
63367         this_arg_conv.inner = untag_ptr(this_arg);
63368         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63370         this_arg_conv.is_owned = false;
63371         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
63372         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
63373         if (descriptors_constr.datalen > 0)
63374                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
63375         else
63376                 descriptors_constr.data = NULL;
63377         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
63378         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
63379                 int64_t descriptors_conv_27 = descriptors_vals[b];
63380                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
63381                 CHECK_ACCESS(descriptors_conv_27_ptr);
63382                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
63383                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
63384                 descriptors_constr.data[b] = descriptors_conv_27_conv;
63385         }
63386         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
63387         LDKCVec_TxOutZ outputs_constr;
63388         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
63389         if (outputs_constr.datalen > 0)
63390                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
63391         else
63392                 outputs_constr.data = NULL;
63393         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
63394         for (size_t h = 0; h < outputs_constr.datalen; h++) {
63395                 int64_t outputs_conv_7 = outputs_vals[h];
63396                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
63397                 CHECK_ACCESS(outputs_conv_7_ptr);
63398                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
63399                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
63400                 outputs_constr.data[h] = outputs_conv_7_conv;
63401         }
63402         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
63403         LDKCVec_u8Z change_destination_script_ref;
63404         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
63405         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
63406         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
63407         void* locktime_ptr = untag_ptr(locktime);
63408         CHECK_ACCESS(locktime_ptr);
63409         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
63410         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
63411         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
63412         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
63413         return tag_ptr(ret_conv, true);
63414 }
63415
63416 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) {
63417         LDKPhantomKeysManager this_arg_conv;
63418         this_arg_conv.inner = untag_ptr(this_arg);
63419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63421         this_arg_conv.is_owned = false;
63422         uint8_t params_arr[32];
63423         CHECK((*env)->GetArrayLength(env, params) == 32);
63424         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
63425         uint8_t (*params_ref)[32] = &params_arr;
63426         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
63427         int64_t ret_ref = 0;
63428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63430         return ret_ref;
63431 }
63432
63433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
63434         LDKPhantomKeysManager this_arg_conv;
63435         this_arg_conv.inner = untag_ptr(this_arg);
63436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63438         this_arg_conv.is_owned = false;
63439         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63440         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
63441         return ret_arr;
63442 }
63443
63444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
63445         LDKPhantomKeysManager this_arg_conv;
63446         this_arg_conv.inner = untag_ptr(this_arg);
63447         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63449         this_arg_conv.is_owned = false;
63450         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63451         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
63452         return ret_arr;
63453 }
63454
63455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63456         LDKOnionMessenger this_obj_conv;
63457         this_obj_conv.inner = untag_ptr(this_obj);
63458         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63460         OnionMessenger_free(this_obj_conv);
63461 }
63462
63463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63464         if (!ptr_is_owned(this_ptr)) return;
63465         void* this_ptr_ptr = untag_ptr(this_ptr);
63466         CHECK_ACCESS(this_ptr_ptr);
63467         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
63468         FREE(untag_ptr(this_ptr));
63469         MessageRouter_free(this_ptr_conv);
63470 }
63471
63472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63473         LDKDefaultMessageRouter this_obj_conv;
63474         this_obj_conv.inner = untag_ptr(this_obj);
63475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63477         DefaultMessageRouter_free(this_obj_conv);
63478 }
63479
63480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz) {
63481         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
63482         int64_t ret_ref = 0;
63483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63485         return ret_ref;
63486 }
63487
63488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
63489         LDKDefaultMessageRouter this_arg_conv;
63490         this_arg_conv.inner = untag_ptr(this_arg);
63491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63493         this_arg_conv.is_owned = false;
63494         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
63495         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
63496         return tag_ptr(ret_ret, true);
63497 }
63498
63499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63500         LDKOnionMessagePath this_obj_conv;
63501         this_obj_conv.inner = untag_ptr(this_obj);
63502         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63504         OnionMessagePath_free(this_obj_conv);
63505 }
63506
63507 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
63508         LDKOnionMessagePath this_ptr_conv;
63509         this_ptr_conv.inner = untag_ptr(this_ptr);
63510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63512         this_ptr_conv.is_owned = false;
63513         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
63514         jobjectArray ret_arr = NULL;
63515         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
63516         ;
63517         for (size_t i = 0; i < ret_var.datalen; i++) {
63518                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
63519                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
63520                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
63521         }
63522         
63523         FREE(ret_var.data);
63524         return ret_arr;
63525 }
63526
63527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
63528         LDKOnionMessagePath this_ptr_conv;
63529         this_ptr_conv.inner = untag_ptr(this_ptr);
63530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63532         this_ptr_conv.is_owned = false;
63533         LDKCVec_PublicKeyZ val_constr;
63534         val_constr.datalen = (*env)->GetArrayLength(env, val);
63535         if (val_constr.datalen > 0)
63536                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63537         else
63538                 val_constr.data = NULL;
63539         for (size_t i = 0; i < val_constr.datalen; i++) {
63540                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
63541                 LDKPublicKey val_conv_8_ref;
63542                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
63543                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
63544                 val_constr.data[i] = val_conv_8_ref;
63545         }
63546         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
63547 }
63548
63549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
63550         LDKOnionMessagePath this_ptr_conv;
63551         this_ptr_conv.inner = untag_ptr(this_ptr);
63552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63554         this_ptr_conv.is_owned = false;
63555         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63556         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
63557         int64_t ret_ref = tag_ptr(ret_copy, true);
63558         return ret_ref;
63559 }
63560
63561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63562         LDKOnionMessagePath this_ptr_conv;
63563         this_ptr_conv.inner = untag_ptr(this_ptr);
63564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63566         this_ptr_conv.is_owned = false;
63567         void* val_ptr = untag_ptr(val);
63568         CHECK_ACCESS(val_ptr);
63569         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
63570         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
63571         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
63572 }
63573
63574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1new(JNIEnv *env, jclass clz, jobjectArray intermediate_nodes_arg, int64_t destination_arg) {
63575         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
63576         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
63577         if (intermediate_nodes_arg_constr.datalen > 0)
63578                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
63579         else
63580                 intermediate_nodes_arg_constr.data = NULL;
63581         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
63582                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
63583                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
63584                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
63585                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
63586                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
63587         }
63588         void* destination_arg_ptr = untag_ptr(destination_arg);
63589         CHECK_ACCESS(destination_arg_ptr);
63590         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
63591         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
63592         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
63593         int64_t ret_ref = 0;
63594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63596         return ret_ref;
63597 }
63598
63599 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
63600         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
63601         int64_t ret_ref = 0;
63602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63604         return ret_ref;
63605 }
63606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63607         LDKOnionMessagePath arg_conv;
63608         arg_conv.inner = untag_ptr(arg);
63609         arg_conv.is_owned = ptr_is_owned(arg);
63610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63611         arg_conv.is_owned = false;
63612         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
63613         return ret_conv;
63614 }
63615
63616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63617         LDKOnionMessagePath orig_conv;
63618         orig_conv.inner = untag_ptr(orig);
63619         orig_conv.is_owned = ptr_is_owned(orig);
63620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63621         orig_conv.is_owned = false;
63622         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
63623         int64_t ret_ref = 0;
63624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63626         return ret_ref;
63627 }
63628
63629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63630         if (!ptr_is_owned(this_ptr)) return;
63631         void* this_ptr_ptr = untag_ptr(this_ptr);
63632         CHECK_ACCESS(this_ptr_ptr);
63633         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
63634         FREE(untag_ptr(this_ptr));
63635         Destination_free(this_ptr_conv);
63636 }
63637
63638 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
63639         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63640         *ret_copy = Destination_clone(arg);
63641         int64_t ret_ref = tag_ptr(ret_copy, true);
63642         return ret_ref;
63643 }
63644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63645         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
63646         int64_t ret_conv = Destination_clone_ptr(arg_conv);
63647         return ret_conv;
63648 }
63649
63650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63651         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
63652         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63653         *ret_copy = Destination_clone(orig_conv);
63654         int64_t ret_ref = tag_ptr(ret_copy, true);
63655         return ret_ref;
63656 }
63657
63658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
63659         LDKPublicKey a_ref;
63660         CHECK((*env)->GetArrayLength(env, a) == 33);
63661         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
63662         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63663         *ret_copy = Destination_node(a_ref);
63664         int64_t ret_ref = tag_ptr(ret_copy, true);
63665         return ret_ref;
63666 }
63667
63668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
63669         LDKBlindedPath a_conv;
63670         a_conv.inner = untag_ptr(a);
63671         a_conv.is_owned = ptr_is_owned(a);
63672         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63673         a_conv = BlindedPath_clone(&a_conv);
63674         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
63675         *ret_copy = Destination_blinded_path(a_conv);
63676         int64_t ret_ref = tag_ptr(ret_copy, true);
63677         return ret_ref;
63678 }
63679
63680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63681         if (!ptr_is_owned(this_ptr)) return;
63682         void* this_ptr_ptr = untag_ptr(this_ptr);
63683         CHECK_ACCESS(this_ptr_ptr);
63684         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
63685         FREE(untag_ptr(this_ptr));
63686         SendError_free(this_ptr_conv);
63687 }
63688
63689 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
63690         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63691         *ret_copy = SendError_clone(arg);
63692         int64_t ret_ref = tag_ptr(ret_copy, true);
63693         return ret_ref;
63694 }
63695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63696         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
63697         int64_t ret_conv = SendError_clone_ptr(arg_conv);
63698         return ret_conv;
63699 }
63700
63701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63702         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
63703         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63704         *ret_copy = SendError_clone(orig_conv);
63705         int64_t ret_ref = tag_ptr(ret_copy, true);
63706         return ret_ref;
63707 }
63708
63709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
63710         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
63711         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63712         *ret_copy = SendError_secp256k1(a_conv);
63713         int64_t ret_ref = tag_ptr(ret_copy, true);
63714         return ret_ref;
63715 }
63716
63717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
63718         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63719         *ret_copy = SendError_too_big_packet();
63720         int64_t ret_ref = tag_ptr(ret_copy, true);
63721         return ret_ref;
63722 }
63723
63724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
63725         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63726         *ret_copy = SendError_too_few_blinded_hops();
63727         int64_t ret_ref = tag_ptr(ret_copy, true);
63728         return ret_ref;
63729 }
63730
63731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz) {
63732         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63733         *ret_copy = SendError_invalid_first_hop();
63734         int64_t ret_ref = tag_ptr(ret_copy, true);
63735         return ret_ref;
63736 }
63737
63738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
63739         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63740         *ret_copy = SendError_invalid_message();
63741         int64_t ret_ref = tag_ptr(ret_copy, true);
63742         return ret_ref;
63743 }
63744
63745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
63746         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63747         *ret_copy = SendError_buffer_full();
63748         int64_t ret_ref = tag_ptr(ret_copy, true);
63749         return ret_ref;
63750 }
63751
63752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
63753         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63754         *ret_copy = SendError_get_node_id_failed();
63755         int64_t ret_ref = tag_ptr(ret_copy, true);
63756         return ret_ref;
63757 }
63758
63759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
63760         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
63761         *ret_copy = SendError_blinded_path_advance_failed();
63762         int64_t ret_ref = tag_ptr(ret_copy, true);
63763         return ret_ref;
63764 }
63765
63766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63767         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
63768         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
63769         jboolean ret_conv = SendError_eq(a_conv, b_conv);
63770         return ret_conv;
63771 }
63772
63773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63774         if (!ptr_is_owned(this_ptr)) return;
63775         void* this_ptr_ptr = untag_ptr(this_ptr);
63776         CHECK_ACCESS(this_ptr_ptr);
63777         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
63778         FREE(untag_ptr(this_ptr));
63779         CustomOnionMessageHandler_free(this_ptr_conv);
63780 }
63781
63782 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) {
63783         void* entropy_source_ptr = untag_ptr(entropy_source);
63784         CHECK_ACCESS(entropy_source_ptr);
63785         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
63786         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
63787                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63788                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
63789         }
63790         void* node_signer_ptr = untag_ptr(node_signer);
63791         CHECK_ACCESS(node_signer_ptr);
63792         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
63793         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
63794                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63795                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
63796         }
63797         void* logger_ptr = untag_ptr(logger);
63798         CHECK_ACCESS(logger_ptr);
63799         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
63800         if (logger_conv.free == LDKLogger_JCalls_free) {
63801                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63802                 LDKLogger_JCalls_cloned(&logger_conv);
63803         }
63804         void* message_router_ptr = untag_ptr(message_router);
63805         CHECK_ACCESS(message_router_ptr);
63806         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
63807         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
63808                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63809                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
63810         }
63811         void* offers_handler_ptr = untag_ptr(offers_handler);
63812         CHECK_ACCESS(offers_handler_ptr);
63813         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
63814         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
63815                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63816                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
63817         }
63818         void* custom_handler_ptr = untag_ptr(custom_handler);
63819         CHECK_ACCESS(custom_handler_ptr);
63820         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
63821         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
63822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
63823                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
63824         }
63825         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
63826         int64_t ret_ref = 0;
63827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63829         return ret_ref;
63830 }
63831
63832 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) {
63833         LDKOnionMessenger this_arg_conv;
63834         this_arg_conv.inner = untag_ptr(this_arg);
63835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63837         this_arg_conv.is_owned = false;
63838         LDKOnionMessagePath path_conv;
63839         path_conv.inner = untag_ptr(path);
63840         path_conv.is_owned = ptr_is_owned(path);
63841         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
63842         path_conv = OnionMessagePath_clone(&path_conv);
63843         void* message_ptr = untag_ptr(message);
63844         CHECK_ACCESS(message_ptr);
63845         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
63846         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
63847         LDKBlindedPath reply_path_conv;
63848         reply_path_conv.inner = untag_ptr(reply_path);
63849         reply_path_conv.is_owned = ptr_is_owned(reply_path);
63850         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
63851         reply_path_conv = BlindedPath_clone(&reply_path_conv);
63852         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
63853         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, message_conv, reply_path_conv);
63854         return tag_ptr(ret_conv, true);
63855 }
63856
63857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
63858         LDKOnionMessenger this_arg_conv;
63859         this_arg_conv.inner = untag_ptr(this_arg);
63860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63862         this_arg_conv.is_owned = false;
63863         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
63864         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
63865         return tag_ptr(ret_ret, true);
63866 }
63867
63868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
63869         LDKOnionMessenger this_arg_conv;
63870         this_arg_conv.inner = untag_ptr(this_arg);
63871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63873         this_arg_conv.is_owned = false;
63874         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
63875         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
63876         return tag_ptr(ret_ret, true);
63877 }
63878
63879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63880         if (!ptr_is_owned(this_ptr)) return;
63881         void* this_ptr_ptr = untag_ptr(this_ptr);
63882         CHECK_ACCESS(this_ptr_ptr);
63883         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
63884         FREE(untag_ptr(this_ptr));
63885         OffersMessageHandler_free(this_ptr_conv);
63886 }
63887
63888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63889         if (!ptr_is_owned(this_ptr)) return;
63890         void* this_ptr_ptr = untag_ptr(this_ptr);
63891         CHECK_ACCESS(this_ptr_ptr);
63892         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
63893         FREE(untag_ptr(this_ptr));
63894         OffersMessage_free(this_ptr_conv);
63895 }
63896
63897 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
63898         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63899         *ret_copy = OffersMessage_clone(arg);
63900         int64_t ret_ref = tag_ptr(ret_copy, true);
63901         return ret_ref;
63902 }
63903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63904         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
63905         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
63906         return ret_conv;
63907 }
63908
63909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63910         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
63911         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63912         *ret_copy = OffersMessage_clone(orig_conv);
63913         int64_t ret_ref = tag_ptr(ret_copy, true);
63914         return ret_ref;
63915 }
63916
63917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
63918         LDKInvoiceRequest a_conv;
63919         a_conv.inner = untag_ptr(a);
63920         a_conv.is_owned = ptr_is_owned(a);
63921         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63922         a_conv = InvoiceRequest_clone(&a_conv);
63923         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63924         *ret_copy = OffersMessage_invoice_request(a_conv);
63925         int64_t ret_ref = tag_ptr(ret_copy, true);
63926         return ret_ref;
63927 }
63928
63929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
63930         LDKBolt12Invoice a_conv;
63931         a_conv.inner = untag_ptr(a);
63932         a_conv.is_owned = ptr_is_owned(a);
63933         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63934         a_conv = Bolt12Invoice_clone(&a_conv);
63935         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63936         *ret_copy = OffersMessage_invoice(a_conv);
63937         int64_t ret_ref = tag_ptr(ret_copy, true);
63938         return ret_ref;
63939 }
63940
63941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
63942         LDKInvoiceError a_conv;
63943         a_conv.inner = untag_ptr(a);
63944         a_conv.is_owned = ptr_is_owned(a);
63945         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63946         a_conv = InvoiceError_clone(&a_conv);
63947         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
63948         *ret_copy = OffersMessage_invoice_error(a_conv);
63949         int64_t ret_ref = tag_ptr(ret_copy, true);
63950         return ret_ref;
63951 }
63952
63953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
63954         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
63955         return ret_conv;
63956 }
63957
63958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
63959         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
63960         int64_t ret_conv = OffersMessage_tlv_type(this_arg_conv);
63961         return ret_conv;
63962 }
63963
63964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
63965         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
63966         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
63967         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63968         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63969         CVec_u8Z_free(ret_var);
63970         return ret_arr;
63971 }
63972
63973 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) {
63974         LDKu8slice ser_ref;
63975         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63976         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63977         void* arg_b_ptr = untag_ptr(arg_b);
63978         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
63979         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
63980         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
63981         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
63982         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63983         return tag_ptr(ret_conv, true);
63984 }
63985
63986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
63987         if (!ptr_is_owned(this_ptr)) return;
63988         void* this_ptr_ptr = untag_ptr(this_ptr);
63989         CHECK_ACCESS(this_ptr_ptr);
63990         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
63991         FREE(untag_ptr(this_ptr));
63992         OnionMessageContents_free(this_ptr_conv);
63993 }
63994
63995 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
63996         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
63997         *ret_copy = OnionMessageContents_clone(arg);
63998         int64_t ret_ref = tag_ptr(ret_copy, true);
63999         return ret_ref;
64000 }
64001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64002         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
64003         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
64004         return ret_conv;
64005 }
64006
64007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64008         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
64009         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64010         *ret_copy = OnionMessageContents_clone(orig_conv);
64011         int64_t ret_ref = tag_ptr(ret_copy, true);
64012         return ret_ref;
64013 }
64014
64015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
64016         void* a_ptr = untag_ptr(a);
64017         CHECK_ACCESS(a_ptr);
64018         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
64019         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
64020         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64021         *ret_copy = OnionMessageContents_offers(a_conv);
64022         int64_t ret_ref = tag_ptr(ret_copy, true);
64023         return ret_ref;
64024 }
64025
64026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
64027         void* a_ptr = untag_ptr(a);
64028         CHECK_ACCESS(a_ptr);
64029         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
64030         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
64031                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64032                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
64033         }
64034         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
64035         *ret_copy = OnionMessageContents_custom(a_conv);
64036         int64_t ret_ref = tag_ptr(ret_copy, true);
64037         return ret_ref;
64038 }
64039
64040 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
64041         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
64042         *ret_ret = CustomOnionMessageContents_clone(arg);
64043         return tag_ptr(ret_ret, true);
64044 }
64045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64046         void* arg_ptr = untag_ptr(arg);
64047         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
64048         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
64049         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
64050         return ret_conv;
64051 }
64052
64053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64054         void* orig_ptr = untag_ptr(orig);
64055         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
64056         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
64057         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
64058         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
64059         return tag_ptr(ret_ret, true);
64060 }
64061
64062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64063         if (!ptr_is_owned(this_ptr)) return;
64064         void* this_ptr_ptr = untag_ptr(this_ptr);
64065         CHECK_ACCESS(this_ptr_ptr);
64066         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
64067         FREE(untag_ptr(this_ptr));
64068         CustomOnionMessageContents_free(this_ptr_conv);
64069 }
64070
64071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64072         LDKBlindedPath this_obj_conv;
64073         this_obj_conv.inner = untag_ptr(this_obj);
64074         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64076         BlindedPath_free(this_obj_conv);
64077 }
64078
64079 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
64080         LDKBlindedPath ret_var = BlindedPath_clone(arg);
64081         int64_t ret_ref = 0;
64082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64084         return ret_ref;
64085 }
64086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64087         LDKBlindedPath arg_conv;
64088         arg_conv.inner = untag_ptr(arg);
64089         arg_conv.is_owned = ptr_is_owned(arg);
64090         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64091         arg_conv.is_owned = false;
64092         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
64093         return ret_conv;
64094 }
64095
64096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64097         LDKBlindedPath orig_conv;
64098         orig_conv.inner = untag_ptr(orig);
64099         orig_conv.is_owned = ptr_is_owned(orig);
64100         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64101         orig_conv.is_owned = false;
64102         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
64103         int64_t ret_ref = 0;
64104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64106         return ret_ref;
64107 }
64108
64109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
64110         LDKBlindedPath o_conv;
64111         o_conv.inner = untag_ptr(o);
64112         o_conv.is_owned = ptr_is_owned(o);
64113         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64114         o_conv.is_owned = false;
64115         int64_t ret_conv = BlindedPath_hash(&o_conv);
64116         return ret_conv;
64117 }
64118
64119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64120         LDKBlindedPath a_conv;
64121         a_conv.inner = untag_ptr(a);
64122         a_conv.is_owned = ptr_is_owned(a);
64123         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64124         a_conv.is_owned = false;
64125         LDKBlindedPath b_conv;
64126         b_conv.inner = untag_ptr(b);
64127         b_conv.is_owned = ptr_is_owned(b);
64128         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64129         b_conv.is_owned = false;
64130         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
64131         return ret_conv;
64132 }
64133
64134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64135         LDKBlindedHop this_obj_conv;
64136         this_obj_conv.inner = untag_ptr(this_obj);
64137         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64139         BlindedHop_free(this_obj_conv);
64140 }
64141
64142 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
64143         LDKBlindedHop ret_var = BlindedHop_clone(arg);
64144         int64_t ret_ref = 0;
64145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64147         return ret_ref;
64148 }
64149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64150         LDKBlindedHop arg_conv;
64151         arg_conv.inner = untag_ptr(arg);
64152         arg_conv.is_owned = ptr_is_owned(arg);
64153         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64154         arg_conv.is_owned = false;
64155         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
64156         return ret_conv;
64157 }
64158
64159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64160         LDKBlindedHop orig_conv;
64161         orig_conv.inner = untag_ptr(orig);
64162         orig_conv.is_owned = ptr_is_owned(orig);
64163         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64164         orig_conv.is_owned = false;
64165         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
64166         int64_t ret_ref = 0;
64167         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64168         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64169         return ret_ref;
64170 }
64171
64172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
64173         LDKBlindedHop o_conv;
64174         o_conv.inner = untag_ptr(o);
64175         o_conv.is_owned = ptr_is_owned(o);
64176         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64177         o_conv.is_owned = false;
64178         int64_t ret_conv = BlindedHop_hash(&o_conv);
64179         return ret_conv;
64180 }
64181
64182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64183         LDKBlindedHop a_conv;
64184         a_conv.inner = untag_ptr(a);
64185         a_conv.is_owned = ptr_is_owned(a);
64186         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64187         a_conv.is_owned = false;
64188         LDKBlindedHop b_conv;
64189         b_conv.inner = untag_ptr(b);
64190         b_conv.is_owned = ptr_is_owned(b);
64191         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64192         b_conv.is_owned = false;
64193         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
64194         return ret_conv;
64195 }
64196
64197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
64198         LDKCVec_PublicKeyZ node_pks_constr;
64199         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
64200         if (node_pks_constr.datalen > 0)
64201                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
64202         else
64203                 node_pks_constr.data = NULL;
64204         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
64205                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
64206                 LDKPublicKey node_pks_conv_8_ref;
64207                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
64208                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
64209                 node_pks_constr.data[i] = node_pks_conv_8_ref;
64210         }
64211         void* entropy_source_ptr = untag_ptr(entropy_source);
64212         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64213         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64214         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
64215         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
64216         return tag_ptr(ret_conv, true);
64217 }
64218
64219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
64220         LDKBlindedPath obj_conv;
64221         obj_conv.inner = untag_ptr(obj);
64222         obj_conv.is_owned = ptr_is_owned(obj);
64223         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64224         obj_conv.is_owned = false;
64225         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
64226         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64227         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64228         CVec_u8Z_free(ret_var);
64229         return ret_arr;
64230 }
64231
64232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64233         LDKu8slice ser_ref;
64234         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64235         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64236         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
64237         *ret_conv = BlindedPath_read(ser_ref);
64238         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64239         return tag_ptr(ret_conv, true);
64240 }
64241
64242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
64243         LDKBlindedHop obj_conv;
64244         obj_conv.inner = untag_ptr(obj);
64245         obj_conv.is_owned = ptr_is_owned(obj);
64246         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64247         obj_conv.is_owned = false;
64248         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
64249         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64250         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64251         CVec_u8Z_free(ret_var);
64252         return ret_arr;
64253 }
64254
64255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64256         LDKu8slice ser_ref;
64257         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64258         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64259         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
64260         *ret_conv = BlindedHop_read(ser_ref);
64261         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64262         return tag_ptr(ret_conv, true);
64263 }
64264
64265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64266         if (!ptr_is_owned(this_ptr)) return;
64267         void* this_ptr_ptr = untag_ptr(this_ptr);
64268         CHECK_ACCESS(this_ptr_ptr);
64269         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
64270         FREE(untag_ptr(this_ptr));
64271         PaymentPurpose_free(this_ptr_conv);
64272 }
64273
64274 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
64275         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64276         *ret_copy = PaymentPurpose_clone(arg);
64277         int64_t ret_ref = tag_ptr(ret_copy, true);
64278         return ret_ref;
64279 }
64280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64281         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
64282         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
64283         return ret_conv;
64284 }
64285
64286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64287         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
64288         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64289         *ret_copy = PaymentPurpose_clone(orig_conv);
64290         int64_t ret_ref = tag_ptr(ret_copy, true);
64291         return ret_ref;
64292 }
64293
64294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
64295         void* payment_preimage_ptr = untag_ptr(payment_preimage);
64296         CHECK_ACCESS(payment_preimage_ptr);
64297         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
64298         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
64299         LDKThirtyTwoBytes payment_secret_ref;
64300         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
64301         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
64302         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64303         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
64304         int64_t ret_ref = tag_ptr(ret_copy, true);
64305         return ret_ref;
64306 }
64307
64308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
64309         LDKThirtyTwoBytes a_ref;
64310         CHECK((*env)->GetArrayLength(env, a) == 32);
64311         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
64312         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
64313         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
64314         int64_t ret_ref = tag_ptr(ret_copy, true);
64315         return ret_ref;
64316 }
64317
64318 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64319         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
64320         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
64321         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
64322         return ret_conv;
64323 }
64324
64325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
64326         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
64327         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
64328         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64329         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64330         CVec_u8Z_free(ret_var);
64331         return ret_arr;
64332 }
64333
64334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64335         LDKu8slice ser_ref;
64336         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64337         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64338         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
64339         *ret_conv = PaymentPurpose_read(ser_ref);
64340         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64341         return tag_ptr(ret_conv, true);
64342 }
64343
64344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64345         if (!ptr_is_owned(this_ptr)) return;
64346         void* this_ptr_ptr = untag_ptr(this_ptr);
64347         CHECK_ACCESS(this_ptr_ptr);
64348         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
64349         FREE(untag_ptr(this_ptr));
64350         PathFailure_free(this_ptr_conv);
64351 }
64352
64353 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
64354         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64355         *ret_copy = PathFailure_clone(arg);
64356         int64_t ret_ref = tag_ptr(ret_copy, true);
64357         return ret_ref;
64358 }
64359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64360         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
64361         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
64362         return ret_conv;
64363 }
64364
64365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64366         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
64367         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64368         *ret_copy = PathFailure_clone(orig_conv);
64369         int64_t ret_ref = tag_ptr(ret_copy, true);
64370         return ret_ref;
64371 }
64372
64373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
64374         void* err_ptr = untag_ptr(err);
64375         CHECK_ACCESS(err_ptr);
64376         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
64377         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
64378         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64379         *ret_copy = PathFailure_initial_send(err_conv);
64380         int64_t ret_ref = tag_ptr(ret_copy, true);
64381         return ret_ref;
64382 }
64383
64384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
64385         void* network_update_ptr = untag_ptr(network_update);
64386         CHECK_ACCESS(network_update_ptr);
64387         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
64388         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
64389         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
64390         *ret_copy = PathFailure_on_path(network_update_conv);
64391         int64_t ret_ref = tag_ptr(ret_copy, true);
64392         return ret_ref;
64393 }
64394
64395 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64396         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
64397         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
64398         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
64399         return ret_conv;
64400 }
64401
64402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
64403         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
64404         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
64405         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64406         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64407         CVec_u8Z_free(ret_var);
64408         return ret_arr;
64409 }
64410
64411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64412         LDKu8slice ser_ref;
64413         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64414         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64415         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
64416         *ret_conv = PathFailure_read(ser_ref);
64417         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64418         return tag_ptr(ret_conv, true);
64419 }
64420
64421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64422         if (!ptr_is_owned(this_ptr)) return;
64423         void* this_ptr_ptr = untag_ptr(this_ptr);
64424         CHECK_ACCESS(this_ptr_ptr);
64425         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
64426         FREE(untag_ptr(this_ptr));
64427         ClosureReason_free(this_ptr_conv);
64428 }
64429
64430 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
64431         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64432         *ret_copy = ClosureReason_clone(arg);
64433         int64_t ret_ref = tag_ptr(ret_copy, true);
64434         return ret_ref;
64435 }
64436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64437         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
64438         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
64439         return ret_conv;
64440 }
64441
64442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64443         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
64444         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64445         *ret_copy = ClosureReason_clone(orig_conv);
64446         int64_t ret_ref = tag_ptr(ret_copy, true);
64447         return ret_ref;
64448 }
64449
64450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
64451         LDKUntrustedString peer_msg_conv;
64452         peer_msg_conv.inner = untag_ptr(peer_msg);
64453         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
64454         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
64455         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
64456         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64457         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
64458         int64_t ret_ref = tag_ptr(ret_copy, true);
64459         return ret_ref;
64460 }
64461
64462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
64463         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64464         *ret_copy = ClosureReason_holder_force_closed();
64465         int64_t ret_ref = tag_ptr(ret_copy, true);
64466         return ret_ref;
64467 }
64468
64469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
64470         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64471         *ret_copy = ClosureReason_cooperative_closure();
64472         int64_t ret_ref = tag_ptr(ret_copy, true);
64473         return ret_ref;
64474 }
64475
64476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
64477         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64478         *ret_copy = ClosureReason_commitment_tx_confirmed();
64479         int64_t ret_ref = tag_ptr(ret_copy, true);
64480         return ret_ref;
64481 }
64482
64483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
64484         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64485         *ret_copy = ClosureReason_funding_timed_out();
64486         int64_t ret_ref = tag_ptr(ret_copy, true);
64487         return ret_ref;
64488 }
64489
64490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
64491         LDKStr err_conv = java_to_owned_str(env, err);
64492         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64493         *ret_copy = ClosureReason_processing_error(err_conv);
64494         int64_t ret_ref = tag_ptr(ret_copy, true);
64495         return ret_ref;
64496 }
64497
64498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
64499         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64500         *ret_copy = ClosureReason_disconnected_peer();
64501         int64_t ret_ref = tag_ptr(ret_copy, true);
64502         return ret_ref;
64503 }
64504
64505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
64506         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64507         *ret_copy = ClosureReason_outdated_channel_manager();
64508         int64_t ret_ref = tag_ptr(ret_copy, true);
64509         return ret_ref;
64510 }
64511
64512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
64513         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
64514         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
64515         int64_t ret_ref = tag_ptr(ret_copy, true);
64516         return ret_ref;
64517 }
64518
64519 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64520         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
64521         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
64522         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
64523         return ret_conv;
64524 }
64525
64526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
64527         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
64528         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
64529         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64530         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64531         CVec_u8Z_free(ret_var);
64532         return ret_arr;
64533 }
64534
64535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64536         LDKu8slice ser_ref;
64537         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64538         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64539         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
64540         *ret_conv = ClosureReason_read(ser_ref);
64541         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64542         return tag_ptr(ret_conv, true);
64543 }
64544
64545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64546         if (!ptr_is_owned(this_ptr)) return;
64547         void* this_ptr_ptr = untag_ptr(this_ptr);
64548         CHECK_ACCESS(this_ptr_ptr);
64549         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
64550         FREE(untag_ptr(this_ptr));
64551         HTLCDestination_free(this_ptr_conv);
64552 }
64553
64554 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
64555         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64556         *ret_copy = HTLCDestination_clone(arg);
64557         int64_t ret_ref = tag_ptr(ret_copy, true);
64558         return ret_ref;
64559 }
64560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64561         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
64562         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
64563         return ret_conv;
64564 }
64565
64566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64567         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
64568         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64569         *ret_copy = HTLCDestination_clone(orig_conv);
64570         int64_t ret_ref = tag_ptr(ret_copy, true);
64571         return ret_ref;
64572 }
64573
64574 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) {
64575         LDKPublicKey node_id_ref;
64576         CHECK((*env)->GetArrayLength(env, node_id) == 33);
64577         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
64578         LDKThirtyTwoBytes channel_id_ref;
64579         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
64580         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
64581         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64582         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
64583         int64_t ret_ref = tag_ptr(ret_copy, true);
64584         return ret_ref;
64585 }
64586
64587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
64588         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64589         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
64590         int64_t ret_ref = tag_ptr(ret_copy, true);
64591         return ret_ref;
64592 }
64593
64594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
64595         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64596         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
64597         int64_t ret_ref = tag_ptr(ret_copy, true);
64598         return ret_ref;
64599 }
64600
64601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
64602         LDKThirtyTwoBytes payment_hash_ref;
64603         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64604         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64605         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
64606         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
64607         int64_t ret_ref = tag_ptr(ret_copy, true);
64608         return ret_ref;
64609 }
64610
64611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64612         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
64613         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
64614         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
64615         return ret_conv;
64616 }
64617
64618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
64619         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
64620         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
64621         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64622         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64623         CVec_u8Z_free(ret_var);
64624         return ret_arr;
64625 }
64626
64627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64628         LDKu8slice ser_ref;
64629         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64630         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64631         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
64632         *ret_conv = HTLCDestination_read(ser_ref);
64633         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64634         return tag_ptr(ret_conv, true);
64635 }
64636
64637 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64638         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
64639         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
64640         return ret_conv;
64641 }
64642
64643 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
64644         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
64645         return ret_conv;
64646 }
64647
64648 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
64649         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
64650         return ret_conv;
64651 }
64652
64653 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
64654         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
64655         return ret_conv;
64656 }
64657
64658 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
64659         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
64660         return ret_conv;
64661 }
64662
64663 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
64664         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
64665         return ret_conv;
64666 }
64667
64668 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
64669         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
64670         return ret_conv;
64671 }
64672
64673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64674         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
64675         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
64676         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
64677         return ret_conv;
64678 }
64679
64680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
64681         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
64682         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
64683         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64684         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64685         CVec_u8Z_free(ret_var);
64686         return ret_arr;
64687 }
64688
64689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64690         LDKu8slice ser_ref;
64691         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64692         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64693         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
64694         *ret_conv = PaymentFailureReason_read(ser_ref);
64695         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64696         return tag_ptr(ret_conv, true);
64697 }
64698
64699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
64700         if (!ptr_is_owned(this_ptr)) return;
64701         void* this_ptr_ptr = untag_ptr(this_ptr);
64702         CHECK_ACCESS(this_ptr_ptr);
64703         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
64704         FREE(untag_ptr(this_ptr));
64705         Event_free(this_ptr_conv);
64706 }
64707
64708 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
64709         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64710         *ret_copy = Event_clone(arg);
64711         int64_t ret_ref = tag_ptr(ret_copy, true);
64712         return ret_ref;
64713 }
64714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64715         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
64716         int64_t ret_conv = Event_clone_ptr(arg_conv);
64717         return ret_conv;
64718 }
64719
64720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64721         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
64722         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64723         *ret_copy = Event_clone(orig_conv);
64724         int64_t ret_ref = tag_ptr(ret_copy, true);
64725         return ret_ref;
64726 }
64727
64728 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) {
64729         LDKThirtyTwoBytes temporary_channel_id_ref;
64730         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
64731         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
64732         LDKPublicKey counterparty_node_id_ref;
64733         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
64734         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
64735         LDKCVec_u8Z output_script_ref;
64736         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
64737         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
64738         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
64739         LDKU128 user_channel_id_ref;
64740         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
64741         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
64742         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64743         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
64744         int64_t ret_ref = tag_ptr(ret_copy, true);
64745         return ret_ref;
64746 }
64747
64748 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) {
64749         LDKPublicKey receiver_node_id_ref;
64750         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
64751         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
64752         LDKThirtyTwoBytes payment_hash_ref;
64753         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64754         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64755         LDKRecipientOnionFields onion_fields_conv;
64756         onion_fields_conv.inner = untag_ptr(onion_fields);
64757         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
64758         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
64759         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
64760         void* purpose_ptr = untag_ptr(purpose);
64761         CHECK_ACCESS(purpose_ptr);
64762         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
64763         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
64764         LDKThirtyTwoBytes via_channel_id_ref;
64765         CHECK((*env)->GetArrayLength(env, via_channel_id) == 32);
64766         (*env)->GetByteArrayRegion(env, via_channel_id, 0, 32, via_channel_id_ref.data);
64767         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
64768         CHECK_ACCESS(via_user_channel_id_ptr);
64769         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
64770         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
64771         void* claim_deadline_ptr = untag_ptr(claim_deadline);
64772         CHECK_ACCESS(claim_deadline_ptr);
64773         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
64774         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
64775         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64776         *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);
64777         int64_t ret_ref = tag_ptr(ret_copy, true);
64778         return ret_ref;
64779 }
64780
64781 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) {
64782         LDKPublicKey receiver_node_id_ref;
64783         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
64784         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
64785         LDKThirtyTwoBytes payment_hash_ref;
64786         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64787         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64788         void* purpose_ptr = untag_ptr(purpose);
64789         CHECK_ACCESS(purpose_ptr);
64790         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
64791         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
64792         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64793         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
64794         int64_t ret_ref = tag_ptr(ret_copy, true);
64795         return ret_ref;
64796 }
64797
64798 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) {
64799         void* payment_id_ptr = untag_ptr(payment_id);
64800         CHECK_ACCESS(payment_id_ptr);
64801         LDKCOption_PaymentIdZ payment_id_conv = *(LDKCOption_PaymentIdZ*)(payment_id_ptr);
64802         payment_id_conv = COption_PaymentIdZ_clone((LDKCOption_PaymentIdZ*)untag_ptr(payment_id));
64803         LDKThirtyTwoBytes payment_preimage_ref;
64804         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
64805         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
64806         LDKThirtyTwoBytes payment_hash_ref;
64807         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64808         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64809         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
64810         CHECK_ACCESS(fee_paid_msat_ptr);
64811         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
64812         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
64813         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64814         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
64815         int64_t ret_ref = tag_ptr(ret_copy, true);
64816         return ret_ref;
64817 }
64818
64819 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) {
64820         LDKThirtyTwoBytes payment_id_ref;
64821         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64822         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64823         LDKThirtyTwoBytes payment_hash_ref;
64824         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64825         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64826         void* reason_ptr = untag_ptr(reason);
64827         CHECK_ACCESS(reason_ptr);
64828         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
64829         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
64830         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64831         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
64832         int64_t ret_ref = tag_ptr(ret_copy, true);
64833         return ret_ref;
64834 }
64835
64836 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) {
64837         LDKThirtyTwoBytes payment_id_ref;
64838         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64839         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64840         void* payment_hash_ptr = untag_ptr(payment_hash);
64841         CHECK_ACCESS(payment_hash_ptr);
64842         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
64843         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
64844         LDKPath path_conv;
64845         path_conv.inner = untag_ptr(path);
64846         path_conv.is_owned = ptr_is_owned(path);
64847         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64848         path_conv = Path_clone(&path_conv);
64849         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64850         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
64851         int64_t ret_ref = tag_ptr(ret_copy, true);
64852         return ret_ref;
64853 }
64854
64855 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) {
64856         void* payment_id_ptr = untag_ptr(payment_id);
64857         CHECK_ACCESS(payment_id_ptr);
64858         LDKCOption_PaymentIdZ payment_id_conv = *(LDKCOption_PaymentIdZ*)(payment_id_ptr);
64859         payment_id_conv = COption_PaymentIdZ_clone((LDKCOption_PaymentIdZ*)untag_ptr(payment_id));
64860         LDKThirtyTwoBytes payment_hash_ref;
64861         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64862         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64863         void* failure_ptr = untag_ptr(failure);
64864         CHECK_ACCESS(failure_ptr);
64865         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
64866         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
64867         LDKPath path_conv;
64868         path_conv.inner = untag_ptr(path);
64869         path_conv.is_owned = ptr_is_owned(path);
64870         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64871         path_conv = Path_clone(&path_conv);
64872         void* short_channel_id_ptr = untag_ptr(short_channel_id);
64873         CHECK_ACCESS(short_channel_id_ptr);
64874         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
64875         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
64876         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64877         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
64878         int64_t ret_ref = tag_ptr(ret_copy, true);
64879         return ret_ref;
64880 }
64881
64882 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) {
64883         LDKThirtyTwoBytes payment_id_ref;
64884         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64885         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64886         LDKThirtyTwoBytes payment_hash_ref;
64887         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64888         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64889         LDKPath path_conv;
64890         path_conv.inner = untag_ptr(path);
64891         path_conv.is_owned = ptr_is_owned(path);
64892         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64893         path_conv = Path_clone(&path_conv);
64894         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64895         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
64896         int64_t ret_ref = tag_ptr(ret_copy, true);
64897         return ret_ref;
64898 }
64899
64900 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) {
64901         LDKThirtyTwoBytes payment_id_ref;
64902         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
64903         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
64904         LDKThirtyTwoBytes payment_hash_ref;
64905         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64906         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64907         LDKPath path_conv;
64908         path_conv.inner = untag_ptr(path);
64909         path_conv.is_owned = ptr_is_owned(path);
64910         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
64911         path_conv = Path_clone(&path_conv);
64912         void* short_channel_id_ptr = untag_ptr(short_channel_id);
64913         CHECK_ACCESS(short_channel_id_ptr);
64914         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
64915         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
64916         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64917         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
64918         int64_t ret_ref = tag_ptr(ret_copy, true);
64919         return ret_ref;
64920 }
64921
64922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
64923         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64924         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
64925         int64_t ret_ref = tag_ptr(ret_copy, true);
64926         return ret_ref;
64927 }
64928
64929 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) {
64930         LDKThirtyTwoBytes intercept_id_ref;
64931         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
64932         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
64933         LDKThirtyTwoBytes payment_hash_ref;
64934         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
64935         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
64936         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64937         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
64938         int64_t ret_ref = tag_ptr(ret_copy, true);
64939         return ret_ref;
64940 }
64941
64942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
64943         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
64944         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
64945         if (outputs_constr.datalen > 0)
64946                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
64947         else
64948                 outputs_constr.data = NULL;
64949         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
64950         for (size_t b = 0; b < outputs_constr.datalen; b++) {
64951                 int64_t outputs_conv_27 = outputs_vals[b];
64952                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
64953                 CHECK_ACCESS(outputs_conv_27_ptr);
64954                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
64955                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
64956                 outputs_constr.data[b] = outputs_conv_27_conv;
64957         }
64958         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
64959         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64960         *ret_copy = Event_spendable_outputs(outputs_constr);
64961         int64_t ret_ref = tag_ptr(ret_copy, true);
64962         return ret_ref;
64963 }
64964
64965 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) {
64966         LDKThirtyTwoBytes prev_channel_id_ref;
64967         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
64968         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
64969         LDKThirtyTwoBytes next_channel_id_ref;
64970         CHECK((*env)->GetArrayLength(env, next_channel_id) == 32);
64971         (*env)->GetByteArrayRegion(env, next_channel_id, 0, 32, next_channel_id_ref.data);
64972         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
64973         CHECK_ACCESS(fee_earned_msat_ptr);
64974         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
64975         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
64976         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
64977         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
64978         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
64979         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
64980         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
64981         *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);
64982         int64_t ret_ref = tag_ptr(ret_copy, true);
64983         return ret_ref;
64984 }
64985
64986 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) {
64987         LDKThirtyTwoBytes channel_id_ref;
64988         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
64989         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
64990         LDKU128 user_channel_id_ref;
64991         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
64992         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
64993         LDKThirtyTwoBytes former_temporary_channel_id_ref;
64994         CHECK((*env)->GetArrayLength(env, former_temporary_channel_id) == 32);
64995         (*env)->GetByteArrayRegion(env, former_temporary_channel_id, 0, 32, former_temporary_channel_id_ref.data);
64996         LDKPublicKey counterparty_node_id_ref;
64997         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
64998         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
64999         LDKOutPoint funding_txo_conv;
65000         funding_txo_conv.inner = untag_ptr(funding_txo);
65001         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
65002         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
65003         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
65004         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65005         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_ref, counterparty_node_id_ref, funding_txo_conv);
65006         int64_t ret_ref = tag_ptr(ret_copy, true);
65007         return ret_ref;
65008 }
65009
65010 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) {
65011         LDKThirtyTwoBytes channel_id_ref;
65012         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
65013         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
65014         LDKU128 user_channel_id_ref;
65015         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
65016         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
65017         LDKPublicKey counterparty_node_id_ref;
65018         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
65019         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
65020         LDKChannelTypeFeatures channel_type_conv;
65021         channel_type_conv.inner = untag_ptr(channel_type);
65022         channel_type_conv.is_owned = ptr_is_owned(channel_type);
65023         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
65024         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
65025         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65026         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
65027         int64_t ret_ref = tag_ptr(ret_copy, true);
65028         return ret_ref;
65029 }
65030
65031 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) {
65032         LDKThirtyTwoBytes channel_id_ref;
65033         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
65034         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
65035         LDKU128 user_channel_id_ref;
65036         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
65037         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
65038         void* reason_ptr = untag_ptr(reason);
65039         CHECK_ACCESS(reason_ptr);
65040         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
65041         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
65042         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65043         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
65044         int64_t ret_ref = tag_ptr(ret_copy, true);
65045         return ret_ref;
65046 }
65047
65048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
65049         LDKThirtyTwoBytes channel_id_ref;
65050         CHECK((*env)->GetArrayLength(env, channel_id) == 32);
65051         (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
65052         LDKTransaction transaction_ref;
65053         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
65054         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
65055         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
65056         transaction_ref.data_is_owned = true;
65057         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65058         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
65059         int64_t ret_ref = tag_ptr(ret_copy, true);
65060         return ret_ref;
65061 }
65062
65063 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) {
65064         LDKThirtyTwoBytes temporary_channel_id_ref;
65065         CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
65066         (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
65067         LDKPublicKey counterparty_node_id_ref;
65068         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
65069         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
65070         LDKChannelTypeFeatures channel_type_conv;
65071         channel_type_conv.inner = untag_ptr(channel_type);
65072         channel_type_conv.is_owned = ptr_is_owned(channel_type);
65073         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
65074         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
65075         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65076         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
65077         int64_t ret_ref = tag_ptr(ret_copy, true);
65078         return ret_ref;
65079 }
65080
65081 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) {
65082         LDKThirtyTwoBytes prev_channel_id_ref;
65083         CHECK((*env)->GetArrayLength(env, prev_channel_id) == 32);
65084         (*env)->GetByteArrayRegion(env, prev_channel_id, 0, 32, prev_channel_id_ref.data);
65085         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
65086         CHECK_ACCESS(failed_next_destination_ptr);
65087         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
65088         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
65089         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65090         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
65091         int64_t ret_ref = tag_ptr(ret_copy, true);
65092         return ret_ref;
65093 }
65094
65095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
65096         void* a_ptr = untag_ptr(a);
65097         CHECK_ACCESS(a_ptr);
65098         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
65099         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
65100         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
65101         *ret_copy = Event_bump_transaction(a_conv);
65102         int64_t ret_ref = tag_ptr(ret_copy, true);
65103         return ret_ref;
65104 }
65105
65106 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65107         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
65108         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
65109         jboolean ret_conv = Event_eq(a_conv, b_conv);
65110         return ret_conv;
65111 }
65112
65113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
65114         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
65115         LDKCVec_u8Z ret_var = Event_write(obj_conv);
65116         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65117         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65118         CVec_u8Z_free(ret_var);
65119         return ret_arr;
65120 }
65121
65122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
65123         LDKu8slice ser_ref;
65124         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
65125         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
65126         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
65127         *ret_conv = Event_read(ser_ref);
65128         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
65129         return tag_ptr(ret_conv, true);
65130 }
65131
65132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65133         if (!ptr_is_owned(this_ptr)) return;
65134         void* this_ptr_ptr = untag_ptr(this_ptr);
65135         CHECK_ACCESS(this_ptr_ptr);
65136         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
65137         FREE(untag_ptr(this_ptr));
65138         MessageSendEvent_free(this_ptr_conv);
65139 }
65140
65141 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
65142         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65143         *ret_copy = MessageSendEvent_clone(arg);
65144         int64_t ret_ref = tag_ptr(ret_copy, true);
65145         return ret_ref;
65146 }
65147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65148         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
65149         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
65150         return ret_conv;
65151 }
65152
65153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65154         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
65155         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65156         *ret_copy = MessageSendEvent_clone(orig_conv);
65157         int64_t ret_ref = tag_ptr(ret_copy, true);
65158         return ret_ref;
65159 }
65160
65161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65162         LDKPublicKey node_id_ref;
65163         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65164         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65165         LDKAcceptChannel msg_conv;
65166         msg_conv.inner = untag_ptr(msg);
65167         msg_conv.is_owned = ptr_is_owned(msg);
65168         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65169         msg_conv = AcceptChannel_clone(&msg_conv);
65170         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65171         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
65172         int64_t ret_ref = tag_ptr(ret_copy, true);
65173         return ret_ref;
65174 }
65175
65176 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) {
65177         LDKPublicKey node_id_ref;
65178         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65179         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65180         LDKAcceptChannelV2 msg_conv;
65181         msg_conv.inner = untag_ptr(msg);
65182         msg_conv.is_owned = ptr_is_owned(msg);
65183         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65184         msg_conv = AcceptChannelV2_clone(&msg_conv);
65185         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65186         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
65187         int64_t ret_ref = tag_ptr(ret_copy, true);
65188         return ret_ref;
65189 }
65190
65191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65192         LDKPublicKey node_id_ref;
65193         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65194         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65195         LDKOpenChannel msg_conv;
65196         msg_conv.inner = untag_ptr(msg);
65197         msg_conv.is_owned = ptr_is_owned(msg);
65198         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65199         msg_conv = OpenChannel_clone(&msg_conv);
65200         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65201         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
65202         int64_t ret_ref = tag_ptr(ret_copy, true);
65203         return ret_ref;
65204 }
65205
65206 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) {
65207         LDKPublicKey node_id_ref;
65208         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65209         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65210         LDKOpenChannelV2 msg_conv;
65211         msg_conv.inner = untag_ptr(msg);
65212         msg_conv.is_owned = ptr_is_owned(msg);
65213         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65214         msg_conv = OpenChannelV2_clone(&msg_conv);
65215         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65216         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
65217         int64_t ret_ref = tag_ptr(ret_copy, true);
65218         return ret_ref;
65219 }
65220
65221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65222         LDKPublicKey node_id_ref;
65223         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65224         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65225         LDKFundingCreated msg_conv;
65226         msg_conv.inner = untag_ptr(msg);
65227         msg_conv.is_owned = ptr_is_owned(msg);
65228         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65229         msg_conv = FundingCreated_clone(&msg_conv);
65230         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65231         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
65232         int64_t ret_ref = tag_ptr(ret_copy, true);
65233         return ret_ref;
65234 }
65235
65236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65237         LDKPublicKey node_id_ref;
65238         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65239         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65240         LDKFundingSigned msg_conv;
65241         msg_conv.inner = untag_ptr(msg);
65242         msg_conv.is_owned = ptr_is_owned(msg);
65243         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65244         msg_conv = FundingSigned_clone(&msg_conv);
65245         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65246         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
65247         int64_t ret_ref = tag_ptr(ret_copy, true);
65248         return ret_ref;
65249 }
65250
65251 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) {
65252         LDKPublicKey node_id_ref;
65253         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65254         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65255         LDKTxAddInput msg_conv;
65256         msg_conv.inner = untag_ptr(msg);
65257         msg_conv.is_owned = ptr_is_owned(msg);
65258         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65259         msg_conv = TxAddInput_clone(&msg_conv);
65260         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65261         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
65262         int64_t ret_ref = tag_ptr(ret_copy, true);
65263         return ret_ref;
65264 }
65265
65266 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) {
65267         LDKPublicKey node_id_ref;
65268         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65269         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65270         LDKTxAddOutput msg_conv;
65271         msg_conv.inner = untag_ptr(msg);
65272         msg_conv.is_owned = ptr_is_owned(msg);
65273         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65274         msg_conv = TxAddOutput_clone(&msg_conv);
65275         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65276         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
65277         int64_t ret_ref = tag_ptr(ret_copy, true);
65278         return ret_ref;
65279 }
65280
65281 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) {
65282         LDKPublicKey node_id_ref;
65283         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65284         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65285         LDKTxRemoveInput msg_conv;
65286         msg_conv.inner = untag_ptr(msg);
65287         msg_conv.is_owned = ptr_is_owned(msg);
65288         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65289         msg_conv = TxRemoveInput_clone(&msg_conv);
65290         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65291         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
65292         int64_t ret_ref = tag_ptr(ret_copy, true);
65293         return ret_ref;
65294 }
65295
65296 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) {
65297         LDKPublicKey node_id_ref;
65298         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65299         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65300         LDKTxRemoveOutput msg_conv;
65301         msg_conv.inner = untag_ptr(msg);
65302         msg_conv.is_owned = ptr_is_owned(msg);
65303         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65304         msg_conv = TxRemoveOutput_clone(&msg_conv);
65305         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65306         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
65307         int64_t ret_ref = tag_ptr(ret_copy, true);
65308         return ret_ref;
65309 }
65310
65311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65312         LDKPublicKey node_id_ref;
65313         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65314         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65315         LDKTxComplete msg_conv;
65316         msg_conv.inner = untag_ptr(msg);
65317         msg_conv.is_owned = ptr_is_owned(msg);
65318         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65319         msg_conv = TxComplete_clone(&msg_conv);
65320         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65321         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
65322         int64_t ret_ref = tag_ptr(ret_copy, true);
65323         return ret_ref;
65324 }
65325
65326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65327         LDKPublicKey node_id_ref;
65328         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65329         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65330         LDKTxSignatures msg_conv;
65331         msg_conv.inner = untag_ptr(msg);
65332         msg_conv.is_owned = ptr_is_owned(msg);
65333         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65334         msg_conv = TxSignatures_clone(&msg_conv);
65335         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65336         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
65337         int64_t ret_ref = tag_ptr(ret_copy, true);
65338         return ret_ref;
65339 }
65340
65341 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) {
65342         LDKPublicKey node_id_ref;
65343         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65344         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65345         LDKTxInitRbf msg_conv;
65346         msg_conv.inner = untag_ptr(msg);
65347         msg_conv.is_owned = ptr_is_owned(msg);
65348         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65349         msg_conv = TxInitRbf_clone(&msg_conv);
65350         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65351         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
65352         int64_t ret_ref = tag_ptr(ret_copy, true);
65353         return ret_ref;
65354 }
65355
65356 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) {
65357         LDKPublicKey node_id_ref;
65358         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65359         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65360         LDKTxAckRbf msg_conv;
65361         msg_conv.inner = untag_ptr(msg);
65362         msg_conv.is_owned = ptr_is_owned(msg);
65363         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65364         msg_conv = TxAckRbf_clone(&msg_conv);
65365         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65366         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
65367         int64_t ret_ref = tag_ptr(ret_copy, true);
65368         return ret_ref;
65369 }
65370
65371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65372         LDKPublicKey node_id_ref;
65373         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65374         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65375         LDKTxAddInput msg_conv;
65376         msg_conv.inner = untag_ptr(msg);
65377         msg_conv.is_owned = ptr_is_owned(msg);
65378         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65379         msg_conv = TxAddInput_clone(&msg_conv);
65380         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65381         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
65382         int64_t ret_ref = tag_ptr(ret_copy, true);
65383         return ret_ref;
65384 }
65385
65386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65387         LDKPublicKey node_id_ref;
65388         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65389         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65390         LDKChannelReady msg_conv;
65391         msg_conv.inner = untag_ptr(msg);
65392         msg_conv.is_owned = ptr_is_owned(msg);
65393         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65394         msg_conv = ChannelReady_clone(&msg_conv);
65395         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65396         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
65397         int64_t ret_ref = tag_ptr(ret_copy, true);
65398         return ret_ref;
65399 }
65400
65401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65402         LDKPublicKey node_id_ref;
65403         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65404         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65405         LDKAnnouncementSignatures msg_conv;
65406         msg_conv.inner = untag_ptr(msg);
65407         msg_conv.is_owned = ptr_is_owned(msg);
65408         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65409         msg_conv = AnnouncementSignatures_clone(&msg_conv);
65410         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65411         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
65412         int64_t ret_ref = tag_ptr(ret_copy, true);
65413         return ret_ref;
65414 }
65415
65416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
65417         LDKPublicKey node_id_ref;
65418         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65419         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65420         LDKCommitmentUpdate updates_conv;
65421         updates_conv.inner = untag_ptr(updates);
65422         updates_conv.is_owned = ptr_is_owned(updates);
65423         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
65424         updates_conv = CommitmentUpdate_clone(&updates_conv);
65425         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65426         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
65427         int64_t ret_ref = tag_ptr(ret_copy, true);
65428         return ret_ref;
65429 }
65430
65431 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) {
65432         LDKPublicKey node_id_ref;
65433         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65434         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65435         LDKRevokeAndACK msg_conv;
65436         msg_conv.inner = untag_ptr(msg);
65437         msg_conv.is_owned = ptr_is_owned(msg);
65438         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65439         msg_conv = RevokeAndACK_clone(&msg_conv);
65440         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65441         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
65442         int64_t ret_ref = tag_ptr(ret_copy, true);
65443         return ret_ref;
65444 }
65445
65446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65447         LDKPublicKey node_id_ref;
65448         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65449         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65450         LDKClosingSigned msg_conv;
65451         msg_conv.inner = untag_ptr(msg);
65452         msg_conv.is_owned = ptr_is_owned(msg);
65453         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65454         msg_conv = ClosingSigned_clone(&msg_conv);
65455         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65456         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
65457         int64_t ret_ref = tag_ptr(ret_copy, true);
65458         return ret_ref;
65459 }
65460
65461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65462         LDKPublicKey node_id_ref;
65463         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65464         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65465         LDKShutdown msg_conv;
65466         msg_conv.inner = untag_ptr(msg);
65467         msg_conv.is_owned = ptr_is_owned(msg);
65468         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65469         msg_conv = Shutdown_clone(&msg_conv);
65470         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65471         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
65472         int64_t ret_ref = tag_ptr(ret_copy, true);
65473         return ret_ref;
65474 }
65475
65476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65477         LDKPublicKey node_id_ref;
65478         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65479         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65480         LDKChannelReestablish msg_conv;
65481         msg_conv.inner = untag_ptr(msg);
65482         msg_conv.is_owned = ptr_is_owned(msg);
65483         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65484         msg_conv = ChannelReestablish_clone(&msg_conv);
65485         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65486         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
65487         int64_t ret_ref = tag_ptr(ret_copy, true);
65488         return ret_ref;
65489 }
65490
65491 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) {
65492         LDKPublicKey node_id_ref;
65493         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65494         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65495         LDKChannelAnnouncement msg_conv;
65496         msg_conv.inner = untag_ptr(msg);
65497         msg_conv.is_owned = ptr_is_owned(msg);
65498         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65499         msg_conv = ChannelAnnouncement_clone(&msg_conv);
65500         LDKChannelUpdate update_msg_conv;
65501         update_msg_conv.inner = untag_ptr(update_msg);
65502         update_msg_conv.is_owned = ptr_is_owned(update_msg);
65503         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
65504         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
65505         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65506         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
65507         int64_t ret_ref = tag_ptr(ret_copy, true);
65508         return ret_ref;
65509 }
65510
65511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
65512         LDKChannelAnnouncement msg_conv;
65513         msg_conv.inner = untag_ptr(msg);
65514         msg_conv.is_owned = ptr_is_owned(msg);
65515         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65516         msg_conv = ChannelAnnouncement_clone(&msg_conv);
65517         LDKChannelUpdate update_msg_conv;
65518         update_msg_conv.inner = untag_ptr(update_msg);
65519         update_msg_conv.is_owned = ptr_is_owned(update_msg);
65520         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
65521         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
65522         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65523         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
65524         int64_t ret_ref = tag_ptr(ret_copy, true);
65525         return ret_ref;
65526 }
65527
65528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
65529         LDKChannelUpdate msg_conv;
65530         msg_conv.inner = untag_ptr(msg);
65531         msg_conv.is_owned = ptr_is_owned(msg);
65532         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65533         msg_conv = ChannelUpdate_clone(&msg_conv);
65534         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65535         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
65536         int64_t ret_ref = tag_ptr(ret_copy, true);
65537         return ret_ref;
65538 }
65539
65540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
65541         LDKNodeAnnouncement msg_conv;
65542         msg_conv.inner = untag_ptr(msg);
65543         msg_conv.is_owned = ptr_is_owned(msg);
65544         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65545         msg_conv = NodeAnnouncement_clone(&msg_conv);
65546         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65547         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
65548         int64_t ret_ref = tag_ptr(ret_copy, true);
65549         return ret_ref;
65550 }
65551
65552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
65553         LDKPublicKey node_id_ref;
65554         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65555         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65556         LDKChannelUpdate msg_conv;
65557         msg_conv.inner = untag_ptr(msg);
65558         msg_conv.is_owned = ptr_is_owned(msg);
65559         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65560         msg_conv = ChannelUpdate_clone(&msg_conv);
65561         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65562         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
65563         int64_t ret_ref = tag_ptr(ret_copy, true);
65564         return ret_ref;
65565 }
65566
65567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
65568         LDKPublicKey node_id_ref;
65569         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65570         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65571         void* action_ptr = untag_ptr(action);
65572         CHECK_ACCESS(action_ptr);
65573         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
65574         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
65575         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65576         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
65577         int64_t ret_ref = tag_ptr(ret_copy, true);
65578         return ret_ref;
65579 }
65580
65581 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) {
65582         LDKPublicKey node_id_ref;
65583         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65584         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65585         LDKQueryChannelRange msg_conv;
65586         msg_conv.inner = untag_ptr(msg);
65587         msg_conv.is_owned = ptr_is_owned(msg);
65588         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65589         msg_conv = QueryChannelRange_clone(&msg_conv);
65590         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65591         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
65592         int64_t ret_ref = tag_ptr(ret_copy, true);
65593         return ret_ref;
65594 }
65595
65596 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) {
65597         LDKPublicKey node_id_ref;
65598         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65599         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65600         LDKQueryShortChannelIds msg_conv;
65601         msg_conv.inner = untag_ptr(msg);
65602         msg_conv.is_owned = ptr_is_owned(msg);
65603         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65604         msg_conv = QueryShortChannelIds_clone(&msg_conv);
65605         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65606         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
65607         int64_t ret_ref = tag_ptr(ret_copy, true);
65608         return ret_ref;
65609 }
65610
65611 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) {
65612         LDKPublicKey node_id_ref;
65613         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65614         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65615         LDKReplyChannelRange msg_conv;
65616         msg_conv.inner = untag_ptr(msg);
65617         msg_conv.is_owned = ptr_is_owned(msg);
65618         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65619         msg_conv = ReplyChannelRange_clone(&msg_conv);
65620         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65621         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
65622         int64_t ret_ref = tag_ptr(ret_copy, true);
65623         return ret_ref;
65624 }
65625
65626 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) {
65627         LDKPublicKey node_id_ref;
65628         CHECK((*env)->GetArrayLength(env, node_id) == 33);
65629         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
65630         LDKGossipTimestampFilter msg_conv;
65631         msg_conv.inner = untag_ptr(msg);
65632         msg_conv.is_owned = ptr_is_owned(msg);
65633         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
65634         msg_conv = GossipTimestampFilter_clone(&msg_conv);
65635         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
65636         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
65637         int64_t ret_ref = tag_ptr(ret_copy, true);
65638         return ret_ref;
65639 }
65640
65641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65642         if (!ptr_is_owned(this_ptr)) return;
65643         void* this_ptr_ptr = untag_ptr(this_ptr);
65644         CHECK_ACCESS(this_ptr_ptr);
65645         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
65646         FREE(untag_ptr(this_ptr));
65647         MessageSendEventsProvider_free(this_ptr_conv);
65648 }
65649
65650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65651         if (!ptr_is_owned(this_ptr)) return;
65652         void* this_ptr_ptr = untag_ptr(this_ptr);
65653         CHECK_ACCESS(this_ptr_ptr);
65654         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
65655         FREE(untag_ptr(this_ptr));
65656         OnionMessageProvider_free(this_ptr_conv);
65657 }
65658
65659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65660         if (!ptr_is_owned(this_ptr)) return;
65661         void* this_ptr_ptr = untag_ptr(this_ptr);
65662         CHECK_ACCESS(this_ptr_ptr);
65663         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
65664         FREE(untag_ptr(this_ptr));
65665         EventsProvider_free(this_ptr_conv);
65666 }
65667
65668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
65669         if (!ptr_is_owned(this_ptr)) return;
65670         void* this_ptr_ptr = untag_ptr(this_ptr);
65671         CHECK_ACCESS(this_ptr_ptr);
65672         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
65673         FREE(untag_ptr(this_ptr));
65674         EventHandler_free(this_ptr_conv);
65675 }
65676
65677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65678         LDKChannelDerivationParameters this_obj_conv;
65679         this_obj_conv.inner = untag_ptr(this_obj);
65680         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65682         ChannelDerivationParameters_free(this_obj_conv);
65683 }
65684
65685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
65686         LDKChannelDerivationParameters this_ptr_conv;
65687         this_ptr_conv.inner = untag_ptr(this_ptr);
65688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65690         this_ptr_conv.is_owned = false;
65691         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
65692         return ret_conv;
65693 }
65694
65695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65696         LDKChannelDerivationParameters this_ptr_conv;
65697         this_ptr_conv.inner = untag_ptr(this_ptr);
65698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65700         this_ptr_conv.is_owned = false;
65701         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
65702 }
65703
65704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
65705         LDKChannelDerivationParameters this_ptr_conv;
65706         this_ptr_conv.inner = untag_ptr(this_ptr);
65707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65709         this_ptr_conv.is_owned = false;
65710         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
65711         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
65712         return ret_arr;
65713 }
65714
65715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
65716         LDKChannelDerivationParameters this_ptr_conv;
65717         this_ptr_conv.inner = untag_ptr(this_ptr);
65718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65720         this_ptr_conv.is_owned = false;
65721         LDKThirtyTwoBytes val_ref;
65722         CHECK((*env)->GetArrayLength(env, val) == 32);
65723         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
65724         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
65725 }
65726
65727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
65728         LDKChannelDerivationParameters this_ptr_conv;
65729         this_ptr_conv.inner = untag_ptr(this_ptr);
65730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65732         this_ptr_conv.is_owned = false;
65733         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
65734         int64_t ret_ref = 0;
65735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65737         return ret_ref;
65738 }
65739
65740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65741         LDKChannelDerivationParameters this_ptr_conv;
65742         this_ptr_conv.inner = untag_ptr(this_ptr);
65743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65745         this_ptr_conv.is_owned = false;
65746         LDKChannelTransactionParameters val_conv;
65747         val_conv.inner = untag_ptr(val);
65748         val_conv.is_owned = ptr_is_owned(val);
65749         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65750         val_conv = ChannelTransactionParameters_clone(&val_conv);
65751         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
65752 }
65753
65754 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) {
65755         LDKThirtyTwoBytes keys_id_arg_ref;
65756         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
65757         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
65758         LDKChannelTransactionParameters transaction_parameters_arg_conv;
65759         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
65760         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
65761         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
65762         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
65763         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
65764         int64_t ret_ref = 0;
65765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65767         return ret_ref;
65768 }
65769
65770 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
65771         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
65772         int64_t ret_ref = 0;
65773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65775         return ret_ref;
65776 }
65777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65778         LDKChannelDerivationParameters arg_conv;
65779         arg_conv.inner = untag_ptr(arg);
65780         arg_conv.is_owned = ptr_is_owned(arg);
65781         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65782         arg_conv.is_owned = false;
65783         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
65784         return ret_conv;
65785 }
65786
65787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65788         LDKChannelDerivationParameters orig_conv;
65789         orig_conv.inner = untag_ptr(orig);
65790         orig_conv.is_owned = ptr_is_owned(orig);
65791         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65792         orig_conv.is_owned = false;
65793         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
65794         int64_t ret_ref = 0;
65795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65797         return ret_ref;
65798 }
65799
65800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65801         LDKChannelDerivationParameters a_conv;
65802         a_conv.inner = untag_ptr(a);
65803         a_conv.is_owned = ptr_is_owned(a);
65804         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65805         a_conv.is_owned = false;
65806         LDKChannelDerivationParameters b_conv;
65807         b_conv.inner = untag_ptr(b);
65808         b_conv.is_owned = ptr_is_owned(b);
65809         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65810         b_conv.is_owned = false;
65811         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
65812         return ret_conv;
65813 }
65814
65815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65816         LDKAnchorDescriptor this_obj_conv;
65817         this_obj_conv.inner = untag_ptr(this_obj);
65818         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65820         AnchorDescriptor_free(this_obj_conv);
65821 }
65822
65823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
65824         LDKAnchorDescriptor this_ptr_conv;
65825         this_ptr_conv.inner = untag_ptr(this_ptr);
65826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65828         this_ptr_conv.is_owned = false;
65829         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
65830         int64_t ret_ref = 0;
65831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65833         return ret_ref;
65834 }
65835
65836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65837         LDKAnchorDescriptor this_ptr_conv;
65838         this_ptr_conv.inner = untag_ptr(this_ptr);
65839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65841         this_ptr_conv.is_owned = false;
65842         LDKChannelDerivationParameters val_conv;
65843         val_conv.inner = untag_ptr(val);
65844         val_conv.is_owned = ptr_is_owned(val);
65845         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65846         val_conv = ChannelDerivationParameters_clone(&val_conv);
65847         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
65848 }
65849
65850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
65851         LDKAnchorDescriptor this_ptr_conv;
65852         this_ptr_conv.inner = untag_ptr(this_ptr);
65853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65855         this_ptr_conv.is_owned = false;
65856         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
65857         int64_t ret_ref = 0;
65858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65860         return ret_ref;
65861 }
65862
65863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
65864         LDKAnchorDescriptor this_ptr_conv;
65865         this_ptr_conv.inner = untag_ptr(this_ptr);
65866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
65867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
65868         this_ptr_conv.is_owned = false;
65869         LDKOutPoint val_conv;
65870         val_conv.inner = untag_ptr(val);
65871         val_conv.is_owned = ptr_is_owned(val);
65872         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
65873         val_conv = OutPoint_clone(&val_conv);
65874         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
65875 }
65876
65877 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) {
65878         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
65879         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
65880         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
65881         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
65882         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
65883         LDKOutPoint outpoint_arg_conv;
65884         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
65885         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
65886         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
65887         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
65888         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
65889         int64_t ret_ref = 0;
65890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65892         return ret_ref;
65893 }
65894
65895 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
65896         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
65897         int64_t ret_ref = 0;
65898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65900         return ret_ref;
65901 }
65902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65903         LDKAnchorDescriptor arg_conv;
65904         arg_conv.inner = untag_ptr(arg);
65905         arg_conv.is_owned = ptr_is_owned(arg);
65906         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65907         arg_conv.is_owned = false;
65908         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
65909         return ret_conv;
65910 }
65911
65912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65913         LDKAnchorDescriptor orig_conv;
65914         orig_conv.inner = untag_ptr(orig);
65915         orig_conv.is_owned = ptr_is_owned(orig);
65916         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65917         orig_conv.is_owned = false;
65918         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
65919         int64_t ret_ref = 0;
65920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65922         return ret_ref;
65923 }
65924
65925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65926         LDKAnchorDescriptor a_conv;
65927         a_conv.inner = untag_ptr(a);
65928         a_conv.is_owned = ptr_is_owned(a);
65929         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65930         a_conv.is_owned = false;
65931         LDKAnchorDescriptor b_conv;
65932         b_conv.inner = untag_ptr(b);
65933         b_conv.is_owned = ptr_is_owned(b);
65934         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65935         b_conv.is_owned = false;
65936         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
65937         return ret_conv;
65938 }
65939
65940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
65941         LDKAnchorDescriptor this_arg_conv;
65942         this_arg_conv.inner = untag_ptr(this_arg);
65943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65945         this_arg_conv.is_owned = false;
65946         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
65947         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
65948         return tag_ptr(ret_ref, true);
65949 }
65950
65951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
65952         LDKAnchorDescriptor this_arg_conv;
65953         this_arg_conv.inner = untag_ptr(this_arg);
65954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65956         this_arg_conv.is_owned = false;
65957         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
65958         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
65959         return tag_ptr(ret_ref, true);
65960 }
65961
65962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
65963         LDKAnchorDescriptor this_arg_conv;
65964         this_arg_conv.inner = untag_ptr(this_arg);
65965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65967         this_arg_conv.is_owned = false;
65968         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
65969         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65970         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65971         CVec_u8Z_free(ret_var);
65972         return ret_arr;
65973 }
65974
65975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
65976         LDKAnchorDescriptor this_arg_conv;
65977         this_arg_conv.inner = untag_ptr(this_arg);
65978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65980         this_arg_conv.is_owned = false;
65981         LDKSignature signature_ref;
65982         CHECK((*env)->GetArrayLength(env, signature) == 64);
65983         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
65984         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
65985         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
65986         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
65987         Witness_free(ret_var);
65988         return ret_arr;
65989 }
65990
65991 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) {
65992         LDKAnchorDescriptor this_arg_conv;
65993         this_arg_conv.inner = untag_ptr(this_arg);
65994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65996         this_arg_conv.is_owned = false;
65997         void* signer_provider_ptr = untag_ptr(signer_provider);
65998         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
65999         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
66000         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66001         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
66002         return tag_ptr(ret_ret, true);
66003 }
66004
66005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66006         LDKHTLCDescriptor this_obj_conv;
66007         this_obj_conv.inner = untag_ptr(this_obj);
66008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66010         HTLCDescriptor_free(this_obj_conv);
66011 }
66012
66013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
66014         LDKHTLCDescriptor this_ptr_conv;
66015         this_ptr_conv.inner = untag_ptr(this_ptr);
66016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66018         this_ptr_conv.is_owned = false;
66019         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
66020         int64_t ret_ref = 0;
66021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66023         return ret_ref;
66024 }
66025
66026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66027         LDKHTLCDescriptor this_ptr_conv;
66028         this_ptr_conv.inner = untag_ptr(this_ptr);
66029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66031         this_ptr_conv.is_owned = false;
66032         LDKChannelDerivationParameters val_conv;
66033         val_conv.inner = untag_ptr(val);
66034         val_conv.is_owned = ptr_is_owned(val);
66035         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66036         val_conv = ChannelDerivationParameters_clone(&val_conv);
66037         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
66038 }
66039
66040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
66041         LDKHTLCDescriptor this_ptr_conv;
66042         this_ptr_conv.inner = untag_ptr(this_ptr);
66043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66045         this_ptr_conv.is_owned = false;
66046         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
66047         return ret_conv;
66048 }
66049
66050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66051         LDKHTLCDescriptor this_ptr_conv;
66052         this_ptr_conv.inner = untag_ptr(this_ptr);
66053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66055         this_ptr_conv.is_owned = false;
66056         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
66057 }
66058
66059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
66060         LDKHTLCDescriptor this_ptr_conv;
66061         this_ptr_conv.inner = untag_ptr(this_ptr);
66062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66064         this_ptr_conv.is_owned = false;
66065         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
66066         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
66067         return ret_arr;
66068 }
66069
66070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66071         LDKHTLCDescriptor this_ptr_conv;
66072         this_ptr_conv.inner = untag_ptr(this_ptr);
66073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66075         this_ptr_conv.is_owned = false;
66076         LDKPublicKey val_ref;
66077         CHECK((*env)->GetArrayLength(env, val) == 33);
66078         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
66079         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
66080 }
66081
66082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
66083         LDKHTLCDescriptor this_ptr_conv;
66084         this_ptr_conv.inner = untag_ptr(this_ptr);
66085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66087         this_ptr_conv.is_owned = false;
66088         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
66089         int64_t ret_ref = 0;
66090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66092         return ret_ref;
66093 }
66094
66095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66096         LDKHTLCDescriptor this_ptr_conv;
66097         this_ptr_conv.inner = untag_ptr(this_ptr);
66098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66100         this_ptr_conv.is_owned = false;
66101         LDKHTLCOutputInCommitment val_conv;
66102         val_conv.inner = untag_ptr(val);
66103         val_conv.is_owned = ptr_is_owned(val);
66104         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66105         val_conv = HTLCOutputInCommitment_clone(&val_conv);
66106         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
66107 }
66108
66109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
66110         LDKHTLCDescriptor this_ptr_conv;
66111         this_ptr_conv.inner = untag_ptr(this_ptr);
66112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66114         this_ptr_conv.is_owned = false;
66115         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
66116         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
66117         int64_t ret_ref = tag_ptr(ret_copy, true);
66118         return ret_ref;
66119 }
66120
66121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66122         LDKHTLCDescriptor this_ptr_conv;
66123         this_ptr_conv.inner = untag_ptr(this_ptr);
66124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66126         this_ptr_conv.is_owned = false;
66127         void* val_ptr = untag_ptr(val);
66128         CHECK_ACCESS(val_ptr);
66129         LDKCOption_PaymentPreimageZ val_conv = *(LDKCOption_PaymentPreimageZ*)(val_ptr);
66130         val_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(val));
66131         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
66132 }
66133
66134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
66135         LDKHTLCDescriptor this_ptr_conv;
66136         this_ptr_conv.inner = untag_ptr(this_ptr);
66137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66139         this_ptr_conv.is_owned = false;
66140         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
66141         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
66142         return ret_arr;
66143 }
66144
66145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
66146         LDKHTLCDescriptor this_ptr_conv;
66147         this_ptr_conv.inner = untag_ptr(this_ptr);
66148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66150         this_ptr_conv.is_owned = false;
66151         LDKSignature val_ref;
66152         CHECK((*env)->GetArrayLength(env, val) == 64);
66153         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
66154         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
66155 }
66156
66157 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
66158         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
66159         int64_t ret_ref = 0;
66160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66162         return ret_ref;
66163 }
66164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66165         LDKHTLCDescriptor arg_conv;
66166         arg_conv.inner = untag_ptr(arg);
66167         arg_conv.is_owned = ptr_is_owned(arg);
66168         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66169         arg_conv.is_owned = false;
66170         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
66171         return ret_conv;
66172 }
66173
66174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66175         LDKHTLCDescriptor orig_conv;
66176         orig_conv.inner = untag_ptr(orig);
66177         orig_conv.is_owned = ptr_is_owned(orig);
66178         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66179         orig_conv.is_owned = false;
66180         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
66181         int64_t ret_ref = 0;
66182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66184         return ret_ref;
66185 }
66186
66187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66188         LDKHTLCDescriptor a_conv;
66189         a_conv.inner = untag_ptr(a);
66190         a_conv.is_owned = ptr_is_owned(a);
66191         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66192         a_conv.is_owned = false;
66193         LDKHTLCDescriptor b_conv;
66194         b_conv.inner = untag_ptr(b);
66195         b_conv.is_owned = ptr_is_owned(b);
66196         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66197         b_conv.is_owned = false;
66198         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
66199         return ret_conv;
66200 }
66201
66202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
66203         LDKHTLCDescriptor this_arg_conv;
66204         this_arg_conv.inner = untag_ptr(this_arg);
66205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66207         this_arg_conv.is_owned = false;
66208         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
66209         int64_t ret_ref = 0;
66210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66212         return ret_ref;
66213 }
66214
66215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
66216         LDKHTLCDescriptor this_arg_conv;
66217         this_arg_conv.inner = untag_ptr(this_arg);
66218         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66220         this_arg_conv.is_owned = false;
66221         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66222         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
66223         return tag_ptr(ret_ref, true);
66224 }
66225
66226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
66227         LDKHTLCDescriptor this_arg_conv;
66228         this_arg_conv.inner = untag_ptr(this_arg);
66229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66231         this_arg_conv.is_owned = false;
66232         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
66233         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
66234         return tag_ptr(ret_ref, true);
66235 }
66236
66237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
66238         LDKHTLCDescriptor this_arg_conv;
66239         this_arg_conv.inner = untag_ptr(this_arg);
66240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66242         this_arg_conv.is_owned = false;
66243         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66244         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
66245         return tag_ptr(ret_ref, true);
66246 }
66247
66248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66249         LDKHTLCDescriptor this_arg_conv;
66250         this_arg_conv.inner = untag_ptr(this_arg);
66251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66253         this_arg_conv.is_owned = false;
66254         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
66255         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66256         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66257         CVec_u8Z_free(ret_var);
66258         return ret_arr;
66259 }
66260
66261 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) {
66262         LDKHTLCDescriptor this_arg_conv;
66263         this_arg_conv.inner = untag_ptr(this_arg);
66264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66266         this_arg_conv.is_owned = false;
66267         LDKSignature signature_ref;
66268         CHECK((*env)->GetArrayLength(env, signature) == 64);
66269         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
66270         LDKu8slice witness_script_ref;
66271         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
66272         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
66273         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
66274         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66275         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66276         Witness_free(ret_var);
66277         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
66278         return ret_arr;
66279 }
66280
66281 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) {
66282         LDKHTLCDescriptor this_arg_conv;
66283         this_arg_conv.inner = untag_ptr(this_arg);
66284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66286         this_arg_conv.is_owned = false;
66287         void* signer_provider_ptr = untag_ptr(signer_provider);
66288         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
66289         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
66290         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
66291         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
66292         return tag_ptr(ret_ret, true);
66293 }
66294
66295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66296         if (!ptr_is_owned(this_ptr)) return;
66297         void* this_ptr_ptr = untag_ptr(this_ptr);
66298         CHECK_ACCESS(this_ptr_ptr);
66299         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
66300         FREE(untag_ptr(this_ptr));
66301         BumpTransactionEvent_free(this_ptr_conv);
66302 }
66303
66304 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
66305         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66306         *ret_copy = BumpTransactionEvent_clone(arg);
66307         int64_t ret_ref = tag_ptr(ret_copy, true);
66308         return ret_ref;
66309 }
66310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66311         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
66312         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
66313         return ret_conv;
66314 }
66315
66316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66317         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
66318         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66319         *ret_copy = BumpTransactionEvent_clone(orig_conv);
66320         int64_t ret_ref = tag_ptr(ret_copy, true);
66321         return ret_ref;
66322 }
66323
66324 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) {
66325         LDKThirtyTwoBytes claim_id_ref;
66326         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
66327         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
66328         LDKTransaction commitment_tx_ref;
66329         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
66330         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
66331         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
66332         commitment_tx_ref.data_is_owned = true;
66333         LDKAnchorDescriptor anchor_descriptor_conv;
66334         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
66335         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
66336         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
66337         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
66338         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
66339         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
66340         if (pending_htlcs_constr.datalen > 0)
66341                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
66342         else
66343                 pending_htlcs_constr.data = NULL;
66344         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
66345         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
66346                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
66347                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
66348                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
66349                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
66350                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
66351                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
66352                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
66353         }
66354         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
66355         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66356         *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);
66357         int64_t ret_ref = tag_ptr(ret_copy, true);
66358         return ret_ref;
66359 }
66360
66361 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) {
66362         LDKThirtyTwoBytes claim_id_ref;
66363         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
66364         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
66365         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
66366         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
66367         if (htlc_descriptors_constr.datalen > 0)
66368                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
66369         else
66370                 htlc_descriptors_constr.data = NULL;
66371         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
66372         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
66373                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
66374                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
66375                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
66376                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
66377                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
66378                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
66379                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
66380         }
66381         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
66382         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
66383         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
66384         int64_t ret_ref = tag_ptr(ret_copy, true);
66385         return ret_ref;
66386 }
66387
66388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66389         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
66390         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
66391         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
66392         return ret_conv;
66393 }
66394
66395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66396         LDKInput this_obj_conv;
66397         this_obj_conv.inner = untag_ptr(this_obj);
66398         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66400         Input_free(this_obj_conv);
66401 }
66402
66403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66404         LDKInput this_ptr_conv;
66405         this_ptr_conv.inner = untag_ptr(this_ptr);
66406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66408         this_ptr_conv.is_owned = false;
66409         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
66410         int64_t ret_ref = 0;
66411         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66412         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66413         return ret_ref;
66414 }
66415
66416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66417         LDKInput this_ptr_conv;
66418         this_ptr_conv.inner = untag_ptr(this_ptr);
66419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66421         this_ptr_conv.is_owned = false;
66422         LDKOutPoint val_conv;
66423         val_conv.inner = untag_ptr(val);
66424         val_conv.is_owned = ptr_is_owned(val);
66425         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66426         val_conv = OutPoint_clone(&val_conv);
66427         Input_set_outpoint(&this_ptr_conv, val_conv);
66428 }
66429
66430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
66431         LDKInput this_ptr_conv;
66432         this_ptr_conv.inner = untag_ptr(this_ptr);
66433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66435         this_ptr_conv.is_owned = false;
66436         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66437         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
66438         return tag_ptr(ret_ref, true);
66439 }
66440
66441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66442         LDKInput this_ptr_conv;
66443         this_ptr_conv.inner = untag_ptr(this_ptr);
66444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66446         this_ptr_conv.is_owned = false;
66447         void* val_ptr = untag_ptr(val);
66448         CHECK_ACCESS(val_ptr);
66449         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66450         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66451         Input_set_previous_utxo(&this_ptr_conv, val_conv);
66452 }
66453
66454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
66455         LDKInput this_ptr_conv;
66456         this_ptr_conv.inner = untag_ptr(this_ptr);
66457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66459         this_ptr_conv.is_owned = false;
66460         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
66461         return ret_conv;
66462 }
66463
66464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66465         LDKInput this_ptr_conv;
66466         this_ptr_conv.inner = untag_ptr(this_ptr);
66467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66469         this_ptr_conv.is_owned = false;
66470         Input_set_satisfaction_weight(&this_ptr_conv, val);
66471 }
66472
66473 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) {
66474         LDKOutPoint outpoint_arg_conv;
66475         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66476         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66477         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66478         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66479         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
66480         CHECK_ACCESS(previous_utxo_arg_ptr);
66481         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
66482         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
66483         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
66484         int64_t ret_ref = 0;
66485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66487         return ret_ref;
66488 }
66489
66490 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
66491         LDKInput ret_var = Input_clone(arg);
66492         int64_t ret_ref = 0;
66493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66495         return ret_ref;
66496 }
66497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66498         LDKInput arg_conv;
66499         arg_conv.inner = untag_ptr(arg);
66500         arg_conv.is_owned = ptr_is_owned(arg);
66501         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66502         arg_conv.is_owned = false;
66503         int64_t ret_conv = Input_clone_ptr(&arg_conv);
66504         return ret_conv;
66505 }
66506
66507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66508         LDKInput orig_conv;
66509         orig_conv.inner = untag_ptr(orig);
66510         orig_conv.is_owned = ptr_is_owned(orig);
66511         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66512         orig_conv.is_owned = false;
66513         LDKInput ret_var = Input_clone(&orig_conv);
66514         int64_t ret_ref = 0;
66515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66517         return ret_ref;
66518 }
66519
66520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
66521         LDKInput o_conv;
66522         o_conv.inner = untag_ptr(o);
66523         o_conv.is_owned = ptr_is_owned(o);
66524         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66525         o_conv.is_owned = false;
66526         int64_t ret_conv = Input_hash(&o_conv);
66527         return ret_conv;
66528 }
66529
66530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66531         LDKInput a_conv;
66532         a_conv.inner = untag_ptr(a);
66533         a_conv.is_owned = ptr_is_owned(a);
66534         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66535         a_conv.is_owned = false;
66536         LDKInput b_conv;
66537         b_conv.inner = untag_ptr(b);
66538         b_conv.is_owned = ptr_is_owned(b);
66539         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66540         b_conv.is_owned = false;
66541         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
66542         return ret_conv;
66543 }
66544
66545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66546         LDKUtxo this_obj_conv;
66547         this_obj_conv.inner = untag_ptr(this_obj);
66548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66550         Utxo_free(this_obj_conv);
66551 }
66552
66553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
66554         LDKUtxo this_ptr_conv;
66555         this_ptr_conv.inner = untag_ptr(this_ptr);
66556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66558         this_ptr_conv.is_owned = false;
66559         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
66560         int64_t ret_ref = 0;
66561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66563         return ret_ref;
66564 }
66565
66566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66567         LDKUtxo this_ptr_conv;
66568         this_ptr_conv.inner = untag_ptr(this_ptr);
66569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66571         this_ptr_conv.is_owned = false;
66572         LDKOutPoint val_conv;
66573         val_conv.inner = untag_ptr(val);
66574         val_conv.is_owned = ptr_is_owned(val);
66575         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
66576         val_conv = OutPoint_clone(&val_conv);
66577         Utxo_set_outpoint(&this_ptr_conv, val_conv);
66578 }
66579
66580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
66581         LDKUtxo this_ptr_conv;
66582         this_ptr_conv.inner = untag_ptr(this_ptr);
66583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66585         this_ptr_conv.is_owned = false;
66586         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
66587         *ret_ref = Utxo_get_output(&this_ptr_conv);
66588         return tag_ptr(ret_ref, true);
66589 }
66590
66591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66592         LDKUtxo this_ptr_conv;
66593         this_ptr_conv.inner = untag_ptr(this_ptr);
66594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66596         this_ptr_conv.is_owned = false;
66597         void* val_ptr = untag_ptr(val);
66598         CHECK_ACCESS(val_ptr);
66599         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
66600         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
66601         Utxo_set_output(&this_ptr_conv, val_conv);
66602 }
66603
66604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
66605         LDKUtxo this_ptr_conv;
66606         this_ptr_conv.inner = untag_ptr(this_ptr);
66607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66609         this_ptr_conv.is_owned = false;
66610         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
66611         return ret_conv;
66612 }
66613
66614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66615         LDKUtxo this_ptr_conv;
66616         this_ptr_conv.inner = untag_ptr(this_ptr);
66617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66619         this_ptr_conv.is_owned = false;
66620         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
66621 }
66622
66623 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) {
66624         LDKOutPoint outpoint_arg_conv;
66625         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
66626         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
66627         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
66628         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
66629         void* output_arg_ptr = untag_ptr(output_arg);
66630         CHECK_ACCESS(output_arg_ptr);
66631         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
66632         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
66633         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
66634         int64_t ret_ref = 0;
66635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66637         return ret_ref;
66638 }
66639
66640 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
66641         LDKUtxo ret_var = Utxo_clone(arg);
66642         int64_t ret_ref = 0;
66643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66645         return ret_ref;
66646 }
66647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66648         LDKUtxo arg_conv;
66649         arg_conv.inner = untag_ptr(arg);
66650         arg_conv.is_owned = ptr_is_owned(arg);
66651         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66652         arg_conv.is_owned = false;
66653         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
66654         return ret_conv;
66655 }
66656
66657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66658         LDKUtxo orig_conv;
66659         orig_conv.inner = untag_ptr(orig);
66660         orig_conv.is_owned = ptr_is_owned(orig);
66661         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66662         orig_conv.is_owned = false;
66663         LDKUtxo ret_var = Utxo_clone(&orig_conv);
66664         int64_t ret_ref = 0;
66665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66667         return ret_ref;
66668 }
66669
66670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
66671         LDKUtxo o_conv;
66672         o_conv.inner = untag_ptr(o);
66673         o_conv.is_owned = ptr_is_owned(o);
66674         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
66675         o_conv.is_owned = false;
66676         int64_t ret_conv = Utxo_hash(&o_conv);
66677         return ret_conv;
66678 }
66679
66680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
66681         LDKUtxo a_conv;
66682         a_conv.inner = untag_ptr(a);
66683         a_conv.is_owned = ptr_is_owned(a);
66684         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
66685         a_conv.is_owned = false;
66686         LDKUtxo b_conv;
66687         b_conv.inner = untag_ptr(b);
66688         b_conv.is_owned = ptr_is_owned(b);
66689         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
66690         b_conv.is_owned = false;
66691         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
66692         return ret_conv;
66693 }
66694
66695 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) {
66696         LDKOutPoint outpoint_conv;
66697         outpoint_conv.inner = untag_ptr(outpoint);
66698         outpoint_conv.is_owned = ptr_is_owned(outpoint);
66699         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
66700         outpoint_conv = OutPoint_clone(&outpoint_conv);
66701         uint8_t pubkey_hash_arr[20];
66702         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
66703         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
66704         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
66705         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
66706         int64_t ret_ref = 0;
66707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66709         return ret_ref;
66710 }
66711
66712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66713         LDKCoinSelection this_obj_conv;
66714         this_obj_conv.inner = untag_ptr(this_obj);
66715         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66717         CoinSelection_free(this_obj_conv);
66718 }
66719
66720 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
66721         LDKCoinSelection this_ptr_conv;
66722         this_ptr_conv.inner = untag_ptr(this_ptr);
66723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66725         this_ptr_conv.is_owned = false;
66726         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
66727         int64_tArray ret_arr = NULL;
66728         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
66729         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
66730         for (size_t g = 0; g < ret_var.datalen; g++) {
66731                 LDKUtxo ret_conv_6_var = ret_var.data[g];
66732                 int64_t ret_conv_6_ref = 0;
66733                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
66734                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
66735                 ret_arr_ptr[g] = ret_conv_6_ref;
66736         }
66737         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
66738         FREE(ret_var.data);
66739         return ret_arr;
66740 }
66741
66742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
66743         LDKCoinSelection this_ptr_conv;
66744         this_ptr_conv.inner = untag_ptr(this_ptr);
66745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66747         this_ptr_conv.is_owned = false;
66748         LDKCVec_UtxoZ val_constr;
66749         val_constr.datalen = (*env)->GetArrayLength(env, val);
66750         if (val_constr.datalen > 0)
66751                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
66752         else
66753                 val_constr.data = NULL;
66754         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
66755         for (size_t g = 0; g < val_constr.datalen; g++) {
66756                 int64_t val_conv_6 = val_vals[g];
66757                 LDKUtxo val_conv_6_conv;
66758                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
66759                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
66760                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
66761                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
66762                 val_constr.data[g] = val_conv_6_conv;
66763         }
66764         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
66765         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
66766 }
66767
66768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
66769         LDKCoinSelection this_ptr_conv;
66770         this_ptr_conv.inner = untag_ptr(this_ptr);
66771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66773         this_ptr_conv.is_owned = false;
66774         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
66775         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
66776         int64_t ret_ref = tag_ptr(ret_copy, true);
66777         return ret_ref;
66778 }
66779
66780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
66781         LDKCoinSelection this_ptr_conv;
66782         this_ptr_conv.inner = untag_ptr(this_ptr);
66783         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
66784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
66785         this_ptr_conv.is_owned = false;
66786         void* val_ptr = untag_ptr(val);
66787         CHECK_ACCESS(val_ptr);
66788         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
66789         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
66790         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
66791 }
66792
66793 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) {
66794         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
66795         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
66796         if (confirmed_utxos_arg_constr.datalen > 0)
66797                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
66798         else
66799                 confirmed_utxos_arg_constr.data = NULL;
66800         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
66801         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
66802                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
66803                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
66804                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
66805                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
66806                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
66807                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
66808                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
66809         }
66810         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
66811         void* change_output_arg_ptr = untag_ptr(change_output_arg);
66812         CHECK_ACCESS(change_output_arg_ptr);
66813         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
66814         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
66815         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
66816         int64_t ret_ref = 0;
66817         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66818         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66819         return ret_ref;
66820 }
66821
66822 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
66823         LDKCoinSelection ret_var = CoinSelection_clone(arg);
66824         int64_t ret_ref = 0;
66825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66827         return ret_ref;
66828 }
66829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
66830         LDKCoinSelection arg_conv;
66831         arg_conv.inner = untag_ptr(arg);
66832         arg_conv.is_owned = ptr_is_owned(arg);
66833         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
66834         arg_conv.is_owned = false;
66835         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
66836         return ret_conv;
66837 }
66838
66839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
66840         LDKCoinSelection orig_conv;
66841         orig_conv.inner = untag_ptr(orig);
66842         orig_conv.is_owned = ptr_is_owned(orig);
66843         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
66844         orig_conv.is_owned = false;
66845         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
66846         int64_t ret_ref = 0;
66847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66849         return ret_ref;
66850 }
66851
66852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66853         if (!ptr_is_owned(this_ptr)) return;
66854         void* this_ptr_ptr = untag_ptr(this_ptr);
66855         CHECK_ACCESS(this_ptr_ptr);
66856         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
66857         FREE(untag_ptr(this_ptr));
66858         CoinSelectionSource_free(this_ptr_conv);
66859 }
66860
66861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
66862         if (!ptr_is_owned(this_ptr)) return;
66863         void* this_ptr_ptr = untag_ptr(this_ptr);
66864         CHECK_ACCESS(this_ptr_ptr);
66865         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
66866         FREE(untag_ptr(this_ptr));
66867         WalletSource_free(this_ptr_conv);
66868 }
66869
66870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66871         LDKWallet this_obj_conv;
66872         this_obj_conv.inner = untag_ptr(this_obj);
66873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66875         Wallet_free(this_obj_conv);
66876 }
66877
66878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
66879         void* source_ptr = untag_ptr(source);
66880         CHECK_ACCESS(source_ptr);
66881         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
66882         if (source_conv.free == LDKWalletSource_JCalls_free) {
66883                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66884                 LDKWalletSource_JCalls_cloned(&source_conv);
66885         }
66886         void* logger_ptr = untag_ptr(logger);
66887         CHECK_ACCESS(logger_ptr);
66888         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66889         if (logger_conv.free == LDKLogger_JCalls_free) {
66890                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66891                 LDKLogger_JCalls_cloned(&logger_conv);
66892         }
66893         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
66894         int64_t ret_ref = 0;
66895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66897         return ret_ref;
66898 }
66899
66900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
66901         LDKWallet this_arg_conv;
66902         this_arg_conv.inner = untag_ptr(this_arg);
66903         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66905         this_arg_conv.is_owned = false;
66906         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
66907         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
66908         return tag_ptr(ret_ret, true);
66909 }
66910
66911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66912         LDKBumpTransactionEventHandler this_obj_conv;
66913         this_obj_conv.inner = untag_ptr(this_obj);
66914         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66916         BumpTransactionEventHandler_free(this_obj_conv);
66917 }
66918
66919 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) {
66920         void* broadcaster_ptr = untag_ptr(broadcaster);
66921         CHECK_ACCESS(broadcaster_ptr);
66922         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
66923         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
66924                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66925                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
66926         }
66927         void* utxo_source_ptr = untag_ptr(utxo_source);
66928         CHECK_ACCESS(utxo_source_ptr);
66929         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
66930         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
66931                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66932                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
66933         }
66934         void* signer_provider_ptr = untag_ptr(signer_provider);
66935         CHECK_ACCESS(signer_provider_ptr);
66936         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
66937         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
66938                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66939                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
66940         }
66941         void* logger_ptr = untag_ptr(logger);
66942         CHECK_ACCESS(logger_ptr);
66943         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
66944         if (logger_conv.free == LDKLogger_JCalls_free) {
66945                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
66946                 LDKLogger_JCalls_cloned(&logger_conv);
66947         }
66948         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
66949         int64_t ret_ref = 0;
66950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66952         return ret_ref;
66953 }
66954
66955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
66956         LDKBumpTransactionEventHandler this_arg_conv;
66957         this_arg_conv.inner = untag_ptr(this_arg);
66958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66960         this_arg_conv.is_owned = false;
66961         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
66962         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
66963 }
66964
66965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
66966         LDKFilesystemPersister this_obj_conv;
66967         this_obj_conv.inner = untag_ptr(this_obj);
66968         this_obj_conv.is_owned = ptr_is_owned(this_obj);
66969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
66970         FilesystemPersister_free(this_obj_conv);
66971 }
66972
66973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
66974         LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
66975         LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
66976         int64_t ret_ref = 0;
66977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66979         return ret_ref;
66980 }
66981
66982 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
66983         LDKFilesystemPersister this_arg_conv;
66984         this_arg_conv.inner = untag_ptr(this_arg);
66985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66987         this_arg_conv.is_owned = false;
66988         LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
66989         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
66990         Str_free(ret_str);
66991         return ret_conv;
66992 }
66993
66994 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) {
66995         LDKFilesystemPersister this_arg_conv;
66996         this_arg_conv.inner = untag_ptr(this_arg);
66997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66999         this_arg_conv.is_owned = false;
67000         void* entropy_source_ptr = untag_ptr(entropy_source);
67001         CHECK_ACCESS(entropy_source_ptr);
67002         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
67003         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
67004                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67005                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
67006         }
67007         void* signer_provider_ptr = untag_ptr(signer_provider);
67008         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
67009         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
67010         LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
67011         *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, entropy_source_conv, signer_provider_conv);
67012         return tag_ptr(ret_conv, true);
67013 }
67014
67015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67016         LDKBackgroundProcessor this_obj_conv;
67017         this_obj_conv.inner = untag_ptr(this_obj);
67018         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67020         BackgroundProcessor_free(this_obj_conv);
67021 }
67022
67023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67024         if (!ptr_is_owned(this_ptr)) return;
67025         void* this_ptr_ptr = untag_ptr(this_ptr);
67026         CHECK_ACCESS(this_ptr_ptr);
67027         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
67028         FREE(untag_ptr(this_ptr));
67029         GossipSync_free(this_ptr_conv);
67030 }
67031
67032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
67033         LDKP2PGossipSync a_conv;
67034         a_conv.inner = untag_ptr(a);
67035         a_conv.is_owned = ptr_is_owned(a);
67036         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67037         a_conv.is_owned = false;
67038         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67039         *ret_copy = GossipSync_p2_p(&a_conv);
67040         int64_t ret_ref = tag_ptr(ret_copy, true);
67041         return ret_ref;
67042 }
67043
67044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
67045         LDKRapidGossipSync a_conv;
67046         a_conv.inner = untag_ptr(a);
67047         a_conv.is_owned = ptr_is_owned(a);
67048         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67049         a_conv.is_owned = false;
67050         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67051         *ret_copy = GossipSync_rapid(&a_conv);
67052         int64_t ret_ref = tag_ptr(ret_copy, true);
67053         return ret_ref;
67054 }
67055
67056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
67057         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
67058         *ret_copy = GossipSync_none();
67059         int64_t ret_ref = tag_ptr(ret_copy, true);
67060         return ret_ref;
67061 }
67062
67063 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) {
67064         void* persister_ptr = untag_ptr(persister);
67065         CHECK_ACCESS(persister_ptr);
67066         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
67067         if (persister_conv.free == LDKPersister_JCalls_free) {
67068                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67069                 LDKPersister_JCalls_cloned(&persister_conv);
67070         }
67071         void* event_handler_ptr = untag_ptr(event_handler);
67072         CHECK_ACCESS(event_handler_ptr);
67073         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
67074         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
67075                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67076                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
67077         }
67078         LDKChainMonitor chain_monitor_conv;
67079         chain_monitor_conv.inner = untag_ptr(chain_monitor);
67080         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
67081         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
67082         chain_monitor_conv.is_owned = false;
67083         LDKChannelManager channel_manager_conv;
67084         channel_manager_conv.inner = untag_ptr(channel_manager);
67085         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
67086         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
67087         channel_manager_conv.is_owned = false;
67088         void* gossip_sync_ptr = untag_ptr(gossip_sync);
67089         CHECK_ACCESS(gossip_sync_ptr);
67090         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
67091         // WARNING: we may need a move here but no clone is available for LDKGossipSync
67092         LDKPeerManager peer_manager_conv;
67093         peer_manager_conv.inner = untag_ptr(peer_manager);
67094         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
67095         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
67096         peer_manager_conv.is_owned = false;
67097         void* logger_ptr = untag_ptr(logger);
67098         CHECK_ACCESS(logger_ptr);
67099         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
67100         if (logger_conv.free == LDKLogger_JCalls_free) {
67101                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67102                 LDKLogger_JCalls_cloned(&logger_conv);
67103         }
67104         void* scorer_ptr = untag_ptr(scorer);
67105         CHECK_ACCESS(scorer_ptr);
67106         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
67107         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
67108         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
67109                 // Manually implement clone for Java trait instances
67110                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
67111                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
67112                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
67113                 }
67114         }
67115         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);
67116         int64_t ret_ref = 0;
67117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67119         return ret_ref;
67120 }
67121
67122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
67123         LDKBackgroundProcessor this_arg_conv;
67124         this_arg_conv.inner = untag_ptr(this_arg);
67125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67127         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
67128         
67129         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
67130         *ret_conv = BackgroundProcessor_join(this_arg_conv);
67131         return tag_ptr(ret_conv, true);
67132 }
67133
67134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
67135         LDKBackgroundProcessor this_arg_conv;
67136         this_arg_conv.inner = untag_ptr(this_arg);
67137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67139         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
67140         
67141         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
67142         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
67143         return tag_ptr(ret_conv, true);
67144 }
67145
67146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67147         if (!ptr_is_owned(this_ptr)) return;
67148         void* this_ptr_ptr = untag_ptr(this_ptr);
67149         CHECK_ACCESS(this_ptr_ptr);
67150         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
67151         FREE(untag_ptr(this_ptr));
67152         Bolt11ParseError_free(this_ptr_conv);
67153 }
67154
67155 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
67156         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67157         *ret_copy = Bolt11ParseError_clone(arg);
67158         int64_t ret_ref = tag_ptr(ret_copy, true);
67159         return ret_ref;
67160 }
67161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67162         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
67163         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
67164         return ret_conv;
67165 }
67166
67167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67168         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
67169         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67170         *ret_copy = Bolt11ParseError_clone(orig_conv);
67171         int64_t ret_ref = tag_ptr(ret_copy, true);
67172         return ret_ref;
67173 }
67174
67175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
67176         void* a_ptr = untag_ptr(a);
67177         CHECK_ACCESS(a_ptr);
67178         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
67179         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
67180         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67181         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
67182         int64_t ret_ref = tag_ptr(ret_copy, true);
67183         return ret_ref;
67184 }
67185
67186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
67187         
67188         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67189         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
67190         int64_t ret_ref = tag_ptr(ret_copy, true);
67191         return ret_ref;
67192 }
67193
67194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
67195         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
67196         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67197         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
67198         int64_t ret_ref = tag_ptr(ret_copy, true);
67199         return ret_ref;
67200 }
67201
67202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
67203         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67204         *ret_copy = Bolt11ParseError_bad_prefix();
67205         int64_t ret_ref = tag_ptr(ret_copy, true);
67206         return ret_ref;
67207 }
67208
67209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
67210         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67211         *ret_copy = Bolt11ParseError_unknown_currency();
67212         int64_t ret_ref = tag_ptr(ret_copy, true);
67213         return ret_ref;
67214 }
67215
67216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
67217         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67218         *ret_copy = Bolt11ParseError_unknown_si_prefix();
67219         int64_t ret_ref = tag_ptr(ret_copy, true);
67220         return ret_ref;
67221 }
67222
67223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
67224         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67225         *ret_copy = Bolt11ParseError_malformed_hrp();
67226         int64_t ret_ref = tag_ptr(ret_copy, true);
67227         return ret_ref;
67228 }
67229
67230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
67231         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67232         *ret_copy = Bolt11ParseError_too_short_data_part();
67233         int64_t ret_ref = tag_ptr(ret_copy, true);
67234         return ret_ref;
67235 }
67236
67237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
67238         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67239         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
67240         int64_t ret_ref = tag_ptr(ret_copy, true);
67241         return ret_ref;
67242 }
67243
67244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
67245         
67246         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67247         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
67248         int64_t ret_ref = tag_ptr(ret_copy, true);
67249         return ret_ref;
67250 }
67251
67252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
67253         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67254         *ret_copy = Bolt11ParseError_padding_error();
67255         int64_t ret_ref = tag_ptr(ret_copy, true);
67256         return ret_ref;
67257 }
67258
67259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
67260         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67261         *ret_copy = Bolt11ParseError_integer_overflow_error();
67262         int64_t ret_ref = tag_ptr(ret_copy, true);
67263         return ret_ref;
67264 }
67265
67266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
67267         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67268         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
67269         int64_t ret_ref = tag_ptr(ret_copy, true);
67270         return ret_ref;
67271 }
67272
67273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
67274         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67275         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
67276         int64_t ret_ref = tag_ptr(ret_copy, true);
67277         return ret_ref;
67278 }
67279
67280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
67281         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67282         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
67283         int64_t ret_ref = tag_ptr(ret_copy, true);
67284         return ret_ref;
67285 }
67286
67287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
67288         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67289         *ret_copy = Bolt11ParseError_invalid_recovery_id();
67290         int64_t ret_ref = tag_ptr(ret_copy, true);
67291         return ret_ref;
67292 }
67293
67294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
67295         LDKStr a_conv = java_to_owned_str(env, a);
67296         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67297         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
67298         int64_t ret_ref = tag_ptr(ret_copy, true);
67299         return ret_ref;
67300 }
67301
67302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
67303         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
67304         *ret_copy = Bolt11ParseError_skip();
67305         int64_t ret_ref = tag_ptr(ret_copy, true);
67306         return ret_ref;
67307 }
67308
67309 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67310         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
67311         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
67312         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
67313         return ret_conv;
67314 }
67315
67316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
67317         if (!ptr_is_owned(this_ptr)) return;
67318         void* this_ptr_ptr = untag_ptr(this_ptr);
67319         CHECK_ACCESS(this_ptr_ptr);
67320         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
67321         FREE(untag_ptr(this_ptr));
67322         ParseOrSemanticError_free(this_ptr_conv);
67323 }
67324
67325 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
67326         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67327         *ret_copy = ParseOrSemanticError_clone(arg);
67328         int64_t ret_ref = tag_ptr(ret_copy, true);
67329         return ret_ref;
67330 }
67331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67332         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
67333         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
67334         return ret_conv;
67335 }
67336
67337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67338         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
67339         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67340         *ret_copy = ParseOrSemanticError_clone(orig_conv);
67341         int64_t ret_ref = tag_ptr(ret_copy, true);
67342         return ret_ref;
67343 }
67344
67345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
67346         void* a_ptr = untag_ptr(a);
67347         CHECK_ACCESS(a_ptr);
67348         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
67349         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
67350         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67351         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
67352         int64_t ret_ref = tag_ptr(ret_copy, true);
67353         return ret_ref;
67354 }
67355
67356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
67357         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
67358         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
67359         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
67360         int64_t ret_ref = tag_ptr(ret_copy, true);
67361         return ret_ref;
67362 }
67363
67364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67365         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
67366         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
67367         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
67368         return ret_conv;
67369 }
67370
67371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67372         LDKBolt11Invoice this_obj_conv;
67373         this_obj_conv.inner = untag_ptr(this_obj);
67374         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67376         Bolt11Invoice_free(this_obj_conv);
67377 }
67378
67379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67380         LDKBolt11Invoice a_conv;
67381         a_conv.inner = untag_ptr(a);
67382         a_conv.is_owned = ptr_is_owned(a);
67383         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67384         a_conv.is_owned = false;
67385         LDKBolt11Invoice b_conv;
67386         b_conv.inner = untag_ptr(b);
67387         b_conv.is_owned = ptr_is_owned(b);
67388         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67389         b_conv.is_owned = false;
67390         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
67391         return ret_conv;
67392 }
67393
67394 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
67395         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
67396         int64_t ret_ref = 0;
67397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67399         return ret_ref;
67400 }
67401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67402         LDKBolt11Invoice arg_conv;
67403         arg_conv.inner = untag_ptr(arg);
67404         arg_conv.is_owned = ptr_is_owned(arg);
67405         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67406         arg_conv.is_owned = false;
67407         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
67408         return ret_conv;
67409 }
67410
67411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67412         LDKBolt11Invoice orig_conv;
67413         orig_conv.inner = untag_ptr(orig);
67414         orig_conv.is_owned = ptr_is_owned(orig);
67415         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67416         orig_conv.is_owned = false;
67417         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
67418         int64_t ret_ref = 0;
67419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67421         return ret_ref;
67422 }
67423
67424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
67425         LDKBolt11Invoice o_conv;
67426         o_conv.inner = untag_ptr(o);
67427         o_conv.is_owned = ptr_is_owned(o);
67428         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67429         o_conv.is_owned = false;
67430         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
67431         return ret_conv;
67432 }
67433
67434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67435         LDKSignedRawBolt11Invoice this_obj_conv;
67436         this_obj_conv.inner = untag_ptr(this_obj);
67437         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67439         SignedRawBolt11Invoice_free(this_obj_conv);
67440 }
67441
67442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67443         LDKSignedRawBolt11Invoice a_conv;
67444         a_conv.inner = untag_ptr(a);
67445         a_conv.is_owned = ptr_is_owned(a);
67446         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67447         a_conv.is_owned = false;
67448         LDKSignedRawBolt11Invoice b_conv;
67449         b_conv.inner = untag_ptr(b);
67450         b_conv.is_owned = ptr_is_owned(b);
67451         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67452         b_conv.is_owned = false;
67453         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
67454         return ret_conv;
67455 }
67456
67457 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
67458         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
67459         int64_t ret_ref = 0;
67460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67462         return ret_ref;
67463 }
67464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67465         LDKSignedRawBolt11Invoice arg_conv;
67466         arg_conv.inner = untag_ptr(arg);
67467         arg_conv.is_owned = ptr_is_owned(arg);
67468         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67469         arg_conv.is_owned = false;
67470         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
67471         return ret_conv;
67472 }
67473
67474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67475         LDKSignedRawBolt11Invoice orig_conv;
67476         orig_conv.inner = untag_ptr(orig);
67477         orig_conv.is_owned = ptr_is_owned(orig);
67478         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67479         orig_conv.is_owned = false;
67480         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
67481         int64_t ret_ref = 0;
67482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67484         return ret_ref;
67485 }
67486
67487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
67488         LDKSignedRawBolt11Invoice o_conv;
67489         o_conv.inner = untag_ptr(o);
67490         o_conv.is_owned = ptr_is_owned(o);
67491         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67492         o_conv.is_owned = false;
67493         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
67494         return ret_conv;
67495 }
67496
67497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67498         LDKRawBolt11Invoice this_obj_conv;
67499         this_obj_conv.inner = untag_ptr(this_obj);
67500         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67502         RawBolt11Invoice_free(this_obj_conv);
67503 }
67504
67505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
67506         LDKRawBolt11Invoice this_ptr_conv;
67507         this_ptr_conv.inner = untag_ptr(this_ptr);
67508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67510         this_ptr_conv.is_owned = false;
67511         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
67512         int64_t ret_ref = 0;
67513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67515         return ret_ref;
67516 }
67517
67518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67519         LDKRawBolt11Invoice this_ptr_conv;
67520         this_ptr_conv.inner = untag_ptr(this_ptr);
67521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67523         this_ptr_conv.is_owned = false;
67524         LDKRawDataPart val_conv;
67525         val_conv.inner = untag_ptr(val);
67526         val_conv.is_owned = ptr_is_owned(val);
67527         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67528         val_conv = RawDataPart_clone(&val_conv);
67529         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
67530 }
67531
67532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67533         LDKRawBolt11Invoice a_conv;
67534         a_conv.inner = untag_ptr(a);
67535         a_conv.is_owned = ptr_is_owned(a);
67536         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67537         a_conv.is_owned = false;
67538         LDKRawBolt11Invoice b_conv;
67539         b_conv.inner = untag_ptr(b);
67540         b_conv.is_owned = ptr_is_owned(b);
67541         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67542         b_conv.is_owned = false;
67543         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
67544         return ret_conv;
67545 }
67546
67547 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
67548         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
67549         int64_t ret_ref = 0;
67550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67552         return ret_ref;
67553 }
67554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67555         LDKRawBolt11Invoice arg_conv;
67556         arg_conv.inner = untag_ptr(arg);
67557         arg_conv.is_owned = ptr_is_owned(arg);
67558         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67559         arg_conv.is_owned = false;
67560         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
67561         return ret_conv;
67562 }
67563
67564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67565         LDKRawBolt11Invoice orig_conv;
67566         orig_conv.inner = untag_ptr(orig);
67567         orig_conv.is_owned = ptr_is_owned(orig);
67568         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67569         orig_conv.is_owned = false;
67570         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
67571         int64_t ret_ref = 0;
67572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67574         return ret_ref;
67575 }
67576
67577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
67578         LDKRawBolt11Invoice o_conv;
67579         o_conv.inner = untag_ptr(o);
67580         o_conv.is_owned = ptr_is_owned(o);
67581         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67582         o_conv.is_owned = false;
67583         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
67584         return ret_conv;
67585 }
67586
67587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67588         LDKRawDataPart this_obj_conv;
67589         this_obj_conv.inner = untag_ptr(this_obj);
67590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67592         RawDataPart_free(this_obj_conv);
67593 }
67594
67595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
67596         LDKRawDataPart this_ptr_conv;
67597         this_ptr_conv.inner = untag_ptr(this_ptr);
67598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67600         this_ptr_conv.is_owned = false;
67601         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
67602         int64_t ret_ref = 0;
67603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67605         return ret_ref;
67606 }
67607
67608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
67609         LDKRawDataPart this_ptr_conv;
67610         this_ptr_conv.inner = untag_ptr(this_ptr);
67611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67613         this_ptr_conv.is_owned = false;
67614         LDKPositiveTimestamp val_conv;
67615         val_conv.inner = untag_ptr(val);
67616         val_conv.is_owned = ptr_is_owned(val);
67617         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
67618         val_conv = PositiveTimestamp_clone(&val_conv);
67619         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
67620 }
67621
67622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67623         LDKRawDataPart a_conv;
67624         a_conv.inner = untag_ptr(a);
67625         a_conv.is_owned = ptr_is_owned(a);
67626         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67627         a_conv.is_owned = false;
67628         LDKRawDataPart b_conv;
67629         b_conv.inner = untag_ptr(b);
67630         b_conv.is_owned = ptr_is_owned(b);
67631         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67632         b_conv.is_owned = false;
67633         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
67634         return ret_conv;
67635 }
67636
67637 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
67638         LDKRawDataPart ret_var = RawDataPart_clone(arg);
67639         int64_t ret_ref = 0;
67640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67642         return ret_ref;
67643 }
67644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67645         LDKRawDataPart arg_conv;
67646         arg_conv.inner = untag_ptr(arg);
67647         arg_conv.is_owned = ptr_is_owned(arg);
67648         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67649         arg_conv.is_owned = false;
67650         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
67651         return ret_conv;
67652 }
67653
67654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67655         LDKRawDataPart orig_conv;
67656         orig_conv.inner = untag_ptr(orig);
67657         orig_conv.is_owned = ptr_is_owned(orig);
67658         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67659         orig_conv.is_owned = false;
67660         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
67661         int64_t ret_ref = 0;
67662         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67663         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67664         return ret_ref;
67665 }
67666
67667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
67668         LDKRawDataPart o_conv;
67669         o_conv.inner = untag_ptr(o);
67670         o_conv.is_owned = ptr_is_owned(o);
67671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67672         o_conv.is_owned = false;
67673         int64_t ret_conv = RawDataPart_hash(&o_conv);
67674         return ret_conv;
67675 }
67676
67677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67678         LDKPositiveTimestamp this_obj_conv;
67679         this_obj_conv.inner = untag_ptr(this_obj);
67680         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67682         PositiveTimestamp_free(this_obj_conv);
67683 }
67684
67685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67686         LDKPositiveTimestamp a_conv;
67687         a_conv.inner = untag_ptr(a);
67688         a_conv.is_owned = ptr_is_owned(a);
67689         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67690         a_conv.is_owned = false;
67691         LDKPositiveTimestamp b_conv;
67692         b_conv.inner = untag_ptr(b);
67693         b_conv.is_owned = ptr_is_owned(b);
67694         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67695         b_conv.is_owned = false;
67696         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
67697         return ret_conv;
67698 }
67699
67700 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
67701         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
67702         int64_t ret_ref = 0;
67703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67705         return ret_ref;
67706 }
67707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67708         LDKPositiveTimestamp arg_conv;
67709         arg_conv.inner = untag_ptr(arg);
67710         arg_conv.is_owned = ptr_is_owned(arg);
67711         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67712         arg_conv.is_owned = false;
67713         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
67714         return ret_conv;
67715 }
67716
67717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67718         LDKPositiveTimestamp orig_conv;
67719         orig_conv.inner = untag_ptr(orig);
67720         orig_conv.is_owned = ptr_is_owned(orig);
67721         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67722         orig_conv.is_owned = false;
67723         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
67724         int64_t ret_ref = 0;
67725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67727         return ret_ref;
67728 }
67729
67730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
67731         LDKPositiveTimestamp o_conv;
67732         o_conv.inner = untag_ptr(o);
67733         o_conv.is_owned = ptr_is_owned(o);
67734         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67735         o_conv.is_owned = false;
67736         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
67737         return ret_conv;
67738 }
67739
67740 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67741         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
67742         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
67743         return ret_conv;
67744 }
67745
67746 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
67747         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
67748         return ret_conv;
67749 }
67750
67751 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
67752         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
67753         return ret_conv;
67754 }
67755
67756 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
67757         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
67758         return ret_conv;
67759 }
67760
67761 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
67762         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
67763         return ret_conv;
67764 }
67765
67766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67767         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
67768         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
67769         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
67770         return ret_conv;
67771 }
67772
67773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
67774         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
67775         int64_t ret_conv = SiPrefix_hash(o_conv);
67776         return ret_conv;
67777 }
67778
67779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
67780         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
67781         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
67782         return ret_conv;
67783 }
67784
67785 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67786         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
67787         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
67788         return ret_conv;
67789 }
67790
67791 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
67792         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
67793         return ret_conv;
67794 }
67795
67796 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
67797         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
67798         return ret_conv;
67799 }
67800
67801 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
67802         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
67803         return ret_conv;
67804 }
67805
67806 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
67807         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
67808         return ret_conv;
67809 }
67810
67811 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
67812         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
67813         return ret_conv;
67814 }
67815
67816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
67817         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
67818         int64_t ret_conv = Currency_hash(o_conv);
67819         return ret_conv;
67820 }
67821
67822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67823         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
67824         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
67825         jboolean ret_conv = Currency_eq(a_conv, b_conv);
67826         return ret_conv;
67827 }
67828
67829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67830         LDKSha256 this_obj_conv;
67831         this_obj_conv.inner = untag_ptr(this_obj);
67832         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67834         Sha256_free(this_obj_conv);
67835 }
67836
67837 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
67838         LDKSha256 ret_var = Sha256_clone(arg);
67839         int64_t ret_ref = 0;
67840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67842         return ret_ref;
67843 }
67844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67845         LDKSha256 arg_conv;
67846         arg_conv.inner = untag_ptr(arg);
67847         arg_conv.is_owned = ptr_is_owned(arg);
67848         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67849         arg_conv.is_owned = false;
67850         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
67851         return ret_conv;
67852 }
67853
67854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67855         LDKSha256 orig_conv;
67856         orig_conv.inner = untag_ptr(orig);
67857         orig_conv.is_owned = ptr_is_owned(orig);
67858         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67859         orig_conv.is_owned = false;
67860         LDKSha256 ret_var = Sha256_clone(&orig_conv);
67861         int64_t ret_ref = 0;
67862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67864         return ret_ref;
67865 }
67866
67867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
67868         LDKSha256 o_conv;
67869         o_conv.inner = untag_ptr(o);
67870         o_conv.is_owned = ptr_is_owned(o);
67871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67872         o_conv.is_owned = false;
67873         int64_t ret_conv = Sha256_hash(&o_conv);
67874         return ret_conv;
67875 }
67876
67877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67878         LDKSha256 a_conv;
67879         a_conv.inner = untag_ptr(a);
67880         a_conv.is_owned = ptr_is_owned(a);
67881         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67882         a_conv.is_owned = false;
67883         LDKSha256 b_conv;
67884         b_conv.inner = untag_ptr(b);
67885         b_conv.is_owned = ptr_is_owned(b);
67886         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67887         b_conv.is_owned = false;
67888         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
67889         return ret_conv;
67890 }
67891
67892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
67893         uint8_t bytes_arr[32];
67894         CHECK((*env)->GetArrayLength(env, bytes) == 32);
67895         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
67896         uint8_t (*bytes_ref)[32] = &bytes_arr;
67897         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
67898         int64_t ret_ref = 0;
67899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67901         return ret_ref;
67902 }
67903
67904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67905         LDKDescription this_obj_conv;
67906         this_obj_conv.inner = untag_ptr(this_obj);
67907         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67909         Description_free(this_obj_conv);
67910 }
67911
67912 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
67913         LDKDescription ret_var = Description_clone(arg);
67914         int64_t ret_ref = 0;
67915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67917         return ret_ref;
67918 }
67919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
67920         LDKDescription arg_conv;
67921         arg_conv.inner = untag_ptr(arg);
67922         arg_conv.is_owned = ptr_is_owned(arg);
67923         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
67924         arg_conv.is_owned = false;
67925         int64_t ret_conv = Description_clone_ptr(&arg_conv);
67926         return ret_conv;
67927 }
67928
67929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
67930         LDKDescription orig_conv;
67931         orig_conv.inner = untag_ptr(orig);
67932         orig_conv.is_owned = ptr_is_owned(orig);
67933         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
67934         orig_conv.is_owned = false;
67935         LDKDescription ret_var = Description_clone(&orig_conv);
67936         int64_t ret_ref = 0;
67937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
67938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
67939         return ret_ref;
67940 }
67941
67942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
67943         LDKDescription o_conv;
67944         o_conv.inner = untag_ptr(o);
67945         o_conv.is_owned = ptr_is_owned(o);
67946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
67947         o_conv.is_owned = false;
67948         int64_t ret_conv = Description_hash(&o_conv);
67949         return ret_conv;
67950 }
67951
67952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
67953         LDKDescription a_conv;
67954         a_conv.inner = untag_ptr(a);
67955         a_conv.is_owned = ptr_is_owned(a);
67956         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
67957         a_conv.is_owned = false;
67958         LDKDescription b_conv;
67959         b_conv.inner = untag_ptr(b);
67960         b_conv.is_owned = ptr_is_owned(b);
67961         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
67962         b_conv.is_owned = false;
67963         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
67964         return ret_conv;
67965 }
67966
67967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
67968         LDKPayeePubKey this_obj_conv;
67969         this_obj_conv.inner = untag_ptr(this_obj);
67970         this_obj_conv.is_owned = ptr_is_owned(this_obj);
67971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
67972         PayeePubKey_free(this_obj_conv);
67973 }
67974
67975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
67976         LDKPayeePubKey this_ptr_conv;
67977         this_ptr_conv.inner = untag_ptr(this_ptr);
67978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67980         this_ptr_conv.is_owned = false;
67981         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
67982         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
67983         return ret_arr;
67984 }
67985
67986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
67987         LDKPayeePubKey this_ptr_conv;
67988         this_ptr_conv.inner = untag_ptr(this_ptr);
67989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
67990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
67991         this_ptr_conv.is_owned = false;
67992         LDKPublicKey val_ref;
67993         CHECK((*env)->GetArrayLength(env, val) == 33);
67994         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
67995         PayeePubKey_set_a(&this_ptr_conv, val_ref);
67996 }
67997
67998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
67999         LDKPublicKey a_arg_ref;
68000         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
68001         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
68002         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
68003         int64_t ret_ref = 0;
68004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68006         return ret_ref;
68007 }
68008
68009 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
68010         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
68011         int64_t ret_ref = 0;
68012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68014         return ret_ref;
68015 }
68016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68017         LDKPayeePubKey arg_conv;
68018         arg_conv.inner = untag_ptr(arg);
68019         arg_conv.is_owned = ptr_is_owned(arg);
68020         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68021         arg_conv.is_owned = false;
68022         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
68023         return ret_conv;
68024 }
68025
68026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68027         LDKPayeePubKey orig_conv;
68028         orig_conv.inner = untag_ptr(orig);
68029         orig_conv.is_owned = ptr_is_owned(orig);
68030         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68031         orig_conv.is_owned = false;
68032         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
68033         int64_t ret_ref = 0;
68034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68036         return ret_ref;
68037 }
68038
68039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
68040         LDKPayeePubKey o_conv;
68041         o_conv.inner = untag_ptr(o);
68042         o_conv.is_owned = ptr_is_owned(o);
68043         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68044         o_conv.is_owned = false;
68045         int64_t ret_conv = PayeePubKey_hash(&o_conv);
68046         return ret_conv;
68047 }
68048
68049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68050         LDKPayeePubKey a_conv;
68051         a_conv.inner = untag_ptr(a);
68052         a_conv.is_owned = ptr_is_owned(a);
68053         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68054         a_conv.is_owned = false;
68055         LDKPayeePubKey b_conv;
68056         b_conv.inner = untag_ptr(b);
68057         b_conv.is_owned = ptr_is_owned(b);
68058         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68059         b_conv.is_owned = false;
68060         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
68061         return ret_conv;
68062 }
68063
68064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68065         LDKExpiryTime this_obj_conv;
68066         this_obj_conv.inner = untag_ptr(this_obj);
68067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68069         ExpiryTime_free(this_obj_conv);
68070 }
68071
68072 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
68073         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
68074         int64_t ret_ref = 0;
68075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68077         return ret_ref;
68078 }
68079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68080         LDKExpiryTime arg_conv;
68081         arg_conv.inner = untag_ptr(arg);
68082         arg_conv.is_owned = ptr_is_owned(arg);
68083         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68084         arg_conv.is_owned = false;
68085         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
68086         return ret_conv;
68087 }
68088
68089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68090         LDKExpiryTime orig_conv;
68091         orig_conv.inner = untag_ptr(orig);
68092         orig_conv.is_owned = ptr_is_owned(orig);
68093         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68094         orig_conv.is_owned = false;
68095         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
68096         int64_t ret_ref = 0;
68097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68099         return ret_ref;
68100 }
68101
68102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
68103         LDKExpiryTime o_conv;
68104         o_conv.inner = untag_ptr(o);
68105         o_conv.is_owned = ptr_is_owned(o);
68106         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68107         o_conv.is_owned = false;
68108         int64_t ret_conv = ExpiryTime_hash(&o_conv);
68109         return ret_conv;
68110 }
68111
68112 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68113         LDKExpiryTime a_conv;
68114         a_conv.inner = untag_ptr(a);
68115         a_conv.is_owned = ptr_is_owned(a);
68116         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68117         a_conv.is_owned = false;
68118         LDKExpiryTime b_conv;
68119         b_conv.inner = untag_ptr(b);
68120         b_conv.is_owned = ptr_is_owned(b);
68121         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68122         b_conv.is_owned = false;
68123         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
68124         return ret_conv;
68125 }
68126
68127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68128         LDKMinFinalCltvExpiryDelta this_obj_conv;
68129         this_obj_conv.inner = untag_ptr(this_obj);
68130         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68132         MinFinalCltvExpiryDelta_free(this_obj_conv);
68133 }
68134
68135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
68136         LDKMinFinalCltvExpiryDelta this_ptr_conv;
68137         this_ptr_conv.inner = untag_ptr(this_ptr);
68138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68140         this_ptr_conv.is_owned = false;
68141         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
68142         return ret_conv;
68143 }
68144
68145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
68146         LDKMinFinalCltvExpiryDelta this_ptr_conv;
68147         this_ptr_conv.inner = untag_ptr(this_ptr);
68148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68150         this_ptr_conv.is_owned = false;
68151         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
68152 }
68153
68154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
68155         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
68156         int64_t ret_ref = 0;
68157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68159         return ret_ref;
68160 }
68161
68162 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
68163         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
68164         int64_t ret_ref = 0;
68165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68167         return ret_ref;
68168 }
68169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68170         LDKMinFinalCltvExpiryDelta arg_conv;
68171         arg_conv.inner = untag_ptr(arg);
68172         arg_conv.is_owned = ptr_is_owned(arg);
68173         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68174         arg_conv.is_owned = false;
68175         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
68176         return ret_conv;
68177 }
68178
68179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68180         LDKMinFinalCltvExpiryDelta orig_conv;
68181         orig_conv.inner = untag_ptr(orig);
68182         orig_conv.is_owned = ptr_is_owned(orig);
68183         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68184         orig_conv.is_owned = false;
68185         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
68186         int64_t ret_ref = 0;
68187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68189         return ret_ref;
68190 }
68191
68192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
68193         LDKMinFinalCltvExpiryDelta o_conv;
68194         o_conv.inner = untag_ptr(o);
68195         o_conv.is_owned = ptr_is_owned(o);
68196         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68197         o_conv.is_owned = false;
68198         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
68199         return ret_conv;
68200 }
68201
68202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68203         LDKMinFinalCltvExpiryDelta a_conv;
68204         a_conv.inner = untag_ptr(a);
68205         a_conv.is_owned = ptr_is_owned(a);
68206         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68207         a_conv.is_owned = false;
68208         LDKMinFinalCltvExpiryDelta b_conv;
68209         b_conv.inner = untag_ptr(b);
68210         b_conv.is_owned = ptr_is_owned(b);
68211         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68212         b_conv.is_owned = false;
68213         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
68214         return ret_conv;
68215 }
68216
68217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68218         if (!ptr_is_owned(this_ptr)) return;
68219         void* this_ptr_ptr = untag_ptr(this_ptr);
68220         CHECK_ACCESS(this_ptr_ptr);
68221         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
68222         FREE(untag_ptr(this_ptr));
68223         Fallback_free(this_ptr_conv);
68224 }
68225
68226 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
68227         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68228         *ret_copy = Fallback_clone(arg);
68229         int64_t ret_ref = tag_ptr(ret_copy, true);
68230         return ret_ref;
68231 }
68232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68233         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
68234         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
68235         return ret_conv;
68236 }
68237
68238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68239         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
68240         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68241         *ret_copy = Fallback_clone(orig_conv);
68242         int64_t ret_ref = tag_ptr(ret_copy, true);
68243         return ret_ref;
68244 }
68245
68246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
68247         
68248         LDKCVec_u8Z program_ref;
68249         program_ref.datalen = (*env)->GetArrayLength(env, program);
68250         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
68251         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
68252         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68253         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
68254         int64_t ret_ref = tag_ptr(ret_copy, true);
68255         return ret_ref;
68256 }
68257
68258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
68259         LDKTwentyBytes a_ref;
68260         CHECK((*env)->GetArrayLength(env, a) == 20);
68261         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
68262         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68263         *ret_copy = Fallback_pub_key_hash(a_ref);
68264         int64_t ret_ref = tag_ptr(ret_copy, true);
68265         return ret_ref;
68266 }
68267
68268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
68269         LDKTwentyBytes a_ref;
68270         CHECK((*env)->GetArrayLength(env, a) == 20);
68271         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
68272         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
68273         *ret_copy = Fallback_script_hash(a_ref);
68274         int64_t ret_ref = tag_ptr(ret_copy, true);
68275         return ret_ref;
68276 }
68277
68278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
68279         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
68280         int64_t ret_conv = Fallback_hash(o_conv);
68281         return ret_conv;
68282 }
68283
68284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68285         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
68286         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
68287         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
68288         return ret_conv;
68289 }
68290
68291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68292         LDKBolt11InvoiceSignature this_obj_conv;
68293         this_obj_conv.inner = untag_ptr(this_obj);
68294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68296         Bolt11InvoiceSignature_free(this_obj_conv);
68297 }
68298
68299 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
68300         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
68301         int64_t ret_ref = 0;
68302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68304         return ret_ref;
68305 }
68306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68307         LDKBolt11InvoiceSignature arg_conv;
68308         arg_conv.inner = untag_ptr(arg);
68309         arg_conv.is_owned = ptr_is_owned(arg);
68310         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68311         arg_conv.is_owned = false;
68312         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
68313         return ret_conv;
68314 }
68315
68316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68317         LDKBolt11InvoiceSignature orig_conv;
68318         orig_conv.inner = untag_ptr(orig);
68319         orig_conv.is_owned = ptr_is_owned(orig);
68320         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68321         orig_conv.is_owned = false;
68322         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
68323         int64_t ret_ref = 0;
68324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68326         return ret_ref;
68327 }
68328
68329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
68330         LDKBolt11InvoiceSignature o_conv;
68331         o_conv.inner = untag_ptr(o);
68332         o_conv.is_owned = ptr_is_owned(o);
68333         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68334         o_conv.is_owned = false;
68335         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
68336         return ret_conv;
68337 }
68338
68339 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68340         LDKBolt11InvoiceSignature a_conv;
68341         a_conv.inner = untag_ptr(a);
68342         a_conv.is_owned = ptr_is_owned(a);
68343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68344         a_conv.is_owned = false;
68345         LDKBolt11InvoiceSignature b_conv;
68346         b_conv.inner = untag_ptr(b);
68347         b_conv.is_owned = ptr_is_owned(b);
68348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68349         b_conv.is_owned = false;
68350         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
68351         return ret_conv;
68352 }
68353
68354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68355         LDKPrivateRoute this_obj_conv;
68356         this_obj_conv.inner = untag_ptr(this_obj);
68357         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68359         PrivateRoute_free(this_obj_conv);
68360 }
68361
68362 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
68363         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
68364         int64_t ret_ref = 0;
68365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68367         return ret_ref;
68368 }
68369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68370         LDKPrivateRoute arg_conv;
68371         arg_conv.inner = untag_ptr(arg);
68372         arg_conv.is_owned = ptr_is_owned(arg);
68373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68374         arg_conv.is_owned = false;
68375         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
68376         return ret_conv;
68377 }
68378
68379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68380         LDKPrivateRoute orig_conv;
68381         orig_conv.inner = untag_ptr(orig);
68382         orig_conv.is_owned = ptr_is_owned(orig);
68383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68384         orig_conv.is_owned = false;
68385         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
68386         int64_t ret_ref = 0;
68387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68389         return ret_ref;
68390 }
68391
68392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
68393         LDKPrivateRoute o_conv;
68394         o_conv.inner = untag_ptr(o);
68395         o_conv.is_owned = ptr_is_owned(o);
68396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68397         o_conv.is_owned = false;
68398         int64_t ret_conv = PrivateRoute_hash(&o_conv);
68399         return ret_conv;
68400 }
68401
68402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68403         LDKPrivateRoute a_conv;
68404         a_conv.inner = untag_ptr(a);
68405         a_conv.is_owned = ptr_is_owned(a);
68406         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68407         a_conv.is_owned = false;
68408         LDKPrivateRoute b_conv;
68409         b_conv.inner = untag_ptr(b);
68410         b_conv.is_owned = ptr_is_owned(b);
68411         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68412         b_conv.is_owned = false;
68413         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
68414         return ret_conv;
68415 }
68416
68417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
68418         LDKSignedRawBolt11Invoice this_arg_conv;
68419         this_arg_conv.inner = untag_ptr(this_arg);
68420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68422         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
68423         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
68424         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
68425         return tag_ptr(ret_conv, true);
68426 }
68427
68428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
68429         LDKSignedRawBolt11Invoice this_arg_conv;
68430         this_arg_conv.inner = untag_ptr(this_arg);
68431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68433         this_arg_conv.is_owned = false;
68434         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
68435         int64_t ret_ref = 0;
68436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68438         return ret_ref;
68439 }
68440
68441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68442         LDKSignedRawBolt11Invoice this_arg_conv;
68443         this_arg_conv.inner = untag_ptr(this_arg);
68444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68446         this_arg_conv.is_owned = false;
68447         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68448         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
68449         return ret_arr;
68450 }
68451
68452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
68453         LDKSignedRawBolt11Invoice this_arg_conv;
68454         this_arg_conv.inner = untag_ptr(this_arg);
68455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68457         this_arg_conv.is_owned = false;
68458         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
68459         int64_t ret_ref = 0;
68460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68462         return ret_ref;
68463 }
68464
68465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68466         LDKSignedRawBolt11Invoice this_arg_conv;
68467         this_arg_conv.inner = untag_ptr(this_arg);
68468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68470         this_arg_conv.is_owned = false;
68471         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
68472         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
68473         return tag_ptr(ret_conv, true);
68474 }
68475
68476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
68477         LDKSignedRawBolt11Invoice this_arg_conv;
68478         this_arg_conv.inner = untag_ptr(this_arg);
68479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68481         this_arg_conv.is_owned = false;
68482         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
68483         return ret_conv;
68484 }
68485
68486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68487         LDKRawBolt11Invoice this_arg_conv;
68488         this_arg_conv.inner = untag_ptr(this_arg);
68489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68491         this_arg_conv.is_owned = false;
68492         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68493         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
68494         return ret_arr;
68495 }
68496
68497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68498         LDKRawBolt11Invoice this_arg_conv;
68499         this_arg_conv.inner = untag_ptr(this_arg);
68500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68502         this_arg_conv.is_owned = false;
68503         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
68504         int64_t ret_ref = 0;
68505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68507         return ret_ref;
68508 }
68509
68510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
68511         LDKRawBolt11Invoice this_arg_conv;
68512         this_arg_conv.inner = untag_ptr(this_arg);
68513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68515         this_arg_conv.is_owned = false;
68516         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
68517         int64_t ret_ref = 0;
68518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68520         return ret_ref;
68521 }
68522
68523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68524         LDKRawBolt11Invoice this_arg_conv;
68525         this_arg_conv.inner = untag_ptr(this_arg);
68526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68528         this_arg_conv.is_owned = false;
68529         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
68530         int64_t ret_ref = 0;
68531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68533         return ret_ref;
68534 }
68535
68536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68537         LDKRawBolt11Invoice this_arg_conv;
68538         this_arg_conv.inner = untag_ptr(this_arg);
68539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68541         this_arg_conv.is_owned = false;
68542         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
68543         int64_t ret_ref = 0;
68544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68546         return ret_ref;
68547 }
68548
68549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
68550         LDKRawBolt11Invoice this_arg_conv;
68551         this_arg_conv.inner = untag_ptr(this_arg);
68552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68554         this_arg_conv.is_owned = false;
68555         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
68556         int64_t ret_ref = 0;
68557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68559         return ret_ref;
68560 }
68561
68562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
68563         LDKRawBolt11Invoice this_arg_conv;
68564         this_arg_conv.inner = untag_ptr(this_arg);
68565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68567         this_arg_conv.is_owned = false;
68568         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
68569         int64_t ret_ref = 0;
68570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68572         return ret_ref;
68573 }
68574
68575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68576         LDKRawBolt11Invoice this_arg_conv;
68577         this_arg_conv.inner = untag_ptr(this_arg);
68578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68580         this_arg_conv.is_owned = false;
68581         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
68582         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
68583         int64_t ret_ref = tag_ptr(ret_copy, true);
68584         return ret_ref;
68585 }
68586
68587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
68588         LDKRawBolt11Invoice this_arg_conv;
68589         this_arg_conv.inner = untag_ptr(this_arg);
68590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68592         this_arg_conv.is_owned = false;
68593         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68594         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
68595         int64_t ret_ref = tag_ptr(ret_copy, true);
68596         return ret_ref;
68597 }
68598
68599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
68600         LDKRawBolt11Invoice this_arg_conv;
68601         this_arg_conv.inner = untag_ptr(this_arg);
68602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68604         this_arg_conv.is_owned = false;
68605         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
68606         int64_t ret_ref = 0;
68607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68609         return ret_ref;
68610 }
68611
68612 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
68613         LDKRawBolt11Invoice this_arg_conv;
68614         this_arg_conv.inner = untag_ptr(this_arg);
68615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68617         this_arg_conv.is_owned = false;
68618         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
68619         int64_tArray ret_arr = NULL;
68620         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68621         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68622         for (size_t o = 0; o < ret_var.datalen; o++) {
68623                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
68624                 int64_t ret_conv_14_ref = 0;
68625                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
68626                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
68627                 ret_arr_ptr[o] = ret_conv_14_ref;
68628         }
68629         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68630         FREE(ret_var.data);
68631         return ret_arr;
68632 }
68633
68634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
68635         LDKRawBolt11Invoice this_arg_conv;
68636         this_arg_conv.inner = untag_ptr(this_arg);
68637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68639         this_arg_conv.is_owned = false;
68640         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68641         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
68642         int64_t ret_ref = tag_ptr(ret_copy, true);
68643         return ret_ref;
68644 }
68645
68646 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
68647         LDKRawBolt11Invoice this_arg_conv;
68648         this_arg_conv.inner = untag_ptr(this_arg);
68649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68651         this_arg_conv.is_owned = false;
68652         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
68653         return ret_conv;
68654 }
68655
68656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
68657         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68658         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
68659         return tag_ptr(ret_conv, true);
68660 }
68661
68662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
68663         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68664         *ret_conv = PositiveTimestamp_from_system_time(time);
68665         return tag_ptr(ret_conv, true);
68666 }
68667
68668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
68669         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
68670         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
68671         return tag_ptr(ret_conv, true);
68672 }
68673
68674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
68675         LDKPositiveTimestamp this_arg_conv;
68676         this_arg_conv.inner = untag_ptr(this_arg);
68677         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68679         this_arg_conv.is_owned = false;
68680         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
68681         return ret_conv;
68682 }
68683
68684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
68685         LDKPositiveTimestamp this_arg_conv;
68686         this_arg_conv.inner = untag_ptr(this_arg);
68687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68689         this_arg_conv.is_owned = false;
68690         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
68691         return ret_conv;
68692 }
68693
68694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
68695         LDKPositiveTimestamp this_arg_conv;
68696         this_arg_conv.inner = untag_ptr(this_arg);
68697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68699         this_arg_conv.is_owned = false;
68700         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
68701         return ret_conv;
68702 }
68703
68704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68705         LDKBolt11Invoice this_arg_conv;
68706         this_arg_conv.inner = untag_ptr(this_arg);
68707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68709         this_arg_conv.is_owned = false;
68710         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68711         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
68712         return ret_arr;
68713 }
68714
68715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
68716         LDKBolt11Invoice this_arg_conv;
68717         this_arg_conv.inner = untag_ptr(this_arg);
68718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68720         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
68721         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
68722         int64_t ret_ref = 0;
68723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68725         return ret_ref;
68726 }
68727
68728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
68729         LDKBolt11Invoice this_arg_conv;
68730         this_arg_conv.inner = untag_ptr(this_arg);
68731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68733         this_arg_conv.is_owned = false;
68734         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
68735         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
68736         return tag_ptr(ret_conv, true);
68737 }
68738
68739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
68740         LDKSignedRawBolt11Invoice signed_invoice_conv;
68741         signed_invoice_conv.inner = untag_ptr(signed_invoice);
68742         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
68743         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
68744         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
68745         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
68746         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
68747         return tag_ptr(ret_conv, true);
68748 }
68749
68750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
68751         LDKBolt11Invoice this_arg_conv;
68752         this_arg_conv.inner = untag_ptr(this_arg);
68753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68755         this_arg_conv.is_owned = false;
68756         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
68757         return ret_conv;
68758 }
68759
68760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
68761         LDKBolt11Invoice this_arg_conv;
68762         this_arg_conv.inner = untag_ptr(this_arg);
68763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68765         this_arg_conv.is_owned = false;
68766         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
68767         return ret_conv;
68768 }
68769
68770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
68771         LDKBolt11Invoice this_arg_conv;
68772         this_arg_conv.inner = untag_ptr(this_arg);
68773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68775         this_arg_conv.is_owned = false;
68776         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68777         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
68778         return ret_arr;
68779 }
68780
68781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68782         LDKBolt11Invoice this_arg_conv;
68783         this_arg_conv.inner = untag_ptr(this_arg);
68784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68786         this_arg_conv.is_owned = false;
68787         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68788         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
68789         return ret_arr;
68790 }
68791
68792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
68793         LDKBolt11Invoice this_arg_conv;
68794         this_arg_conv.inner = untag_ptr(this_arg);
68795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68797         this_arg_conv.is_owned = false;
68798         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68799         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
68800         return ret_arr;
68801 }
68802
68803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
68804         LDKBolt11Invoice this_arg_conv;
68805         this_arg_conv.inner = untag_ptr(this_arg);
68806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68808         this_arg_conv.is_owned = false;
68809         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
68810         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
68811         int64_t ret_ref = tag_ptr(ret_copy, true);
68812         return ret_ref;
68813 }
68814
68815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
68816         LDKBolt11Invoice this_arg_conv;
68817         this_arg_conv.inner = untag_ptr(this_arg);
68818         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68820         this_arg_conv.is_owned = false;
68821         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
68822         int64_t ret_ref = 0;
68823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68825         return ret_ref;
68826 }
68827
68828 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
68829         LDKBolt11Invoice this_arg_conv;
68830         this_arg_conv.inner = untag_ptr(this_arg);
68831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68833         this_arg_conv.is_owned = false;
68834         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68835         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
68836         return ret_arr;
68837 }
68838
68839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
68840         LDKBolt11Invoice this_arg_conv;
68841         this_arg_conv.inner = untag_ptr(this_arg);
68842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68844         this_arg_conv.is_owned = false;
68845         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
68846         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
68847         int64_t ret_ref = tag_ptr(ret_copy, true);
68848         return ret_ref;
68849 }
68850
68851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
68852         LDKBolt11Invoice this_arg_conv;
68853         this_arg_conv.inner = untag_ptr(this_arg);
68854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68856         this_arg_conv.is_owned = false;
68857         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
68858         return ret_conv;
68859 }
68860
68861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
68862         LDKBolt11Invoice this_arg_conv;
68863         this_arg_conv.inner = untag_ptr(this_arg);
68864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68866         this_arg_conv.is_owned = false;
68867         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
68868         return ret_conv;
68869 }
68870
68871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
68872         LDKBolt11Invoice this_arg_conv;
68873         this_arg_conv.inner = untag_ptr(this_arg);
68874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68876         this_arg_conv.is_owned = false;
68877         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
68878         return ret_conv;
68879 }
68880
68881 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) {
68882         LDKBolt11Invoice this_arg_conv;
68883         this_arg_conv.inner = untag_ptr(this_arg);
68884         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68886         this_arg_conv.is_owned = false;
68887         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
68888         return ret_conv;
68889 }
68890
68891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
68892         LDKBolt11Invoice this_arg_conv;
68893         this_arg_conv.inner = untag_ptr(this_arg);
68894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68896         this_arg_conv.is_owned = false;
68897         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
68898         return ret_conv;
68899 }
68900
68901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
68902         LDKBolt11Invoice this_arg_conv;
68903         this_arg_conv.inner = untag_ptr(this_arg);
68904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68906         this_arg_conv.is_owned = false;
68907         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
68908         return ret_conv;
68909 }
68910
68911 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
68912         LDKBolt11Invoice this_arg_conv;
68913         this_arg_conv.inner = untag_ptr(this_arg);
68914         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68916         this_arg_conv.is_owned = false;
68917         LDKCVec_AddressZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
68918         jobjectArray ret_arr = NULL;
68919         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
68920         ;
68921         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68922         for (size_t i = 0; i < ret_var.datalen; i++) {
68923                 LDKStr ret_conv_8_str = ret_var.data[i];
68924                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
68925                 Str_free(ret_conv_8_str);
68926                 ret_arr_ptr[i] = ret_conv_8_conv;
68927         }
68928         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68929         FREE(ret_var.data);
68930         return ret_arr;
68931 }
68932
68933 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
68934         LDKBolt11Invoice this_arg_conv;
68935         this_arg_conv.inner = untag_ptr(this_arg);
68936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68938         this_arg_conv.is_owned = false;
68939         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
68940         int64_tArray ret_arr = NULL;
68941         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68942         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68943         for (size_t o = 0; o < ret_var.datalen; o++) {
68944                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
68945                 int64_t ret_conv_14_ref = 0;
68946                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
68947                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
68948                 ret_arr_ptr[o] = ret_conv_14_ref;
68949         }
68950         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68951         FREE(ret_var.data);
68952         return ret_arr;
68953 }
68954
68955 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
68956         LDKBolt11Invoice this_arg_conv;
68957         this_arg_conv.inner = untag_ptr(this_arg);
68958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68960         this_arg_conv.is_owned = false;
68961         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
68962         int64_tArray ret_arr = NULL;
68963         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
68964         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
68965         for (size_t l = 0; l < ret_var.datalen; l++) {
68966                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
68967                 int64_t ret_conv_11_ref = 0;
68968                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
68969                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
68970                 ret_arr_ptr[l] = ret_conv_11_ref;
68971         }
68972         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
68973         FREE(ret_var.data);
68974         return ret_arr;
68975 }
68976
68977 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
68978         LDKBolt11Invoice this_arg_conv;
68979         this_arg_conv.inner = untag_ptr(this_arg);
68980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68982         this_arg_conv.is_owned = false;
68983         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
68984         return ret_conv;
68985 }
68986
68987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
68988         LDKBolt11Invoice this_arg_conv;
68989         this_arg_conv.inner = untag_ptr(this_arg);
68990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68992         this_arg_conv.is_owned = false;
68993         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
68994         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
68995         int64_t ret_ref = tag_ptr(ret_copy, true);
68996         return ret_ref;
68997 }
68998
68999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
69000         LDKStr description_conv = java_to_owned_str(env, description);
69001         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
69002         *ret_conv = Description_new(description_conv);
69003         return tag_ptr(ret_conv, true);
69004 }
69005
69006 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
69007         LDKDescription this_arg_conv;
69008         this_arg_conv.inner = untag_ptr(this_arg);
69009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69011         this_arg_conv = Description_clone(&this_arg_conv);
69012         LDKStr ret_str = Description_into_inner(this_arg_conv);
69013         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69014         Str_free(ret_str);
69015         return ret_conv;
69016 }
69017
69018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
69019         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
69020         int64_t ret_ref = 0;
69021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69023         return ret_ref;
69024 }
69025
69026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
69027         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
69028         int64_t ret_ref = 0;
69029         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69030         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69031         return ret_ref;
69032 }
69033
69034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
69035         LDKExpiryTime this_arg_conv;
69036         this_arg_conv.inner = untag_ptr(this_arg);
69037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69039         this_arg_conv.is_owned = false;
69040         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
69041         return ret_conv;
69042 }
69043
69044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
69045         LDKExpiryTime this_arg_conv;
69046         this_arg_conv.inner = untag_ptr(this_arg);
69047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69049         this_arg_conv.is_owned = false;
69050         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
69051         return ret_conv;
69052 }
69053
69054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
69055         LDKRouteHint hops_conv;
69056         hops_conv.inner = untag_ptr(hops);
69057         hops_conv.is_owned = ptr_is_owned(hops);
69058         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
69059         hops_conv = RouteHint_clone(&hops_conv);
69060         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
69061         *ret_conv = PrivateRoute_new(hops_conv);
69062         return tag_ptr(ret_conv, true);
69063 }
69064
69065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
69066         LDKPrivateRoute this_arg_conv;
69067         this_arg_conv.inner = untag_ptr(this_arg);
69068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69070         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
69071         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
69072         int64_t ret_ref = 0;
69073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69075         return ret_ref;
69076 }
69077
69078 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69079         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
69080         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
69081         return ret_conv;
69082 }
69083
69084 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
69085         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
69086         return ret_conv;
69087 }
69088
69089 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
69090         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
69091         return ret_conv;
69092 }
69093
69094 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
69095         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
69096         return ret_conv;
69097 }
69098
69099 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
69100         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
69101         return ret_conv;
69102 }
69103
69104 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
69105         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
69106         return ret_conv;
69107 }
69108
69109 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
69110         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
69111         return ret_conv;
69112 }
69113
69114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69115         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
69116         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
69117         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
69118         return ret_conv;
69119 }
69120
69121 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69122         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
69123         LDKStr ret_str = CreationError_to_str(o_conv);
69124         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69125         Str_free(ret_str);
69126         return ret_conv;
69127 }
69128
69129 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69130         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
69131         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
69132         return ret_conv;
69133 }
69134
69135 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
69136         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
69137         return ret_conv;
69138 }
69139
69140 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
69141         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
69142         return ret_conv;
69143 }
69144
69145 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
69146         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
69147         return ret_conv;
69148 }
69149
69150 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
69151         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
69152         return ret_conv;
69153 }
69154
69155 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
69156         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
69157         return ret_conv;
69158 }
69159
69160 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
69161         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
69162         return ret_conv;
69163 }
69164
69165 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
69166         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
69167         return ret_conv;
69168 }
69169
69170 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
69171         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
69172         return ret_conv;
69173 }
69174
69175 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
69176         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
69177         return ret_conv;
69178 }
69179
69180 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
69181         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
69182         return ret_conv;
69183 }
69184
69185 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69186         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
69187         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
69188         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
69189         return ret_conv;
69190 }
69191
69192 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69193         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
69194         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
69195         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69196         Str_free(ret_str);
69197         return ret_conv;
69198 }
69199
69200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69201         if (!ptr_is_owned(this_ptr)) return;
69202         void* this_ptr_ptr = untag_ptr(this_ptr);
69203         CHECK_ACCESS(this_ptr_ptr);
69204         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
69205         FREE(untag_ptr(this_ptr));
69206         SignOrCreationError_free(this_ptr_conv);
69207 }
69208
69209 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
69210         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69211         *ret_copy = SignOrCreationError_clone(arg);
69212         int64_t ret_ref = tag_ptr(ret_copy, true);
69213         return ret_ref;
69214 }
69215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69216         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
69217         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
69218         return ret_conv;
69219 }
69220
69221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69222         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
69223         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69224         *ret_copy = SignOrCreationError_clone(orig_conv);
69225         int64_t ret_ref = tag_ptr(ret_copy, true);
69226         return ret_ref;
69227 }
69228
69229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
69230         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69231         *ret_copy = SignOrCreationError_sign_error();
69232         int64_t ret_ref = tag_ptr(ret_copy, true);
69233         return ret_ref;
69234 }
69235
69236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
69237         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
69238         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
69239         *ret_copy = SignOrCreationError_creation_error(a_conv);
69240         int64_t ret_ref = tag_ptr(ret_copy, true);
69241         return ret_ref;
69242 }
69243
69244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69245         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
69246         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
69247         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
69248         return ret_conv;
69249 }
69250
69251 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69252         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
69253         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
69254         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69255         Str_free(ret_str);
69256         return ret_conv;
69257 }
69258
69259 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) {
69260         LDKBolt11Invoice invoice_conv;
69261         invoice_conv.inner = untag_ptr(invoice);
69262         invoice_conv.is_owned = ptr_is_owned(invoice);
69263         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69264         invoice_conv.is_owned = false;
69265         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69266         CHECK_ACCESS(retry_strategy_ptr);
69267         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69268         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69269         LDKChannelManager channelmanager_conv;
69270         channelmanager_conv.inner = untag_ptr(channelmanager);
69271         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69272         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69273         channelmanager_conv.is_owned = false;
69274         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
69275         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
69276         return tag_ptr(ret_conv, true);
69277 }
69278
69279 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) {
69280         LDKBolt11Invoice invoice_conv;
69281         invoice_conv.inner = untag_ptr(invoice);
69282         invoice_conv.is_owned = ptr_is_owned(invoice);
69283         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69284         invoice_conv.is_owned = false;
69285         LDKThirtyTwoBytes payment_id_ref;
69286         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
69287         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
69288         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69289         CHECK_ACCESS(retry_strategy_ptr);
69290         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69291         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69292         LDKChannelManager channelmanager_conv;
69293         channelmanager_conv.inner = untag_ptr(channelmanager);
69294         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69295         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69296         channelmanager_conv.is_owned = false;
69297         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
69298         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
69299         return tag_ptr(ret_conv, true);
69300 }
69301
69302 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) {
69303         LDKBolt11Invoice invoice_conv;
69304         invoice_conv.inner = untag_ptr(invoice);
69305         invoice_conv.is_owned = ptr_is_owned(invoice);
69306         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69307         invoice_conv.is_owned = false;
69308         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69309         CHECK_ACCESS(retry_strategy_ptr);
69310         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69311         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69312         LDKChannelManager channelmanager_conv;
69313         channelmanager_conv.inner = untag_ptr(channelmanager);
69314         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69315         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69316         channelmanager_conv.is_owned = false;
69317         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
69318         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
69319         return tag_ptr(ret_conv, true);
69320 }
69321
69322 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) {
69323         LDKBolt11Invoice invoice_conv;
69324         invoice_conv.inner = untag_ptr(invoice);
69325         invoice_conv.is_owned = ptr_is_owned(invoice);
69326         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
69327         invoice_conv.is_owned = false;
69328         LDKThirtyTwoBytes payment_id_ref;
69329         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
69330         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
69331         void* retry_strategy_ptr = untag_ptr(retry_strategy);
69332         CHECK_ACCESS(retry_strategy_ptr);
69333         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
69334         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
69335         LDKChannelManager channelmanager_conv;
69336         channelmanager_conv.inner = untag_ptr(channelmanager);
69337         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69338         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69339         channelmanager_conv.is_owned = false;
69340         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
69341         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
69342         return tag_ptr(ret_conv, true);
69343 }
69344
69345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69346         if (!ptr_is_owned(this_ptr)) return;
69347         void* this_ptr_ptr = untag_ptr(this_ptr);
69348         CHECK_ACCESS(this_ptr_ptr);
69349         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
69350         FREE(untag_ptr(this_ptr));
69351         PaymentError_free(this_ptr_conv);
69352 }
69353
69354 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
69355         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69356         *ret_copy = PaymentError_clone(arg);
69357         int64_t ret_ref = tag_ptr(ret_copy, true);
69358         return ret_ref;
69359 }
69360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69361         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
69362         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
69363         return ret_conv;
69364 }
69365
69366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69367         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
69368         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69369         *ret_copy = PaymentError_clone(orig_conv);
69370         int64_t ret_ref = tag_ptr(ret_copy, true);
69371         return ret_ref;
69372 }
69373
69374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
69375         LDKStr a_conv = java_to_owned_str(env, a);
69376         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69377         *ret_copy = PaymentError_invoice(a_conv);
69378         int64_t ret_ref = tag_ptr(ret_copy, true);
69379         return ret_ref;
69380 }
69381
69382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, jclass a) {
69383         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_java(env, a);
69384         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
69385         *ret_copy = PaymentError_sending(a_conv);
69386         int64_t ret_ref = tag_ptr(ret_copy, true);
69387         return ret_ref;
69388 }
69389
69390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69391         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
69392         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
69393         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
69394         return ret_conv;
69395 }
69396
69397 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) {
69398         void* amt_msat_ptr = untag_ptr(amt_msat);
69399         CHECK_ACCESS(amt_msat_ptr);
69400         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69401         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69402         void* payment_hash_ptr = untag_ptr(payment_hash);
69403         CHECK_ACCESS(payment_hash_ptr);
69404         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
69405         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
69406         LDKStr description_conv = java_to_owned_str(env, description);
69407         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
69408         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
69409         if (phantom_route_hints_constr.datalen > 0)
69410                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
69411         else
69412                 phantom_route_hints_constr.data = NULL;
69413         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
69414         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
69415                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
69416                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
69417                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
69418                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
69419                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
69420                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
69421                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
69422         }
69423         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
69424         void* entropy_source_ptr = untag_ptr(entropy_source);
69425         CHECK_ACCESS(entropy_source_ptr);
69426         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69427         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69428                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69429                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69430         }
69431         void* node_signer_ptr = untag_ptr(node_signer);
69432         CHECK_ACCESS(node_signer_ptr);
69433         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69434         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69435                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69436                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69437         }
69438         void* logger_ptr = untag_ptr(logger);
69439         CHECK_ACCESS(logger_ptr);
69440         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69441         if (logger_conv.free == LDKLogger_JCalls_free) {
69442                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69443                 LDKLogger_JCalls_cloned(&logger_conv);
69444         }
69445         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69446         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69447         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69448         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69449         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69450         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69451         *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);
69452         return tag_ptr(ret_conv, true);
69453 }
69454
69455 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) {
69456         void* amt_msat_ptr = untag_ptr(amt_msat);
69457         CHECK_ACCESS(amt_msat_ptr);
69458         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69459         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69460         void* payment_hash_ptr = untag_ptr(payment_hash);
69461         CHECK_ACCESS(payment_hash_ptr);
69462         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
69463         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
69464         LDKSha256 description_hash_conv;
69465         description_hash_conv.inner = untag_ptr(description_hash);
69466         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69467         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69468         description_hash_conv = Sha256_clone(&description_hash_conv);
69469         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
69470         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
69471         if (phantom_route_hints_constr.datalen > 0)
69472                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
69473         else
69474                 phantom_route_hints_constr.data = NULL;
69475         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
69476         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
69477                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
69478                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
69479                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
69480                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
69481                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
69482                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
69483                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
69484         }
69485         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
69486         void* entropy_source_ptr = untag_ptr(entropy_source);
69487         CHECK_ACCESS(entropy_source_ptr);
69488         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69489         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69490                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69491                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69492         }
69493         void* node_signer_ptr = untag_ptr(node_signer);
69494         CHECK_ACCESS(node_signer_ptr);
69495         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69496         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69497                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69498                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69499         }
69500         void* logger_ptr = untag_ptr(logger);
69501         CHECK_ACCESS(logger_ptr);
69502         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69503         if (logger_conv.free == LDKLogger_JCalls_free) {
69504                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69505                 LDKLogger_JCalls_cloned(&logger_conv);
69506         }
69507         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69508         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69509         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69510         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69511         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69512         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69513         *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);
69514         return tag_ptr(ret_conv, true);
69515 }
69516
69517 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) {
69518         LDKChannelManager channelmanager_conv;
69519         channelmanager_conv.inner = untag_ptr(channelmanager);
69520         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69521         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69522         channelmanager_conv.is_owned = false;
69523         void* node_signer_ptr = untag_ptr(node_signer);
69524         CHECK_ACCESS(node_signer_ptr);
69525         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69526         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69527                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69528                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69529         }
69530         void* logger_ptr = untag_ptr(logger);
69531         CHECK_ACCESS(logger_ptr);
69532         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69533         if (logger_conv.free == LDKLogger_JCalls_free) {
69534                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69535                 LDKLogger_JCalls_cloned(&logger_conv);
69536         }
69537         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69538         void* amt_msat_ptr = untag_ptr(amt_msat);
69539         CHECK_ACCESS(amt_msat_ptr);
69540         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69541         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69542         LDKStr description_conv = java_to_owned_str(env, description);
69543         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69544         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69545         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69546         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69547         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69548         *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);
69549         return tag_ptr(ret_conv, true);
69550 }
69551
69552 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) {
69553         LDKChannelManager channelmanager_conv;
69554         channelmanager_conv.inner = untag_ptr(channelmanager);
69555         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69556         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69557         channelmanager_conv.is_owned = false;
69558         void* node_signer_ptr = untag_ptr(node_signer);
69559         CHECK_ACCESS(node_signer_ptr);
69560         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69561         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69562                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69563                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69564         }
69565         void* logger_ptr = untag_ptr(logger);
69566         CHECK_ACCESS(logger_ptr);
69567         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69568         if (logger_conv.free == LDKLogger_JCalls_free) {
69569                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69570                 LDKLogger_JCalls_cloned(&logger_conv);
69571         }
69572         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69573         void* amt_msat_ptr = untag_ptr(amt_msat);
69574         CHECK_ACCESS(amt_msat_ptr);
69575         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69576         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69577         LDKSha256 description_hash_conv;
69578         description_hash_conv.inner = untag_ptr(description_hash);
69579         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69580         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69581         description_hash_conv = Sha256_clone(&description_hash_conv);
69582         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69583         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69584         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69585         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69586         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69587         *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);
69588         return tag_ptr(ret_conv, true);
69589 }
69590
69591 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) {
69592         LDKChannelManager channelmanager_conv;
69593         channelmanager_conv.inner = untag_ptr(channelmanager);
69594         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69595         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69596         channelmanager_conv.is_owned = false;
69597         void* node_signer_ptr = untag_ptr(node_signer);
69598         CHECK_ACCESS(node_signer_ptr);
69599         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69600         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69601                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69602                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69603         }
69604         void* logger_ptr = untag_ptr(logger);
69605         CHECK_ACCESS(logger_ptr);
69606         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69607         if (logger_conv.free == LDKLogger_JCalls_free) {
69608                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69609                 LDKLogger_JCalls_cloned(&logger_conv);
69610         }
69611         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69612         void* amt_msat_ptr = untag_ptr(amt_msat);
69613         CHECK_ACCESS(amt_msat_ptr);
69614         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69615         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69616         LDKSha256 description_hash_conv;
69617         description_hash_conv.inner = untag_ptr(description_hash);
69618         description_hash_conv.is_owned = ptr_is_owned(description_hash);
69619         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
69620         description_hash_conv = Sha256_clone(&description_hash_conv);
69621         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69622         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69623         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69624         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69625         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69626         *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);
69627         return tag_ptr(ret_conv, true);
69628 }
69629
69630 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) {
69631         LDKChannelManager channelmanager_conv;
69632         channelmanager_conv.inner = untag_ptr(channelmanager);
69633         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69634         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69635         channelmanager_conv.is_owned = false;
69636         void* node_signer_ptr = untag_ptr(node_signer);
69637         CHECK_ACCESS(node_signer_ptr);
69638         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69639         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69640                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69641                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69642         }
69643         void* logger_ptr = untag_ptr(logger);
69644         CHECK_ACCESS(logger_ptr);
69645         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69646         if (logger_conv.free == LDKLogger_JCalls_free) {
69647                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69648                 LDKLogger_JCalls_cloned(&logger_conv);
69649         }
69650         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69651         void* amt_msat_ptr = untag_ptr(amt_msat);
69652         CHECK_ACCESS(amt_msat_ptr);
69653         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69654         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69655         LDKStr description_conv = java_to_owned_str(env, description);
69656         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69657         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69658         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69659         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69660         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69661         *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);
69662         return tag_ptr(ret_conv, true);
69663 }
69664
69665 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) {
69666         LDKChannelManager channelmanager_conv;
69667         channelmanager_conv.inner = untag_ptr(channelmanager);
69668         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
69669         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
69670         channelmanager_conv.is_owned = false;
69671         void* node_signer_ptr = untag_ptr(node_signer);
69672         CHECK_ACCESS(node_signer_ptr);
69673         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
69674         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
69675                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69676                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
69677         }
69678         void* logger_ptr = untag_ptr(logger);
69679         CHECK_ACCESS(logger_ptr);
69680         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69681         if (logger_conv.free == LDKLogger_JCalls_free) {
69682                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69683                 LDKLogger_JCalls_cloned(&logger_conv);
69684         }
69685         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
69686         void* amt_msat_ptr = untag_ptr(amt_msat);
69687         CHECK_ACCESS(amt_msat_ptr);
69688         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
69689         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
69690         LDKStr description_conv = java_to_owned_str(env, description);
69691         LDKThirtyTwoBytes payment_hash_ref;
69692         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
69693         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
69694         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
69695         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
69696         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
69697         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
69698         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
69699         *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);
69700         return tag_ptr(ret_conv, true);
69701 }
69702
69703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
69704         LDKStr s_conv = java_to_owned_str(env, s);
69705         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
69706         *ret_conv = SiPrefix_from_str(s_conv);
69707         return tag_ptr(ret_conv, true);
69708 }
69709
69710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
69711         LDKStr s_conv = java_to_owned_str(env, s);
69712         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
69713         *ret_conv = Bolt11Invoice_from_str(s_conv);
69714         return tag_ptr(ret_conv, true);
69715 }
69716
69717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
69718         LDKStr s_conv = java_to_owned_str(env, s);
69719         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
69720         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
69721         return tag_ptr(ret_conv, true);
69722 }
69723
69724 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69725         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
69726         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
69727         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69728         Str_free(ret_str);
69729         return ret_conv;
69730 }
69731
69732 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69733         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
69734         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
69735         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69736         Str_free(ret_str);
69737         return ret_conv;
69738 }
69739
69740 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69741         LDKBolt11Invoice o_conv;
69742         o_conv.inner = untag_ptr(o);
69743         o_conv.is_owned = ptr_is_owned(o);
69744         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69745         o_conv.is_owned = false;
69746         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
69747         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69748         Str_free(ret_str);
69749         return ret_conv;
69750 }
69751
69752 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69753         LDKSignedRawBolt11Invoice o_conv;
69754         o_conv.inner = untag_ptr(o);
69755         o_conv.is_owned = ptr_is_owned(o);
69756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69757         o_conv.is_owned = false;
69758         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
69759         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69760         Str_free(ret_str);
69761         return ret_conv;
69762 }
69763
69764 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69765         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
69766         LDKStr ret_str = Currency_to_str(o_conv);
69767         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69768         Str_free(ret_str);
69769         return ret_conv;
69770 }
69771
69772 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
69773         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
69774         LDKStr ret_str = SiPrefix_to_str(o_conv);
69775         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
69776         Str_free(ret_str);
69777         return ret_conv;
69778 }
69779
69780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69781         LDKRapidGossipSync this_obj_conv;
69782         this_obj_conv.inner = untag_ptr(this_obj);
69783         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69784         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69785         RapidGossipSync_free(this_obj_conv);
69786 }
69787
69788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
69789         LDKNetworkGraph network_graph_conv;
69790         network_graph_conv.inner = untag_ptr(network_graph);
69791         network_graph_conv.is_owned = ptr_is_owned(network_graph);
69792         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
69793         network_graph_conv.is_owned = false;
69794         void* logger_ptr = untag_ptr(logger);
69795         CHECK_ACCESS(logger_ptr);
69796         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
69797         if (logger_conv.free == LDKLogger_JCalls_free) {
69798                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69799                 LDKLogger_JCalls_cloned(&logger_conv);
69800         }
69801         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
69802         int64_t ret_ref = 0;
69803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69805         return ret_ref;
69806 }
69807
69808 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) {
69809         LDKRapidGossipSync this_arg_conv;
69810         this_arg_conv.inner = untag_ptr(this_arg);
69811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69813         this_arg_conv.is_owned = false;
69814         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
69815         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
69816         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
69817         return tag_ptr(ret_conv, true);
69818 }
69819
69820 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) {
69821         LDKRapidGossipSync this_arg_conv;
69822         this_arg_conv.inner = untag_ptr(this_arg);
69823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69825         this_arg_conv.is_owned = false;
69826         LDKu8slice update_data_ref;
69827         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
69828         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
69829         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
69830         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
69831         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
69832         return tag_ptr(ret_conv, true);
69833 }
69834
69835 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) {
69836         LDKRapidGossipSync this_arg_conv;
69837         this_arg_conv.inner = untag_ptr(this_arg);
69838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69840         this_arg_conv.is_owned = false;
69841         LDKu8slice update_data_ref;
69842         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
69843         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
69844         void* current_time_unix_ptr = untag_ptr(current_time_unix);
69845         CHECK_ACCESS(current_time_unix_ptr);
69846         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
69847         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
69848         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
69849         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
69850         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
69851         return tag_ptr(ret_conv, true);
69852 }
69853
69854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
69855         LDKRapidGossipSync this_arg_conv;
69856         this_arg_conv.inner = untag_ptr(this_arg);
69857         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69859         this_arg_conv.is_owned = false;
69860         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
69861         return ret_conv;
69862 }
69863
69864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69865         if (!ptr_is_owned(this_ptr)) return;
69866         void* this_ptr_ptr = untag_ptr(this_ptr);
69867         CHECK_ACCESS(this_ptr_ptr);
69868         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
69869         FREE(untag_ptr(this_ptr));
69870         GraphSyncError_free(this_ptr_conv);
69871 }
69872
69873 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
69874         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
69875         *ret_copy = GraphSyncError_clone(arg);
69876         int64_t ret_ref = tag_ptr(ret_copy, true);
69877         return ret_ref;
69878 }
69879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69880         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
69881         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
69882         return ret_conv;
69883 }
69884
69885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69886         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
69887         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
69888         *ret_copy = GraphSyncError_clone(orig_conv);
69889         int64_t ret_ref = tag_ptr(ret_copy, true);
69890         return ret_ref;
69891 }
69892
69893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
69894         void* a_ptr = untag_ptr(a);
69895         CHECK_ACCESS(a_ptr);
69896         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
69897         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
69898         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
69899         *ret_copy = GraphSyncError_decode_error(a_conv);
69900         int64_t ret_ref = tag_ptr(ret_copy, true);
69901         return ret_ref;
69902 }
69903
69904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
69905         LDKLightningError a_conv;
69906         a_conv.inner = untag_ptr(a);
69907         a_conv.is_owned = ptr_is_owned(a);
69908         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69909         a_conv = LightningError_clone(&a_conv);
69910         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
69911         *ret_copy = GraphSyncError_lightning_error(a_conv);
69912         int64_t ret_ref = tag_ptr(ret_copy, true);
69913         return ret_ref;
69914 }
69915